Jungtaek Lim created CALCITE-1386:
-------------------------------------

             Summary: ITEM operator seems to ignore the value type of 
collection and assign the value to Object
                 Key: CALCITE-1386
                 URL: https://issues.apache.org/jira/browse/CALCITE-1386
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.9.0
            Reporter: Jungtaek Lim
            Assignee: Julian Hyde


Suppose we're defining the following table:

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

and query like this:

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

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.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to