Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1386

ITEM operator ignores the value type of the collection, assigns to Object variable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.0
    • Fix Version/s: 1.10.0
    • Component/s: core
    • Labels:
      None

      Description

      Suppose we're defining the following table:

      .field("ID", SqlTypeName.INTEGER)
      .field("MAPFIELD",
              typeFactory.createMapType(
                      typeFactory.createSqlType(SqlTypeName.VARCHAR),
                      typeFactory.createTypeWithNullability(
                              typeFactory.createSqlType(SqlTypeName.INTEGER), true)))
      .field("NESTEDMAPFIELD",
              typeFactory.createMapType(
                      typeFactory.createSqlType(SqlTypeName.VARCHAR),
                      typeFactory.createTypeWithNullability(
                              typeFactory.createMapType(
                                      typeFactory.createSqlType(SqlTypeName.VARCHAR),
                                      typeFactory.createTypeWithNullability(
                                              typeFactory.createSqlType(SqlTypeName.INTEGER), true))
                              , true)))
      .field("ARRAYFIELD", typeFactory.createArrayType(
              typeFactory.createTypeWithNullability(
                      typeFactory.createSqlType(SqlTypeName.INTEGER), true), -1L))
      

      and query like this:

      SELECT * FROM <TBL> WHERE MAPFIELD['a'] = 1
      

      When we evaluate that query, JaninoRexCompiler throws an Exception saying there's no SqlFunctions.eq(Object, int).

      I took a breakpoint on BinaryImplementor.implement() to see variables just before compiler finds SqlFunctions.eq().
      The type of expression is Object which is not generic, but seems like matching RexCall operand have value type information.
      (I mean type mismatch occurs.)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kabhwan Jungtaek Lim
                Reporter:
                kabhwan Jungtaek Lim
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: