asolimando commented on a change in pull request #138:
URL: https://github.com/apache/calcite-avatica/pull/138#discussion_r602442643
##########
File path: core/src/main/java/org/apache/calcite/avatica/Meta.java
##########
@@ -685,7 +686,14 @@ public static CursorFactory deduce(List<ColumnMetaData>
columns,
if (List.class.isAssignableFrom(resultClazz)) {
return LIST;
}
- return record(resultClazz);
+ // columns for MetaImpl internal classes do not match field names,
"record" would fail
+ // can be removed once CALCITE-2489 is merged in Calcite
+ if
(resultClazz.getName().startsWith("org.apache.calcite.avatica.MetaImpl")
+ && !resultClazz.getName().endsWith("MetaTable")) {
+ return ARRAY;
+ }
Review comment:
I was not sure if such a "breaking change" was acceptable, in that case
I agree we can let Calcite adapt to the change. This allows us to avoid the
shading issue @rubenada mentions, thanks for the suggestion btw.
For `history.md` a note along these lines could work?
> `Meta#deduce(List<ColumnMetaData> columns, Class resultClazz)` now derives
the order of the fields from the list of provided column metadata `columns`
when generating a record from the given Java class `resultClazz`, instead of
relying on the field order provided by `Object#getFields()`, which is a
JVM-dependent feature.
`history.md` seems to be updated during the release itself by combining the
list of commits and associated comments. I don't know what's the usual way for
adding such a note, maybe it can be part of the commit message itself?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]