You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/11/16 16:05:25 UTC

[GitHub] [calcite] vlsi commented on a change in pull request #2230: [CALCITE-4354] ITEM operator does not support synthetic struct type

vlsi commented on a change in pull request #2230:
URL: https://github.com/apache/calcite/pull/2230#discussion_r524381956



##########
File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
##########
@@ -2956,7 +2963,12 @@ public static Object structAccess(Object structObject, int index, String fieldNa
     } else {
       Class<?> beanClass = structObject.getClass();
       try {
-        Field structField = beanClass.getDeclaredField(fieldName);
+        Field structField;
+        if (fieldName == null) {
+          structField = beanClass.getDeclaredFields()[index];

Review comment:
       @asolimando , @zabetak , `getDeclaredFields()` is JVM-specific, and the order of the fields is unspecified :(
   
   The exception `RESOURCE.failedToAccessField(fieldName` below should have been updated to print `index` in case of failure.




----------------------------------------------------------------
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:
users@infra.apache.org