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 2021/03/26 15:37:38 UTC

[GitHub] [calcite-avatica] zabetak commented on a change in pull request #138: [CALCITE-2489] Order of fields in JavaTypeFactoryImpl#createStructTyp…

zabetak commented on a change in pull request #138:
URL: https://github.com/apache/calcite-avatica/pull/138#discussion_r602121108



##########
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 don't understand why Avatica depends on a calcite fix? Shouldn't be the other way around?

##########
File path: core/src/main/java/org/apache/calcite/avatica/Meta.java
##########
@@ -647,12 +648,13 @@ public static CursorFactory create(@JsonProperty("style") Style style,
     public static final CursorFactory LIST =
         new CursorFactory(Style.LIST, null, null, null);
 
-    public static CursorFactory record(Class resultClazz) {
-      return new CursorFactory(Style.RECORD, resultClazz, null, null);

Review comment:
       Maybe we should keep the method for a short while for backwards compatibility. WDYT?

##########
File path: core/src/main/java/org/apache/calcite/avatica/MetaImpl.java
##########
@@ -139,15 +134,8 @@ protected Getter createGetter(int ordinal) {
       return list;
     case RECORD:
     case RECORD_PROJECTION:

Review comment:
       With the current PR the behavior of `RECORD` and `RECORD_PROJECTION` seems to be exactly the same. Do we need to keep both?




-- 
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