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

2024-04-30 Thread Julian Hyde (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-6393:
-
Affects Version/s: 1.36.0

> 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
>Priority: Major
>
> 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)


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

2024-04-30 Thread Jira


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

Guillaume Massé commented on CALCITE-6393:
--

I can work on the automated test, I just need to take some time to learn about 
gradle, but the idea is the following:

after the jar task runs, execute the validation code with the jar path as an 
argument. I'm not too sure how to do this in gradle.

 

The validation procedure is something like:

Create a java.util.jar.JarFile from the jar,

walk the jar file to run the validation in

[https://github.com/MasseGuillaume/asm-remapper-bug/blob/852e4cd246d278db8acf5e997a54619bc4f85fc7/app/src/test/java/remapper/bug/RemapperTest.java#L60-L80]

for every classfile

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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)


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

2024-04-30 Thread Sergey Nuyanzin (Jira)


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

Sergey Nuyanzin edited comment on CALCITE-6393 at 4/30/24 7:13 PM:
---

Thanks for the info [~MasseGuillaume]
btw, do you happen to have bytecode check test which I assume you usually use 
and which could be integrated into Calcite gradle as well?

I'm asking since probably I found the root cause for all the issues here.

It seems {{Checkerframework}} generates different bytecode for cases where 
annotations are used in second nested parameterized type.

e.g. here {{@Nullable}} is used for first nested type
{code:java}
  private static final ThreadLocal<@Nullable Map> 
THREAD_SEQUENCES =
  ThreadLocal.withInitial(HashMap::new);
{code}
everything is ok

However with second nested level like here
{code:java}
  private static final Function1> 
ARRAY_CARTESIAN_PRODUCT =
  lists -> {
final List> enumerators = new 
ArrayList<>();
for (Object list : lists) {
  enumerators.add(Linq4j.enumerator((List) list));
}
final Enumerator> product = 
Linq4j.product(enumerators);
return new AbstractEnumerable<@Nullable Object[]>() {
  @Override public Enumerator<@Nullable Object[]> enumerator() {
return Linq4j.transform(product, List::toArray);
  }
};
  };
{code}
there is an issue.

It looks like this const {{ARRAY_CARTESIAN_PRODUCT}} is not used anywhere and 
private. So I've just removed it and all the errors are disappeared.

So it seems the {{assert}} was just a marker for accumulated error however not 
the root cause.
At the same side it would be great to have test integrated into build system to 
have it always automatically checked


was (Author: sergey nuyanzin):
Thanks for the info [~MasseGuillaume]
btw, do you happen to have bytecode check test which I assume you usually use 
and which could be integrated into Calcite gradle as well?

I'm asking since probably I found the root cause for all the issues here.

It seems {{Checkerframework}} generates different bytecode for cases where 
annotations are used in second nested parameterized type.

e.g. here {{@Nullable}} is used for first nested type
{code:java}
  private static final ThreadLocal<@Nullable Map> 
THREAD_SEQUENCES =
  ThreadLocal.withInitial(HashMap::new);
{code}
everything is ok

However with second nested level like here
{code:java}
  private static final Function1> 
ARRAY_CARTESIAN_PRODUCT =
  lists -> {
final List> enumerators = new 
ArrayList<>();
for (Object list : lists) {
  enumerators.add(Linq4j.enumerator((List) list));
}
final Enumerator> product = 
Linq4j.product(enumerators);
return new AbstractEnumerable<@Nullable Object[]>() {
  @Override public Enumerator<@Nullable Object[]> enumerator() {
return Linq4j.transform(product, List::toArray);
  }
};
  };
{code}
there is an issue.

It looks like this const {{ARRAY_CARTESIAN_PRODUCT}} is not used anywhere and 
private. So I've just removed it and all the errors are disappeared.

at the same side it would be great to have test integrated into build system to 
have it always automatically checked

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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 
> 

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

2024-04-30 Thread Sergey Nuyanzin (Jira)


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

