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


##########
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:
   Removed in e8302d4. The field-reference tests (f4/f5/f6) catch a revert of 
this line, and the root cause is in a1d7732's commit message — the inline 
comment duplicated 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to