[
https://issues.apache.org/jira/browse/CALCITE-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14951082#comment-14951082
]
Julian Hyde commented on CALCITE-913:
-------------------------------------
You're welcome to snipe!
I suspect that the metadata will always be less than perfect (e.g. the provider
may say that the "employees" column is an ARRAY but may not say of what). And
[java.sql.Struct|http://docs.oracle.com/javase/7/docs/api/java/sql/Struct.html]
doesn't provide much metadata - no column names or types. So the serialization
should go by the types of objects it sees come back from the provider.
I think it's worth dealing with array, multiset and struct as one. In JSON or
protobuf, I think they would each be a list of values and a type flag (array,
multiset, struct) which would probably be a Rep value.
> Avatica: transport of array fields fails
> ----------------------------------------
>
> Key: CALCITE-913
> URL: https://issues.apache.org/jira/browse/CALCITE-913
> Project: Calcite
> Issue Type: Bug
> Components: avatica
> Reporter: Bruno Dumon
> Assignee: Josh Elser
>
> 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:
> {noformat}
> @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());
> }
> }
> {noformat}
> For example with json this gives the following error:
> {noformat}
> 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)
> ...
> {noformat}
> The above is with hsqldb's array implementation. With another one it went
> into infinite recursion.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)