Sergey Nuyanzin commented on CALCITE-6393:
--

Thanks for the info [~MasseGuillaume]
btw, do you happen to have bytecode check test which I assume you usually use 
and which could be integrated into Calcite gradle as well?

I'm asking since probably I found the root cause for all the issues here.

It seems {{Checkerframework}} generates different bytecode for cases where 
annotations are used in second nested parameterized type.

e.g. here {{@Nullable}} is used for first nested type
{code:java}
  private static final ThreadLocal<@Nullable Map> 
THREAD_SEQUENCES =
  ThreadLocal.withInitial(HashMap::new);
{code}
everything is ok

However with second nested level like here
{code:java}
  private static final Function1> 
ARRAY_CARTESIAN_PRODUCT =
  lists -> {
final List> enumerators = new 
ArrayList<>();
for (Object list : lists) {
  enumerators.add(Linq4j.enumerator((List) list));
}
final Enumerator> product = 
Linq4j.product(enumerators);
return new AbstractEnumerable<@Nullable Object[]>() {
  @Override public Enumerator<@Nullable Object[]> enumerator() {
return Linq4j.transform(product, List::toArray);
  }
};
  };
{code}
there is an issue.

It looks like this const {{ARRAY_CARTESIAN_PRODUCT}} is not used anywhere and 
private. So I've just removed it and all the errors are disappeared.

at the same side it would be great to have test integrated into build system to 
have it always automatically checked

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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)


[jira] [Commented] (CALCITE-6376) Selecting 6 columns with QUALIFY operation results in exception

2024-04-30 Thread Mihai Budiu (Jira)


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

Mihai Budiu commented on CALCITE-6376:
--

I have renamed this issue, the CTE does not seem to be important.
I will submit a more general fix.

> Selecting 6 columns with QUALIFY operation results in exception
> ---
>
> Key: CALCITE-6376
> URL: https://issues.apache.org/jira/browse/CALCITE-6376
> Project: Calcite
>  Issue Type: Bug
>Affects Versions: 1.36.0
>Reporter: Austin Richardson
>Assignee: ShenDa
>Priority: Major
>  Labels: pull-request-available
>
> Example query:
>  
> {code:java}
> WITH MyCTE AS (
> SELECT 
> column1,
> column2,
> column3,
> column4,
> column5,
> column6
> FROM (
> VALUES 
> ('value1', 10, 5.0, 'data1', 'info1', 'test1'),
> ('value2', 20, 4.0, 'data2', 'info2', 'test2'),
> ('value3', 30, 3.0, 'data3', 'info3', 'test3'),
> ('value4', 40, 2.0, 'data4', 'info4', 'test4'),
> ('value5', 50, 1.0, 'data5', 'info5', 'test5')
> ) AS t(column1, column2, column3, column4, column5, column6)
> )
> SELECT *
> FROM MyCTE
> QUALIFY RANK() OVER (ORDER BY column3) = 1{code}
>  
> And exception snippet:
>  
> {code:java}
> Caused by: java.lang.ClassCastException: class 
> org.apache.calcite.rex.RexInputRef cannot be cast to class 
> java.lang.Comparable (org.apache.calcite.rex.RexInputRef is in unnamed module 
> of loader org.springframework.boot.loader.LaunchedURLClassLoader @257f30f7; 
> java.lang.Comparable is in module java.base of loader 'bootstrap')
>   at 
> org.apache.calcite.runtime.FlatLists$ComparableListImpl.get(FlatLists.java:1319)
>   at 
> org.apache.calcite.runtime.FlatLists$ComparableListImpl.get(FlatLists.java:1309)
>   at 
> java.base/java.util.AbstractList$Itr.next(AbstractList.java:373){code}
>  
> Either removing one of the columns or the QUALIFY filter results in a 
> successful query.



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


[jira] [Updated] (CALCITE-6376) Selecting 6 columns with QUALIFY operation results in exception

