You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Atharv Rajput (JIRA)" <ji...@apache.org> on 2019/08/12 07:08:00 UTC

[jira] [Created] (CALCITE-3242) RelToSqlConverter not handling "NOT IN" properly

Atharv Rajput created CALCITE-3242:
--------------------------------------

             Summary: RelToSqlConverter not handling "NOT IN" properly
                 Key: CALCITE-3242
                 URL: https://issues.apache.org/jira/browse/CALCITE-3242
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Atharv Rajput
            Assignee: Atharv Rajput
             Fix For: 1.21.0


When RelNode is having `NOT IN` operator, it's being converted incorrectly by RelToSqlConverter. For example
{code:java}
@Test public void testNotInOperator() {
  final RelBuilder builder = relBuilder().scan("EMP");
  final RexNode condition =
    builder.call(SqlStdOperatorTable.NOT_IN, builder.field("DEPTNO"),
      builder.literal(20), builder.literal(30));
  final RelNode root = relBuilder().scan("EMP").filter(condition).build();
  final String sql = toSql(root);
  final String expectedSql = "SELECT *\n"
    + "FROM \"scott\".\"EMP\"\n"
    + "WHERE \"DEPTNO\" NOT IN (20, 30)";
  assertThat(sql, isLinux(expectedSql));
}
{code}
Above test fails with error:
{code:java}
Expected: is "SELECT *\nFROM \"scott\".\"EMP\"\nWHERE \"DEPTNO\" NOT IN (20, 30)"
but: was "SELECT *\nFROM \"scott\".\"EMP\"\nWHERE \"DEPTNO\" NOT IN 20 NOT IN 30"
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)