Joshua James Maurice created CALCITE-5204:
---------------------------------------------
Summary: ColumnMetaData.Rep is incorrect for ArrayAccessor for
nested arrays
Key: CALCITE-5204
URL: https://issues.apache.org/jira/browse/CALCITE-5204
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.30.0
Reporter: Joshua James Maurice
Nested arrays don't work. ResultSet.getObject() throws because the
ArrayAccessor uses the wrong Rep type for the nested array use case. The cause
is that the Rep object is incorrect (or the code uses the wrong Rep object).
For one of the ArrayAccessors, the Rep object that it uses is PRIMITIVE_INT
instead of MULTISET.
Proposed fix: I am not certain that this is the correct fix, but my own
informal testing shows that it fixes the problem for me.
./core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
diff --git
a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
index d73f7fb..7ad3c15 100644
--- a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
+++ b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
@@ -786,7 +786,7 @@ private static ColumnMetaData metaData(JavaTypeFactory
typeFactory, int ordinal,
if (type.getComponentType() != null) {
final ColumnMetaData.AvaticaType componentType =
avaticaType(typeFactory, type.getComponentType(), null);
- final Type clazz = typeFactory.getJavaClass(type.getComponentType());
+ final Type clazz = typeFactory.getJavaClass(type);
final ColumnMetaData.Rep rep = ColumnMetaData.Rep.of(clazz);
assert rep != null;
return ColumnMetaData.array(componentType, typeName, rep);
--
This message was sent by Atlassian Jira
(v8.20.10#820010)