You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jungtaek Lim (JIRA)" <ji...@apache.org> on 2016/09/30 00:12:20 UTC

[jira] [Commented] (CALCITE-1386) ITEM operator ignores the value type of the collection, assigns to Object variable

    [ https://issues.apache.org/jira/browse/CALCITE-1386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15534492#comment-15534492 ] 

Jungtaek Lim commented on CALCITE-1386:
---------------------------------------

[~julianhyde] Thanks for reviewing and merging!

> ITEM operator ignores the value type of the collection, assigns to Object variable
> ----------------------------------------------------------------------------------
>
>                 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: Jungtaek Lim
>             Fix For: 1.10.0
>
>
> 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.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))
> {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)