snuyanzin commented on code in PR #28931:
URL: https://github.com/apache/flink/pull/28931#discussion_r3734055617


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/scalar/EltFunction.java:
##########
@@ -40,6 +40,9 @@ public EltFunction(SpecializedContext context) {
         if (idx < 1 || idx > exprs.length) {
             return null;
         }
-        return exprs[(int) index - 1];
+        // Narrow the already-unboxed long instead of casting the Number 
reference.
+        // Casting `index` (java.lang.Number) to int compiles to a checkcast 
to Integer
+        // followed by unboxing, which throws ClassCastException for 
Byte/Short/Long.

Review Comment:
   why do we need it if we have tests?



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

Reply via email to