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



##########
File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
##########
@@ -2517,6 +2517,18 @@ public static Object item(Object object, Object index) {
     if (object instanceof List && index instanceof Number) {
       return arrayItem((List) object, ((Number) index).intValue());
     }
+    if (index instanceof Number) {

Review comment:
       Yes, you are right, in the current implementation I have favoured 
consistency with ARRAY (just above) which has `<INTEGER>` as index signature, 
but nonetheless accepts any number and converts it to an integer.
   
   In case we want to follow strictly the signature and just support INTEGER, I 
propose we do the same for ARRAY (i.e., we test `index instanceof Integer`), so 
we don't have surprising effects depending on the field data type.
   
   What do you think?




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


Reply via email to