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

MongoDB: Invalid ARRAY conversion

    XMLWordPrintableJSON

Details

    Description

      When using the MongoDB adapter, the following conversion does not work as expected:

      cast(_MAP['arr'] as VARCHAR ARRAY)
      

      This throws the following exception:

      Caused by: java.lang.NullPointerException: componentType of ITEM($0, 'arr')
          at java.base/java.util.Objects.requireNonNull(Objects.java:347)
          at org.apache.calcite.sql2rel.StandardConvertletTable.convertCast(StandardConvertletTable.java:603)
          at org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:59)
          at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:5547)
          at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4711)
          at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
          at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:5360)
          at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:4524)
          at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:756)
          at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:677)
          at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3741)
          at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:597)
          at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:257)
          at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:220)
          at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:651)
          at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:517)
          at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:487)
          at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:236)
          at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623)
          at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:677)
          at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
          ... 67 more
      

      Attachments

        Issue Links

          Activity

            People

              tnieradzik Tim Nieradzik
              tnieradzik Tim Nieradzik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m