Zhen Chen created CALCITE-7352:
----------------------------------
Summary: Incorrect SqlLibrary enum value used in ClickHouse SQL
test
Key: CALCITE-7352
URL: https://issues.apache.org/jira/browse/CALCITE-7352
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.41.0
Reporter: Zhen Chen
Fix For: 1.42.0
The test code incorrectly referenced Spark's library definition for querying
ClickHouse, ignoring the SqlLibrary.CLICKHOUSE enumeration value specifically
designed for ClickHouse.
The test is here
{code:java}
@Test void testStartsWith() {
final String query = "select startswith(\"brand_name\", 'a')\n"
+ "from \"product\"";
final String expectedBigQuery = "SELECT STARTS_WITH(brand_name, 'a')\n"
+ "FROM foodmart.product";
final String expectedPostgres = "SELECT STARTS_WITH(\"brand_name\", 'a')\n"
+ "FROM \"foodmart\".\"product\"";
final String expectedSnowflake = "SELECT STARTSWITH(\"brand_name\", 'a')\n"
+ "FROM \"foodmart\".\"product\"";
final String expectedSpark = "SELECT STARTSWITH(`brand_name`, 'a')\n"
+ "FROM `foodmart`.`product`";
final String expectedClickHouse = "SELECT startsWith(`brand_name`, 'a')\n"
+ "FROM `foodmart`.`product`";
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withBigQuery().ok(expectedBigQuery);
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withPostgresql().ok(expectedPostgres);
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withSnowflake().ok(expectedSnowflake);
sql(query).withLibrary(SqlLibrary.SPARK).withSpark().ok(expectedSpark);
sql(query).withLibrary(SqlLibrary.SPARK).withClickHouse().ok(expectedClickHouse);
<------ here
} {code}
testEndsWith() also has the same issue.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)