You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ralph Gasser (JIRA)" <ji...@apache.org> on 2019/07/01 09:50:00 UTC
[jira] [Updated] (CALCITE-3162) Reading Arrays from Calcite using
Avatica generates error
[ https://issues.apache.org/jira/browse/CALCITE-3162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Gasser updated CALCITE-3162:
----------------------------------
Description:
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.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.
was:
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.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.
> Reading Arrays from Calcite using Avatica generates error
> ---------------------------------------------------------
>
> 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
>
> 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.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
(v7.6.3#76005)