[ https://issues.apache.org/jira/browse/CALCITE-3162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Josh Elser updated CALCITE-3162: -------------------------------- Fix Version/s: avatica-1.21.0 (was: avatica-1.20.0) > Reading Arrays from Calcite through JdbcMeta generates AvaticaSqlException > -------------------------------------------------------------------------- > > Key: CALCITE-3162 > URL: https://issues.apache.org/jira/browse/CALCITE-3162 > Project: Calcite > Issue Type: Bug > Components: avatica > Affects Versions: avatica-1.15.0 > Environment: Tested on OS X 10.14.5, OpenJDK Runtime Environment > Zulu11.29+3-CA (build 11.0.2+7-LTS) > Issue occurs with both Apache Calcite 1.19.0 & 1.20.0. > Reporter: Ralph Gasser > Priority: Major > Labels: pull-request-available > Fix For: avatica-1.21.0 > > Time Spent: 10m > Remaining Estimate: 0h > > I'm trying to use _Apache Calcite_ as SQL Parser and Query Planner for a > custom data store and in addition, I'm using _Apache Avatica_ to expose the > entire functionality via JDBC for an arbitrary, potential remote client to > use. > We're working a lot with Array types, since we're using our backend to store > high-dimensional vectors. However, it seems that currently, Apache Avatica > has troubles handling such arrays. > Take the following test-case that reproduces the problem pretty well. > {code:java} > @Test > public void test() throws Exception { > HttpServer server = null; > try { > Class.forName("org.apache.calcite.jdbc.Driver"); > server = new HttpServer.Builder<>() > .withHandler(new LocalService(new JdbcMeta("jdbc:calcite:", > newProperties())),Driver.Serialization.PROTOBUF) > .withPort(1234) > .build(); > server.start(); > final Connection connection = > DriverManager.getConnection("jdbc:avatica:remote:serialization=protobuf;url=http://127.0.0.1:1234"); > final Statement stmt = connection.createStatement(); > final ResultSet resultSet = stmt.executeQuery("select ARRAY[1.0, 1.0, > 3.0, 2.0]"); > resultSet.next(); > resultSet.getArray(1); > } catch (Exception e) { > System.out.println(e.getMessage()); > } finally { > if (server != null) { > server.stop(); > } > } > } > {code} > Executing the statement will throw an AvaticaSqlException: > {code:java} > org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Error > while executing SQL "select ARRAY[1.0, 1.0, 3.0, 2.0]": Remote driver error: > RuntimeException: java.sql.SQLException: invalid column ordinal: 2 -> > SQLException: invalid column ordinal: 2 > {code} > The culprit seems to be the _org.apache.calcite.avatica.jdbc.JdbcResultSet_ > class. More specifically, the _JdbcResultSet#extractUsingResultSet()_ method. > I am actually testing a potential fix but first I wanted to make sure, that > there is nothing wrong with the way I'm using the two components. -- This message was sent by Atlassian Jira (v8.20.1#820001)