olivrlee commented on code in PR #3421:
URL: https://github.com/apache/calcite/pull/3421#discussion_r1332265823
##########
core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java:
##########
@@ -178,11 +205,16 @@ private <E> MetaResultSet createResultSet(Enumerable<E>
enumerable,
for (String name : names) {
final int index = fields.size();
final String fieldName = AvaticaUtils.toCamelCase(name);
- final Field field;
+ Field field;
try {
field = clazz.getField(fieldName);
} catch (NoSuchFieldException e) {
- throw new RuntimeException(e);
+ try {
+ // Check if subclass contains the desired field.
+ field = clazz.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e2) {
+ throw new RuntimeException(e2);
+ }
}
Review Comment:
I was testing on my subclasses and `getField()` returns the 10 fields of the
default `MetaTable` class attributes, and `getDeclaredField()` returns the
additional properties on my subclass.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]