danny0405 commented on a change in pull request #94: [CALCITE-2939] NPE when 
executeBatch array type.
URL: https://github.com/apache/calcite-avatica/pull/94#discussion_r274869329
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java
 ##########
 @@ -359,6 +359,9 @@ private static Object serialToJdbc(ColumnMetaData.Rep 
type, ColumnMetaData.Rep c
           copy.add(serialToJdbc(componentRep, null, o, calendar));
         }
       }
+      if (componentRep == null && list.size() > 0) {
+        componentRep = ((TypedValue) list.get(0)).type;
+      }
 
 Review comment:
   The document already say that the componentType in TypedValue is a non-null 
value [1], the only way is that when the nested parse in [2], which is a null 
we passed in initiatively.  For null i think it is reasonable cause we do not 
know what the value component type yet. The code you patched is reasonable if 
we finally got the list element type.
   
   [1] 
https://github.com/apache/calcite-avatica/blob/63bab44362c808a8f4981e5d5f5af7d942982f3b/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java#L165
   [2] 
https://github.com/apache/calcite-avatica/blob/63bab44362c808a8f4981e5d5f5af7d942982f3b/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java#L359

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


With regards,
Apache Git Services

Reply via email to