Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0-incubating
    • Fix Version/s: 1.5.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Running against the Derby foodmart database

      Description

      0: jdbc:calcite:model=inline:{"version":1.0,"> SELECT T1."brand_name" FROM "foodmart"."product" AS T1 INNER JOIN "foodmart"."product_class" AS T2 ON T1."product_class_id" = T2."product_class_id" WHERE T2."product_department" = 'Frozen Foods' OR T2."product_department" = 'Baking Goods' AND T1."brand_name" <> 'King';
      java.lang.AssertionError: =($3, 'Frozen Foods')
      	at org.apache.calcite.adapter.jdbc.JdbcRules$JdbcJoin.convertConditionToSqlNode(JdbcRules.java:416)
      	at org.apache.calcite.adapter.jdbc.JdbcRules$JdbcJoin.convertConditionToSqlNode(JdbcRules.java:376)
      	at org.apache.calcite.adapter.jdbc.JdbcRules$JdbcJoin.convertConditionToSqlNode(JdbcRules.java:376)
      	at org.apache.calcite.adapter.jdbc.JdbcRules$JdbcJoin.implement(JdbcRules.java:337)
      	at org.apache.calcite.adapter.jdbc.JdbcImplementor.visitChild(JdbcImplementor.java:118)
      	at org.apache.calcite.adapter.jdbc.JdbcRules$JdbcProject.implement(JdbcRules.java:600)
      	at org.apache.calcite.adapter.jdbc.JdbcImplementor.visitChild(JdbcImplementor.java:118)
      	at org.apache.calcite.adapter.jdbc.JdbcToEnumerableConverter.generateSql(JdbcToEnumerableConverter.java:297)
      	at org.apache.calcite.adapter.jdbc.JdbcToEnumerableConverter.implement(JdbcToEnumerableConverter.java:89)
      	at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:99)
      	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
      	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1117)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:293)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:189)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:700)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:586)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:556)
      	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:207)
      	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:563)
      	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:477)
      	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:110)
      	at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:121)
      	at sqlline.SqlLine$Commands.execute(Unknown Source)
      	at sqlline.SqlLine$Commands.sql(Unknown Source)
      	at sqlline.SqlLine.dispatch(Unknown Source)
      	at sqlline.SqlLine.begin(Unknown Source)
      	at sqlline.SqlLine.mainWithInputRedirection(Unknown Source)
      	at sqlline.SqlLine.main(Unknown Source)
      

        Activity

        Hide
        jcamachorodriguez Jesus Camacho Rodriguez added a comment -

        Resolved in release 1.5.0 (2015-11-10)

        Show
        jcamachorodriguez Jesus Camacho Rodriguez added a comment - Resolved in release 1.5.0 (2015-11-10)
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/c2950eba .
        Hide
        julianhyde Julian Hyde added a comment -

        The issue is that the JdbcAdapter only supports equi-join, i.e. conditions of the form left.column1 = right.column1 AND left.column2 = right.column2.

        Show
        julianhyde Julian Hyde added a comment - The issue is that the JdbcAdapter only supports equi-join, i.e. conditions of the form left.column1 = right.column1 AND left.column2 = right.column2.
        Hide
        mprudhom Marc Prud'hommeaux added a comment - - edited

        I meant "inner" joined tables.

        Show
        mprudhom Marc Prud'hommeaux added a comment - - edited I meant "inner" joined tables.
        Hide
        julianhyde Julian Hyde added a comment -

        Marc Prud'hommeaux, Thanks for changing the summary. But it still doesn't make sense, since the query contains neither WITH nor OVER. Can you clarify please?

        Show
        julianhyde Julian Hyde added a comment - Marc Prud'hommeaux , Thanks for changing the summary. But it still doesn't make sense, since the query contains neither WITH nor OVER. Can you clarify please?
        Hide
        mprudhom Marc Prud'hommeaux added a comment -

        Seems to be an issue with the type of join. Inner throws the exception:

        SELECT T1."brand_name" FROM "foodmart"."product" AS T1 INNER JOIN "foodmart"."product_class" AS T2 ON T1."product_class_id" = T2."product_class_id" WHERE T1."brand_name" = 'King' OR T2."product_department" = 'Dairy';
        java.lang.AssertionError: =($1, 'King')
        

        But LEFT OUTER doesn't:

        SELECT T1."brand_name" FROM "foodmart"."product" AS T1 LEFT OUTER JOIN "foodmart"."product_class" AS T2 ON T1."product_class_id" = T2."product_class_id" WHERE T1."brand_name" = 'King' OR T2."product_department" = 'Dairy';
        +--------------+
        |  brand_name  |
        +--------------+
        | King         |
        | Club         |
        | Club         |
        ...
        
        Show
        mprudhom Marc Prud'hommeaux added a comment - Seems to be an issue with the type of join. Inner throws the exception: SELECT T1."brand_name" FROM "foodmart"."product" AS T1 INNER JOIN "foodmart"."product_class" AS T2 ON T1."product_class_id" = T2."product_class_id" WHERE T1."brand_name" = 'King' OR T2."product_department" = 'Dairy'; java.lang.AssertionError: =($1, 'King') But LEFT OUTER doesn't: SELECT T1."brand_name" FROM "foodmart"."product" AS T1 LEFT OUTER JOIN "foodmart"."product_class" AS T2 ON T1."product_class_id" = T2."product_class_id" WHERE T1."brand_name" = 'King' OR T2."product_department" = 'Dairy'; +--------------+ | brand_name | +--------------+ | King | | Club | | Club | ...

          People

          • Assignee:
            julianhyde Julian Hyde
            Reporter:
            mprudhom Marc Prud'hommeaux
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development