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

Avatica: transport of array fields fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.5.0
    • avatica
    • None

    Description

      When using the avatica remote driver, reading a resultset which contains a non-null ARRAY-type field fails (both in json & protobuf).

      This can be reproduced by adding the following test to RemoteMetaTest.java:

        @Test public void testArrays() throws SQLException {
          try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
               Statement stmt = conn.createStatement()) {
      
            ResultSet resultSet =
                stmt.executeQuery("select * from (values ('a', array['b', 'c']));");
      
            assertTrue(resultSet.next());
          }
        }
      

      For example with json this gives the following error:

      2015-10-07 16:09:08.406:WARN:oejs.HttpChannel:qtp1931444790-20: /
      java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Conflicting getter definitions for property "updateCount": org.hsqldb.result.Result#isUpdateCount(0 params) vs org.hsqldb.result.Result#getUpdateCount(0 params) (through reference chain: org.apache.calcite.avatica.remote.ExecuteResponse["results"]->java.util.ArrayList[0]->org.apache.calcite.avatica.remote.ResultSetResponse["firstFrame"]->org.apache.calcite.avatica.Frame["rows"]->java.util.ArrayList[0]->org.hsqldb.jdbc.JDBCArray["resultSet"]->org.hsqldb.jdbc.JDBCResultSet["result"])
      	at org.apache.calcite.avatica.remote.JsonHandler.handle(JsonHandler.java:61)
      	at org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:46)
      	at org.apache.calcite.avatica.server.AvaticaHandler.handle(AvaticaHandler.java:66)
      	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:497)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: 
      com.fasterxml.jackson.databind.JsonMappingException: Conflicting getter definitions for property "updateCount": org.hsqldb.result.Result#isUpdateCount(0 params) vs org.hsqldb.result.Result#getUpdateCount(0 params) (through reference chain: org.apache.calcite.avatica.remote.ExecuteResponse["results"]->java.util.ArrayList[0]->org.apache.calcite.avatica.remote.ResultSetResponse["firstFrame"]->org.apache.calcite.avatica.Frame["rows"]->java.util.ArrayList[0]->org.hsqldb.jdbc.JDBCArray["resultSet"]->org.hsqldb.jdbc.JDBCResultSet["result"])
      	at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:897)
      	at com.fasterxml.jackson.databind.SerializerProvider.findValueSerializer(SerializerProvider.java:429)
      ...
      

      The above is with hsqldb's array implementation. With another one it went into infinite recursion.

      Attachments

        Issue Links

          Activity

            People

              elserj Josh Elser
              bruno Bruno Dumon
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: