You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Thomas Rebele (Jira)" <ji...@apache.org> on 2026/07/10 11:13:00 UTC

[jira] [Commented] (CALCITE-6393) Byte code of SqlFunctions is invalid

    [ https://issues.apache.org/jira/browse/CALCITE-6393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095258#comment-18095258 ] 

Thomas Rebele commented on CALCITE-6393:
----------------------------------------

This issue was also encountered by a [PR|https://github.com/apache/hive/pull/6523] for HIVE-29641. I was able to reproduce the invalid bytecode of SqlFunctions when compiling Calcite with JDK8. Compiling Calcite with JDK17 or JDK21 avoids the problem (at least ASM does not complain).

I've looked at the disassembly, {{{}javap -v -c -p SqlFunctions.class{}}}. In the block starting with {{static {};}} (line 29096 in the output of the javap command of JDK8), there are the annotations of the checkerframework:
{code:java}
      RuntimeVisibleTypeAnnotations:
        0: #1056(): LOCAL_VARIABLE, {start_pc=8, length=55, index=1}, location=[TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)]
          org.checkerframework.checker.nullness.qual.Nullable
        1: #1056(): LOCAL_VARIABLE, {start_pc=54, length=9, index=2}, location=[TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)]
          org.checkerframework.checker.nullness.qual.Nullable
{code}
This block is missing when SqlFunctions.class has been generated by JDK17 or JDK21.

I've rebased Stamatis' PR with some modifications: [https://github.com/apache/calcite/pull/5090]. Unfortunately the check makes the build (legitimately!) fail for JDK8 and JDK11. How about disabling the build for these JDK versions as long as they produce invalid bytecode?

> Byte code of SqlFunctions is invalid
> ------------------------------------
>
>                 Key: CALCITE-6393
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6393
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.36.0
>            Reporter: Sergey Nuyanzin
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: pull-request-available
>
> The issue is a result of testing of Apache Calcite 1.37.0 rc 4 in this thread [1]
> There is test project andprocedure provided by [~MasseGuillaume] [2] (see also original thread where this was first discussed [3])
> it shows that since Calcite 1.36.0 it starts failing as 
> {noformat}
>     java.lang.ArrayIndexOutOfBoundsException: Index 65536 out of bounds for length 297
>         at org.objectweb.asm.ClassReader.readLabel(ClassReader.java:2695)
>         at org.objectweb.asm.ClassReader.createLabel(ClassReader.java:2711)
>         at org.objectweb.asm.ClassReader.readTypeAnnotations(ClassReader.java:2777)
>         at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1929)
>         at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1515)
>         at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
> {noformat}
> Also  since Calcite 1.27.0 it starts failing as 
> {noformat}
>     java.lang.IllegalArgumentException: Invalid end label (must be visited first)
>         at org.objectweb.asm.util.CheckMethodAdapter.checkLabel(CheckMethodAdapter.java:1453)
>         at org.objectweb.asm.util.CheckMethodAdapter.visitLocalVariableAnnotation(CheckMethodAdapter.java:996)
>         at org.objectweb.asm.MethodVisitor.visitLocalVariableAnnotation(MethodVisitor.java:757)
>         at org.objectweb.asm.commons.MethodRemapper.visitLocalVariableAnnotation(MethodRemapper.java:257)
>         at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2614)
>         at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1515)
> {noformat}
> [1] https://lists.apache.org/thread/n6cs1l86mt6fc5q8pcxr97czs3p6w65f
> [2] https://github.com/MasseGuillaume/asm-remapper-bug
> [3] https://lists.apache.org/thread/o736wz4qnr4l285bj5gv073cy0qll9t0



--
This message was sent by Atlassian Jira
(v8.20.10#820010)