Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
JDBC adapter cannot translate NOT LIKE in join condition. Rel2SqlConverter throws assertion error for NOT operator in join condition.
The following test shows the bug if you put it in RelToSqlConverter
@Test void testJoinWithNotLikeConditionRel2Sql() { final Function<RelBuilder, RelNode> relFn = b -> b .scan("EMP") .scan("DEPT") .join(JoinRelType.LEFT, b.and( b.call(SqlStdOperatorTable.EQUALS, b.field(2, 0, "DEPTNO"), b.field(2, 1, "DEPTNO")), b.call(SqlStdOperatorTable.NOT, b.call(SqlStdOperatorTable.LIKE, b.field(2, 1, "DNAME"), b.literal("ACCOUNTING_FOO")) ) )) .build(); final String expectedSql = "SELECT *\n" + "FROM \"scott\".\"EMP\"\n" + "LEFT JOIN \"scott\".\"DEPT\" " + "ON \"EMP\".\"DEPTNO\" = \"DEPT\".\"DEPTNO\" " + "AND \"DEPT\".\"DNAME\" NOT LIKE 'ACCOUNTING'"; relFn(relFn).ok(expectedSql); }
It blows up with the following stacktrace top:
java.lang.AssertionError: NOT(LIKE($9, 'ACCOUNTING_FOO')) at org.apache.calcite.rel.rel2sql.SqlImplementor.convertConditionToSqlNode(SqlImplementor.java:350) at org.apache.calcite.rel.rel2sql.SqlImplementor.convertConditionToSqlNode(SqlImplementor.java:286) at org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:213) at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:524) at org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:131) at org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitInput(RelToSqlConverter.java:139)
Attachments
Issue Links
- is related to
-
CALCITE-4279 SEARCH operator cannot be pushed into Druid
- Closed