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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.10.0
    • core
    • 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

              kabhwan Jungtaek Lim
              kabhwan Jungtaek Lim
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: