NobiGo commented on code in PR #4205:
URL: https://github.com/apache/calcite/pull/4205#discussion_r1962916343
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -8230,24 +8231,55 @@ private void checkLiteral2(String expression, String
expected) {
}
/** Test case for
- * <a
href="https://issues.apache.org/jira/browse/CALCITE-6819">[CALCITE-6819]
- * MSSQL doesn't support TRUE/FALSE keywords in its Join predicate</a>. */
- @Test void testJoinBoolLiteralMSSQL() {
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6847">[CALCITE-6847]
+ * Support ClickHouse Dialect with join on Boolean type</a>. */
+ @Test void testJoinBoolLiteral() {
final String queryTrue = "SELECT \"hire_date\", \"department_description\"
FROM \"employee\" "
+ "LEFT JOIN \"department\" ON TRUE";
+ final String queryFalse = "SELECT \"hire_date\",
\"department_description\" FROM \"employee\" "
+ + "LEFT JOIN \"department\" ON False";
+
+ final String queryTrue1 = "SELECT \"hire_date\",
\"department_description\" FROM \"employee\" "
+ + "LEFT JOIN \"department\" ON 1 = 1";
+ final String queryFalse1 = "SELECT \"hire_date\",
\"department_description\" FROM \"employee\" "
+ + "LEFT JOIN \"department\" ON 1 = 0";
+
+ // mssql test
final String mssqlExpected1 = "SELECT [employee].[hire_date],"
+ " [department].[department_description]\nFROM
[foodmart].[employee]\nLEFT JOIN"
+ " [foodmart].[department] ON (1 = 1)";
sql(queryTrue)
.dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected1);
+ sql(queryTrue1)
+ .dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected1);
+
- final String queryFalse = "SELECT \"hire_date\",
\"department_description\" FROM \"employee\" "
- + "LEFT JOIN \"department\" ON False";
final String mssqlExpected2 = "SELECT [employee].[hire_date],"
+ " [department].[department_description]\nFROM
[foodmart].[employee]\nLEFT JOIN"
+ " [foodmart].[department] ON (1 = 0)";
sql(queryFalse)
.dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected2);
+ sql(queryFalse1)
+ .dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected2);
+
+ // clickhouse test
+ final String clickhouseExpected1 = "SELECT `employee`.`hire_date`,"
Review Comment:
How about this SQL:
```
SELECT TRUE from "employee"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]