2024-04-30 Thread Mihai Budiu (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mihai Budiu updated CALCITE-6376:
-
Summary: Selecting 6 columns with QUALIFY operation results in exception  
(was: Filtering CTE of at least 6 columns with QUALIFY operation results in 
exception)

> Selecting 6 columns with QUALIFY operation results in exception
> ---
>
> Key: CALCITE-6376
> URL: https://issues.apache.org/jira/browse/CALCITE-6376
> Project: Calcite
>  Issue Type: Bug
>Affects Versions: 1.36.0
>Reporter: Austin Richardson
>Assignee: ShenDa
>Priority: Major
>  Labels: pull-request-available
>
> Example query:
>  
> {code:java}
> WITH MyCTE AS (
> SELECT 
> column1,
> column2,
> column3,
> column4,
> column5,
> column6
> FROM (
> VALUES 
> ('value1', 10, 5.0, 'data1', 'info1', 'test1'),
> ('value2', 20, 4.0, 'data2', 'info2', 'test2'),
> ('value3', 30, 3.0, 'data3', 'info3', 'test3'),
> ('value4', 40, 2.0, 'data4', 'info4', 'test4'),
> ('value5', 50, 1.0, 'data5', 'info5', 'test5')
> ) AS t(column1, column2, column3, column4, column5, column6)
> )
> SELECT *
> FROM MyCTE
> QUALIFY RANK() OVER (ORDER BY column3) = 1{code}
>  
> And exception snippet:
>  
> {code:java}
> Caused by: java.lang.ClassCastException: class 
> org.apache.calcite.rex.RexInputRef cannot be cast to class 
> java.lang.Comparable (org.apache.calcite.rex.RexInputRef is in unnamed module 
> of loader org.springframework.boot.loader.LaunchedURLClassLoader @257f30f7; 
> java.lang.Comparable is in module java.base of loader 'bootstrap')
>   at 
> org.apache.calcite.runtime.FlatLists$ComparableListImpl.get(FlatLists.java:1319)
>   at 
> org.apache.calcite.runtime.FlatLists$ComparableListImpl.get(FlatLists.java:1309)
>   at 
> java.base/java.util.AbstractList$Itr.next(AbstractList.java:373){code}
>  
> Either removing one of the columns or the QUALIFY filter results in a 
> successful query.



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


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

2024-04-30 Thread Jira


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

Guillaume Massé edited comment on CALCITE-6393 at 4/30/24 6:24 PM:
---

We hava a fork of Calcite so we can build on jdk11 and get around the issue 
where SqlFunctions bytecode is invalid.

 

(we run self-hosted Github actions)

AMI image: ubuntu/images/hvm-ssd/ubuntu-lunar-23.04-amd64-server-20240117
{code:java}
- name: 'Set up JDK 11'
  uses: actions/setup-java@v2
  with:
java-version: 11
distribution: 'zulu' {code}
{code:java}
Downloading Java 11.0.22+7 (Zulu) from 
https://cdn.azul.com/zulu/bin/zulu11.70.15-ca-jdk11.0.22-linux_x64.tar.gz ... 
{code}
I'm not sure what's the root cause of all this, but it looks like bytecode 
generation is fragile and we should add a check after we run the jar task to 
make sure that every classfile is valid bytecode with asm.


was (Author: masseguillaume):
We hava a fork of Calcite so we can build on jdk11 and get around the issue 
where SqlFunctions bytecode is invalid.

- name: 'Set up JDK 11'
  uses: actions/setup-java@v2
  with:
java-version: 11
distribution: 'zulu'

Downloading Java 11.0.22+7 (Zulu) from 
https://cdn.azul.com/zulu/bin/zulu11.70.15-ca-jdk11.0.22-linux_x64.tar.gz ...

I'm not sure what's the root cause of all this, but it looks like bytecode 
generation is fragile and we should add a check after we run the jar task to 
make sure that every classfile is valid bytecode with asm.

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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)


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

2024-04-30 Thread Jira


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

Guillaume Massé commented on CALCITE-6393:
--

We hava a fork of Calcite so we can build on jdk11 and get around the issue 
where SqlFunctions bytecode is invalid.

- name: 'Set up JDK 11'
  uses: actions/setup-java@v2
  with:
java-version: 11
distribution: 'zulu'

Downloading Java 11.0.22+7 (Zulu) from 
https://cdn.azul.com/zulu/bin/zulu11.70.15-ca-jdk11.0.22-linux_x64.tar.gz ...

I'm not sure what's the root cause of all this, but it looks like bytecode 
generation is fragile and we should add a check after we run the jar task to 
make sure that every classfile is valid bytecode with asm.

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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)


[jira] [Commented] (CALCITE-4496) Measure columns ("SELECT ... AS MEASURE")

2024-04-30 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-4496:
--

An update on the development of this feature. Basic measures are working, and 
work continues in my 
[4496-measure|https://github.com/julianhyde/calcite/tree/4496-measure] branch; 
and I have forked the 
[5692-at|https://github.com/julianhyde/calcite/tree/5692-at] branch to work on 
the AT operator (CALCITE-5692).

> Measure columns ("SELECT ... AS MEASURE")
> -
>
> Key: CALCITE-4496
> URL: https://issues.apache.org/jira/browse/CALCITE-4496
> Project: Calcite
>  Issue Type: Bug
>Reporter: Julian Hyde
>Assignee: Julian Hyde
>Priority: Major
>
> In multi-dimensional languages such as MDX, DAX, Tableau, you can define 
> calculations in your models that can be re-evaluated in other dimensional 
> contexts. (The models are often called cubes, and the calculations are often 
> called measures.)
> In SQL, the model is a view (or a sub-query in the FROM clause) but the 
> columns are just values. Suppose you have a private {{Employees}} table, a 
> {{Departments}} view that rolls {{Employees}} up to department level and has 
> an {{averageSalary}} column. Now suppose you wish to roll up 
> {{averageSalary}} to the region level. The values that went into 
> {{averageSalary}} are not available to you, either directly or indirectly, so 
> the best you can do is to average-the-averages.
> In this proposed (and experimental) feature, you can define a special kind of 
> column - a measure - in the SELECT list of a view (or sub-query in a FROM 
> clause), and it remains a calculation. When a query uses a measure column, 
> the calculation is re-evaluated in the context of that query.
> To some extent, this breaches the "black box" property of SQL views. 
> Hitherto, a SQL view can be replaced with a table that has the same contents, 
> and all queries that use that view will return the same results. That 
> property no longer holds. But the view remains a useful "hiding" abstraction, 
> and the rows that compose that view cannot be viewed directly.
> Like dimensional models, measures in SQL would allow high-level abstractions 
> such as key-performance indicators (KPIs) to be shared and composed. Unlike 
> dimensional models, the models remain relational, namely, it is still 
> possible to enumerate and count the rows in a model.
> Consider the following view and query that uses it:
> {code:sql}
> CREATE VIEW EmpSummary AS
> SELECT deptno,
> job,
> AVG(sal) AS avg_sal,
> AVG(sal) AS MEASURE avg_sal_measure,
> COUNT(*) + 1 AS MEASURE count_plus_one_measure
> FROM Emp
> GROUP BY deptno, job;
> SELECT deptno,
> AVG(avg_sal) AS a1,
> AGGREGATE(avg_sal_measure) AS a2,
> AGGREGATE(count_plus_one_measure) AS c1
> FROM EmpSummary
> GROUP BY deptno;{code}
> Note that there is a special aggregate function, {{AGGREGATE}}, that rolls up 
> measures. Columns {{a1}} and {{a2}} will contain different values; the first 
> averages the averages, and the second computes the average from the raw data. 
> Column {{c1}} will return the number of employees in each department plus 
> one, not rolling up the "plus one" for each distinct job in the department.
> This is just a brief sketch illustrating the purpose of measures. This 
> feature is experimental, the syntax will no doubt change, and much of the 
> semantics (for example, what expressions are valid as measures, whether 
> measures remain measures they appear in the SELECT clause of an enclosing 
> query, and what is the "context" in which a measure is evaluated) need to be 
> ironed out.



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


[jira] [Commented] (CALCITE-6369) Expanding "star" gives ArrayIndexOutOfBoundsException with redundant columns and USING

2024-04-30 Thread James Duong (Jira)


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

James Duong commented on CALCITE-6369:
--

I managed to get this working right with the emp table when the duplicated 
column is EMPNO and the column in USING is also EMPNO. But it fails when using 
multiple columns that aren't consecutive (tried using EMPNO and HIREDATE).

There are multiple cases to consider:
 * There is one USING column, the projected column is the same column, and it 
is the first column in the table.
 * There is one USING column, the projected column is the same column, and it 
is not the first column in the table.
 * There are multiple USING columns, all columns projected are the same columns 
in the same order, and they are the first in the table.
 * There are multiple USING columns, all columns projected are the same columns 
in the same order, and they are not the first in the table.
 * There are multiple USING columns, all columns projected are in a different 
order, and they are the first in the table.
 * There are multiple USING columns, all columns projected are in a different 
order, and they are not the first in the table.
 * There are multiple USING columns, and only the first is projected, and it is 
the first in the table.
 * There are multiple USING columns, and only the first is projected, and it is 
not the first in the table.
 * There are multiple USING columns, and only the second is projected, and it 
is the first in the table.
 * There are multiple USING columns, and only the second is projected, and it 
is not the first in the table.

> Expanding "star" gives ArrayIndexOutOfBoundsException with redundant columns 
> and USING
> --
>
> Key: CALCITE-6369
> URL: https://issues.apache.org/jira/browse/CALCITE-6369
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.36.0
>Reporter: Claude Brisson
>Assignee: James Duong
>Priority: Major
>
> The query
> {code}
> select r_regionkey, * from region r0 join region r1 using (r_regionkey)
> {code}
> produces
> {code}
> java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 14
> at org.apache.calcite.runtime.PairLists$ArrayImmutablePairList.get 
> (PairLists.java:573)
> at org.apache.calcite.runtime.PairLists$ArrayImmutablePairList.get 
> (PairLists.java:550)
> at org.apache.calcite.sql.validate.SqlValidatorImpl$Permute.permute 
> (SqlValidatorImpl.java:7443)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.expandStar 
> (SqlValidatorImpl.java:697)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem 
> (SqlValidatorImpl.java:453)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList 
> (SqlValidatorImpl.java:4658)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect 
> (SqlValidatorImpl.java:3840)
> at org.apache.calcite.sql.validate.SelectNamespace.validateImpl 
> (SelectNamespace.java:61)
> at org.apache.calcite.sql.validate.AbstractNamespace.validate 
> (AbstractNamespace.java:88)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace 
> (SqlValidatorImpl.java:1154)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery 
> (SqlValidatorImpl.java:1125)
> {code}



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


[jira] [Comment Edited] (CALCITE-6369) Expanding "star" gives ArrayIndexOutOfBoundsException with redundant columns and USING

2024-04-30 Thread James Duong (Jira)


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

James Duong edited comment on CALCITE-6369 at 4/30/24 5:43 PM:
---

I've reproduced this problem using the EMP table. It's not clear why there's an 
ArrayIndexOutOfBoundsException while doing the permute call.

What happens is that the select expansion is converting the r_regionkey column 
reference to a COALESCE(e0.empno, e1.empno) and gives it the alias EMPNO – I'm 
guessing this is because NULL won't be matched when the column is joined.

If I forcibly change permute to get past the AIOB (stopping permutation at the 
faulty index), I get an ambiguous column reference error, which seems like a 
reasonable result for this query.

 


was (Author: jduong):
I've reproduced this problem. It's not clear why there's an 
ArrayIndexOutOfBoundsException while doing the permute call.

What happens is that the select expansion is converting the r_regionkey column 
reference to a COALESCE(r0.r_regionky, r1.r_regionkey) and gives it the alias 
EMPNO – I'm guessing this is because NULL won't be matched when the column is 
joined.

If I forcibly change permute to get past the AIOB (stopping permutation at the 
faulty index), I get an ambiguous column reference error, which seems like a 
reasonable result for this query.

 

> Expanding "star" gives ArrayIndexOutOfBoundsException with redundant columns 
> and USING
> --
>
> Key: CALCITE-6369
> URL: https://issues.apache.org/jira/browse/CALCITE-6369
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.36.0
>Reporter: Claude Brisson
>Assignee: James Duong
>Priority: Major
>
> The query
> {code}
> select r_regionkey, * from region r0 join region r1 using (r_regionkey)
> {code}
> produces
> {code}
> java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 14
> at org.apache.calcite.runtime.PairLists$ArrayImmutablePairList.get 
> (PairLists.java:573)
> at org.apache.calcite.runtime.PairLists$ArrayImmutablePairList.get 
> (PairLists.java:550)
> at org.apache.calcite.sql.validate.SqlValidatorImpl$Permute.permute 
> (SqlValidatorImpl.java:7443)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.expandStar 
> (SqlValidatorImpl.java:697)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem 
> (SqlValidatorImpl.java:453)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList 
> (SqlValidatorImpl.java:4658)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect 
> (SqlValidatorImpl.java:3840)
> at org.apache.calcite.sql.validate.SelectNamespace.validateImpl 
> (SelectNamespace.java:61)
> at org.apache.calcite.sql.validate.AbstractNamespace.validate 
> (AbstractNamespace.java:88)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace 
> (SqlValidatorImpl.java:1154)
> at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery 
> (SqlValidatorImpl.java:1125)
> {code}



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


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

2024-04-30 Thread Sergey Nuyanzin (Jira)


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

Sergey Nuyanzin edited comment on CALCITE-6393 at 4/30/24 1:56 PM:
---

{quote}
What other exception do you get with jdk11+?
{quote}
if I build it with jdk11 (in my case 11.0.20.1 (Eclipse Adoptium 11.0.20.1+1))
then i get this instead of {{ArrayIndexOutOfBoundsException}}
{noformat}
RemapperTest > ccalcite37WithCheck() FAILED
java.lang.IllegalArgumentException: Invalid type reference sort 0x10
at 
org.objectweb.asm.util.CheckMethodAdapter.visitTypeAnnotation(CheckMethodAdapter.java:524)
at 
org.objectweb.asm.MethodVisitor.visitTypeAnnotation(MethodVisitor.java:181)
at 
org.objectweb.asm.commons.MethodRemapper.visitTypeAnnotation(MethodRemapper.java:94)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1453)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at remapper.bug.RemapperTest.runTest(RemapperTest.java:63)
at remapper.bug.RemapperTest.ccalcite37WithCheck(RemapperTest.java:49)
 
{noformat}

UPD: with jdk17 (in my case 17.0.10 (Eclipse Adoptium 17.0.10+7))
the exception is going away


was (Author: sergey nuyanzin):
{quote}
What other exception do you get with jdk11+?
{quote}
if I build it with jdk11 (in my case 11.0.20.1 (Eclipse Adoptium 11.0.20.1+1))
then i get this instead of {{ArrayIndexOutOfBoundsException}}
{noformat}
RemapperTest > ccalcite37WithCheck() FAILED
java.lang.IllegalArgumentException: Invalid type reference sort 0x10
at 
org.objectweb.asm.util.CheckMethodAdapter.visitTypeAnnotation(CheckMethodAdapter.java:524)
at 
org.objectweb.asm.MethodVisitor.visitTypeAnnotation(MethodVisitor.java:181)
at 
org.objectweb.asm.commons.MethodRemapper.visitTypeAnnotation(MethodRemapper.java:94)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1453)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at remapper.bug.RemapperTest.runTest(RemapperTest.java:63)
at remapper.bug.RemapperTest.ccalcite37WithCheck(RemapperTest.java:49)
 
{noformat}

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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)


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

2024-04-30 Thread Sergey Nuyanzin (Jira)


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

Sergey Nuyanzin commented on CALCITE-6393:
--

{quote}
What other exception do you get with jdk11+?
{quote}
if I build it with jdk11 (in my case 11.0.20.1 (Eclipse Adoptium 11.0.20.1+1))
then i get this instead of {{ArrayIndexOutOfBoundsException}}
{noformat}
RemapperTest > ccalcite37WithCheck() FAILED
java.lang.IllegalArgumentException: Invalid type reference sort 0x10
at 
org.objectweb.asm.util.CheckMethodAdapter.visitTypeAnnotation(CheckMethodAdapter.java:524)
at 
org.objectweb.asm.MethodVisitor.visitTypeAnnotation(MethodVisitor.java:181)
at 
org.objectweb.asm.commons.MethodRemapper.visitTypeAnnotation(MethodRemapper.java:94)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1453)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at remapper.bug.RemapperTest.runTest(RemapperTest.java:63)
at remapper.bug.RemapperTest.ccalcite37WithCheck(RemapperTest.java:49)
 
{noformat}

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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)


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

2024-04-30 Thread Ruben Q L (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-6393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L updated CALCITE-6393:
---
Description: 
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

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

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


> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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 
> 

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

2024-04-30 Thread Ruben Q L (Jira)


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

Ruben Q L commented on CALCITE-6393:


Thanks [~Sergey Nuyanzin] for creating the ticket and describing the issue.
{quote}... by the way ArrayIndexOutOfBoundsException is only if it was built 
with jdk1.8, in case it was built with other jdk e.g. 11+ then there will 
another Exception
{quote}
What other exception do you get with jdk11+?

Correct me if I'm wrong [~MasseGuillaume], but the main blocking issue is #1: 
this problem prevents ASM from processing Calcite files correctly. Issue #2 
does not happen "by default", since it requires the usage of CheckClassAdapter 
(but it's still a problem that needs to be investigated).

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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]
> 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



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


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

2024-04-30 Thread Sergey Nuyanzin (Jira)


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

Sergey Nuyanzin commented on CALCITE-6393:
--

It looks like there are 2 issues
1. ArrayIndexOutOfBoundsException (by the way  ArrayIndexOutOfBoundsException 
is only if it was built with jdk1.8, in case it was built with other jdk e.g. 
11+ then there will another Exception) 
   as {{bisect}} shows it started being reproduced after this commit 
https://github.com/apache/calcite/commit/bcf6bd8577b25c563b1c597c70704594a18ca1a3
   further analysis shows that the reason is having of {{assert}} in code in 
this class.
   Removal of asserts fixes this issue

2. {noformat}java.lang.IllegalArgumentException: Invalid end label (must be 
visited first){noformat}
it looks like it came together with CALCITE-4199 with checkerframework
currently not clear how to fix it however there is at least one WA: if we build 
Calcite with jdk11+ then it disappears

> Byte code of SqlFunctions is invalid
> 
>
> Key: CALCITE-6393
> URL: https://issues.apache.org/jira/browse/CALCITE-6393
> Project: Calcite
>  Issue Type: Bug
>Reporter: Sergey Nuyanzin
>Priority: Major
>
> 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]
> 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



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


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

2024-04-30 Thread Sergey Nuyanzin (Jira)
Sergey Nuyanzin created CALCITE-6393:


 Summary: Byte code of SqlFunctions is invalid
 Key: CALCITE-6393
 URL: https://issues.apache.org/jira/browse/CALCITE-6393
 Project: Calcite
  Issue Type: Bug
Reporter: Sergey Nuyanzin


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]

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



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