You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Janislav Jankov (JIRA)" <ji...@apache.org> on 2018/01/04 01:55:00 UTC
[jira] [Created] (CALCITE-2117) IllegalStateException when
accessing data with type MAP ARRAY
Janislav Jankov created CALCITE-2117:
----------------------------------------
Summary: IllegalStateException when accessing data with type MAP ARRAY
Key: CALCITE-2117
URL: https://issues.apache.org/jira/browse/CALCITE-2117
Project: Calcite
Issue Type: Bug
Components: avatica
Affects Versions: 1.14.0
Reporter: Janislav Jankov
Here is a simple test case to demonstrate the issue:
{code}
@Test
public void testArrayOfMaps() throws Throwable {
Class.forName("org.apache.calcite.jdbc.Driver");
try (Connection connection = DriverManager.getConnection("jdbc:calcite:");
Statement statement = connection.createStatement()) {
String sql = "select ARRAY[1, 2], ARRAY[MAP['key', 'value']]";
ResultSet resultSet = statement.executeQuery(sql);
resultSet.next();
Array a1 = resultSet.getArray(1);
Assert.assertArrayEquals(new int[] {1, 2}, (int[]) a1.getArray());
resultSet.getArray(2);
}
}
{code}
Accessing the second field with {{resultSet.getArray(2)}} or {{resultSet.getObject(2)}} throws the following exception:
{code}
java.lang.IllegalStateException: Unhandled ARRAY component type: OBJECT, id: 1111
at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.convertValue(AbstractCursor.java:1336)
at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getObject(AbstractCursor.java:1289)
at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getArray(AbstractCursor.java:1342)
at org.apache.calcite.avatica.AvaticaResultSet.getArray(AvaticaResultSet.java:731)
{code}
Looking at the AbstractCursor.ArrayAccessor::convertValue the Types.OTHER (which MAP resolves to) is not explicitly covered. Seems like it should be in the same bucket as STRUCT and JAVA_OBJECT
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)