This is an automated email from the ASF dual-hosted git repository.

rubenada pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new a8e88d16f7 [CALCITE-6393] Byte code of SqlFunctions is invalid
a8e88d16f7 is described below

commit a8e88d16f7bb6e2ba9b89633e30086f2ccadf518
Author: Ruben Quesada Lopez <[email protected]>
AuthorDate: Fri Jul 10 13:20:23 2026 +0100

    [CALCITE-6393] Byte code of SqlFunctions is invalid
---
 .../org/apache/calcite/runtime/SqlFunctions.java   | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java 
b/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
index 789fb9d6c7..5dfad1da34 100644
--- a/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
+++ b/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
@@ -210,18 +210,24 @@ public class SqlFunctions {
 
   @SuppressWarnings("unused")
   private static final Function1<Object[], Enumerable<@Nullable Object[]>> 
ARRAY_CARTESIAN_PRODUCT =
-      lists -> {
-        final List<Enumerator<@Nullable Object>> enumerators = new 
ArrayList<>();
-        for (Object list : lists) {
-          enumerators.add(Linq4j.enumerator((List) list));
-        }
-        final Enumerator<List<@Nullable Object>> product = 
Linq4j.product(enumerators);
-        return new AbstractEnumerable<@Nullable Object[]>() {
-          @Override public Enumerator<@Nullable Object[]> enumerator() {
-            return Linq4j.transform(product, List::toArray);
-          }
-        };
-      };
+      SqlFunctions::arrayCartesianProduct;
+
+  /**
+   * WARNING: keep this logic as a static method. JDK 8 and 11 produce invalid 
bytecode when
+   * checkerframework annotations are used on static lambdas. See CALCITE-6393.
+   */
+  private static Enumerable<@Nullable Object[]> arrayCartesianProduct(Object[] 
lists) {
+    final List<Enumerator<@Nullable Object>> enumerators = new ArrayList<>();
+    for (Object list : lists) {
+      enumerators.add(Linq4j.enumerator((List) list));
+    }
+    final Enumerator<List<@Nullable Object>> product = 
Linq4j.product(enumerators);
+    return new AbstractEnumerable<@Nullable Object[]>() {
+      @Override public Enumerator<@Nullable Object[]> enumerator() {
+        return Linq4j.transform(product, List::toArray);
+      }
+    };
+  }
 
   /** Holds, for each thread, a map from sequence name to sequence current
    * value.

Reply via email to