MyCATApache / Mycat-Server

GNU General Public License v2.0
9.51k stars 3.85k forks source link

Fixed testAggregateExpr test #2940

Open yesh385 opened 1 year ago

yesh385 commented 1 year ago

This PR fixes a test called DruidMysqlRouteStrategyTest.testAggregateExpr which can be found here.

  1. What does this test do?

This test is responsible for testing the behavior of the route strategy when processing SQL queries with aggregate functions and different aliasing scenarios. It checks if the result set correctly identifies and names the aggregated columns.

  1. Why does this test fail?

This test fails because we are checking if the HashMap returned by getMergeCols() method contains the column name as a key while not checking for case sensitivity.

  1. How I fixed?

This PR fixes this issue by updating the key name into uppercase.

The assertion happens here: https://github.com/MyCATApache/Mycat-Server/blob/243539fb74bbdcb9819fecc7e7b50ccf0899e671/src/test/java/io/mycat/route/DruidMysqlRouteStrategyTest.java#L960

You can run the following command to run the test:

mvn test -Dtest=io.mycat.route.DruidMysqlRouteStrategyTest#testAggregateExpr

Test Environment:

java version "1.8.0_202"
Apache Maven 3.6.3