Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-5404

SQL temp table join does not work with typed arrays

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0
    • None
    • sql
    • None

    Description

      Reproducer:

              Ignite ignite = Ignition.start();
      
              QueryEntity qe = new QueryEntity("java.lang.Integer", "java.lang.String");
              Collection<QueryEntity> qes = new ArrayList<QueryEntity>();
              qes.add(qe);
              CacheConfiguration ccfg = new CacheConfiguration("foo").setQueryEntities(qes);
              IgniteCache<Integer, String> cache = ignite.createCache(ccfg);
      
              cache.put(1, "1");
              cache.put(2, "2");
      
              // Works
              // Object[] queryArgs = {new Object[]{1}};
      
              // Does not work
              Object[] queryArgs = {new int[]{1}};
      
              SqlFieldsQuery query = new SqlFieldsQuery(
                      "select _val from string join table (id bigint = ?) i on _key = id")
                      .setArgs(queryArgs);
      
              List<List<?>> all = cache.query(query).getAll();
      
              for (List l : all) {
                  System.out.println(l.get(0));
              }
      

      Exception:

      SEVERE: Failed to execute local query.
      class org.apache.ignite.IgniteCheckedException: Failed to execute SQL query.
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:1226)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:1278)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:1253)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest0(GridMapQueryExecutor.java:610)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest(GridMapQueryExecutor.java:478)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onMessage(GridMapQueryExecutor.java:206)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:149)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:147)
      	at org.apache.ignite.internal.util.lang.IgniteInClosure2X.apply(IgniteInClosure2X.java:38)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.send(IgniteH2Indexing.java:2426)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.send(GridReduceQueryExecutor.java:1308)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:729)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$8.iterator(IgniteH2Indexing.java:1493)
      	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:94)
      	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:113)
      	at TestLocalJoin.main(TestLocalJoin.java:25)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
      Caused by: org.h2.jdbc.JdbcSQLException: Data conversion error converting "'[I@6bea52d4' (ID BIGINT)"; SQL statement:
      SELECT
      __Z0._VAL __C0_0
      FROM TABLE(ID BIGINT=?1) I__Z1 
       INNER JOIN "foo".STRING __Z0 
       ON TRUE
      WHERE __Z0._KEY = I__Z1.ID [22018-195]
      	at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
      	at org.h2.message.DbException.get(DbException.java:179)
      	at org.h2.message.DbException.get(DbException.java:155)
      	at org.h2.table.Column.convert(Column.java:172)
      	at org.h2.expression.TableFunction.getTable(TableFunction.java:118)
      	at org.h2.expression.TableFunction.getValue(TableFunction.java:41)
      	at org.h2.table.FunctionTable.getValueResultSet(FunctionTable.java:218)
      	at org.h2.table.FunctionTable.getResult(FunctionTable.java:189)
      	at org.h2.index.FunctionIndex.find(FunctionIndex.java:50)
      	at org.h2.index.BaseIndex.find(BaseIndex.java:128)
      	at org.h2.index.IndexCursor.find(IndexCursor.java:169)
      	at org.h2.table.TableFilter.next(TableFilter.java:468)
      	at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1452)
      	at org.h2.result.LazyResult.hasNext(LazyResult.java:79)
      	at org.h2.result.LazyResult.next(LazyResult.java:59)
      	at org.h2.command.dml.Select.queryFlat(Select.java:519)
      	at org.h2.command.dml.Select.queryWithoutCache(Select.java:625)
      	at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:114)
      	at org.h2.command.dml.Query.query(Query.java:352)
      	at org.h2.command.dml.Query.query(Query.java:333)
      	at org.h2.command.CommandContainer.query(CommandContainer.java:113)
      	at org.h2.command.Command.executeQuery(Command.java:201)
      	at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:111)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:1219)
      	... 20 more
      
      Jun 05, 2017 12:50:12 PM org.apache.ignite.logger.java.JavaLogger error
      SEVERE: Failed to run map query on local node.
      class org.apache.ignite.IgniteCheckedException: Failed to execute SQL query.
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:1226)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:1278)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:1253)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest0(GridMapQueryExecutor.java:610)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest(GridMapQueryExecutor.java:478)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onMessage(GridMapQueryExecutor.java:206)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:149)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:147)
      	at org.apache.ignite.internal.util.lang.IgniteInClosure2X.apply(IgniteInClosure2X.java:38)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.send(IgniteH2Indexing.java:2426)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.send(GridReduceQueryExecutor.java:1308)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:729)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$8.iterator(IgniteH2Indexing.java:1493)
      	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:94)
      	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:113)
      	at TestLocalJoin.main(TestLocalJoin.java:25)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
      Caused by: org.h2.jdbc.JdbcSQLException: Data conversion error converting "'[I@6bea52d4' (ID BIGINT)"; SQL statement:
      SELECT
      __Z0._VAL __C0_0
      FROM TABLE(ID BIGINT=?1) I__Z1 
       INNER JOIN "foo".STRING __Z0 
       ON TRUE
      WHERE __Z0._KEY = I__Z1.ID [22018-195]
      	at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
      	at org.h2.message.DbException.get(DbException.java:179)
      	at org.h2.message.DbException.get(DbException.java:155)
      	at org.h2.table.Column.convert(Column.java:172)
      	at org.h2.expression.TableFunction.getTable(TableFunction.java:118)
      	at org.h2.expression.TableFunction.getValue(TableFunction.java:41)
      	at org.h2.table.FunctionTable.getValueResultSet(FunctionTable.java:218)
      	at org.h2.table.FunctionTable.getResult(FunctionTable.java:189)
      	at org.h2.index.FunctionIndex.find(FunctionIndex.java:50)
      	at org.h2.index.BaseIndex.find(BaseIndex.java:128)
      	at org.h2.index.IndexCursor.find(IndexCursor.java:169)
      	at org.h2.table.TableFilter.next(TableFilter.java:468)
      	at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1452)
      	at org.h2.result.LazyResult.hasNext(LazyResult.java:79)
      	at org.h2.result.LazyResult.next(LazyResult.java:59)
      	at org.h2.command.dml.Select.queryFlat(Select.java:519)
      	at org.h2.command.dml.Select.queryWithoutCache(Select.java:625)
      	at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:114)
      	at org.h2.command.dml.Query.query(Query.java:352)
      	at org.h2.command.dml.Query.query(Query.java:333)
      	at org.h2.command.CommandContainer.query(CommandContainer.java:113)
      	at org.h2.command.Command.executeQuery(Command.java:201)
      	at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:111)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:1219)
      	... 20 more
      
      Exception in thread "main" javax.cache.CacheException: Failed to run map query remotely.
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:757)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$8.iterator(IgniteH2Indexing.java:1493)
      	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:94)
      	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:113)
      	at TestLocalJoin.main(TestLocalJoin.java:25)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
      Caused by: javax.cache.CacheException: Failed to execute map query on the node: 96b81b15-ef85-4321-b318-bb3611886c5f, class org.apache.ignite.IgniteCheckedException:Failed to execute SQL query.
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.fail(GridReduceQueryExecutor.java:263)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.onFail(GridReduceQueryExecutor.java:253)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.onMessage(GridReduceQueryExecutor.java:234)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.sendError(GridMapQueryExecutor.java:699)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest0(GridMapQueryExecutor.java:672)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest(GridMapQueryExecutor.java:478)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onMessage(GridMapQueryExecutor.java:206)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:149)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:147)
      	at org.apache.ignite.internal.util.lang.IgniteInClosure2X.apply(IgniteInClosure2X.java:38)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.send(IgniteH2Indexing.java:2426)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.send(GridReduceQueryExecutor.java:1308)
      	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:729)
      	... 9 more
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ptupitsyn Pavel Tupitsyn
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: