Vladimir Steshin created CALCITE-4945: -----------------------------------------
Summary: Compilation failes on subquery Key: CALCITE-4945 URL: https://issues.apache.org/jira/browse/CALCITE-4945 Project: Calcite Issue Type: Bug Reporter: Vladimir Steshin While researching CALCITE-685 (calcite 1.29, master branch), I met an calcite-runtime compilation error. Request example: {code:sql} select e.department_id, (select 1 from employee e2 where e.department_id = -100) from employee e; {code} Stacktrace: {code:java} 2021-12-16 21:42:38,032 [ForkJoinPool-1-worker-9] INFO - open start - state modified 2021-12-16 21:42:43,612 [ForkJoinPool-1-worker-9] INFO - Checkpoint start 2021-12-16 21:42:43,613 [ForkJoinPool-1-worker-9] INFO - Checkpoint end - txts: 279 Error while executing SQL "select e.department_id, ( select e2.employee_id from employee e2 where e.department_id = 1000 ) from employee e ": Error while compiling generated Java code: public static class Record2_0 implements java.io.Serializable { public boolean f0; public int f1; public Record2_0() {} public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Record2_0)) { return false; } return this.f0 == ((Record2_0) o).f0 && this.f1 == ((Record2_0) o).f1; } public int hashCode() { int h = 0; h = org.apache.calcite.runtime.Utilities.hash(h, this.f0); h = org.apache.calcite.runtime.Utilities.hash(h, this.f1); return h; } public int compareTo(Record2_0 that) { int c; c = org.apache.calcite.runtime.Utilities.compare(this.f0, that.f0); if (c != 0) { return c; } c = org.apache.calcite.runtime.Utilities.compare(this.f1, that.f1); if (c != 0) { return c; } return 0; } public String toString() { return "{f0=" + this.f0 + ", f1=" + this.f1 + "}"; } } public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) { final org.apache.calcite.linq4j.Enumerable _inputEnumerable = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable child = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); return new Object[] { current[0], current[7], org.apache.calcite.runtime.SqlFunctions.toInt(current[7]) == 1000}; } }; } }; final org.apache.calcite.linq4j.Enumerable _inputEnumerable0 = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable left0 = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable0.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[0]); } }; } }; final org.apache.calcite.linq4j.Enumerable _inputEnumerable00 = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable child0 = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable00.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { while (inputEnumerator.moveNext()) { if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[7]) == 1000) { return true; } } return false; } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[7]) == 1000; } }; } }; java.util.List accumulatorAdders = new java.util.LinkedList(); org.apache.calcite.adapter.enumerable.AggregateLambdaFactory lambdaFactory = new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory( new org.apache.calcite.linq4j.function.Function0() { public Object apply() { return org.apache.calcite.runtime.Unit.INSTANCE; } } , accumulatorAdders); java.util.List accumulatorAdders0 = new java.util.LinkedList(); accumulatorAdders0.add(new org.apache.calcite.linq4j.function.Function2() { public Record2_0 apply(Record2_0 acc, Object[] in) { if (acc.f0) { throw new IllegalStateException( "more than one value in agg SINGLE_VALUE"); } acc.f0 = true; acc.f1 = org.apache.calcite.runtime.SqlFunctions.toInt(in[0]); return acc; } public Record2_0 apply(Object acc, Object in) { return apply( (Record2_0) acc, (Object[]) in); } } ); org.apache.calcite.adapter.enumerable.AggregateLambdaFactory lambdaFactory0 = new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory( new org.apache.calcite.linq4j.function.Function0() { public Object apply() { boolean a0s0; int a0s1; a0s0 = false; a0s1 = 0; Record2_0 record0; record0 = new Record2_0(); record0.f0 = a0s0; record0.f1 = a0s1; return record0; } } , accumulatorAdders0); final org.apache.calcite.linq4j.Enumerable _inputEnumerable1 = org.apache.calcite.linq4j.EnumerableDefaults.mergeJoin(child.orderBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] v) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(v[2]); } public Object apply(Object v) { return apply( (Object[]) v); } } , org.apache.calcite.linq4j.function.Functions.nullsComparator(false, false)), org.apache.calcite.linq4j.EnumerableDefaults.nestedLoopJoin(left0, child0.distinct(), new org.apache.calcite.linq4j.function.Predicate2() { public boolean apply(int left, boolean right) { return true; } public boolean apply(Integer left, Boolean right) { return apply( left.intValue(), right.booleanValue()); } public boolean apply(Object left, Object right) { return apply( (Integer) left, (Boolean) right); } } , new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(Integer left, Boolean right) { return new Object[] { left, right}; } public Object[] apply(Object left, Object right) { return apply( (Integer) left, (Boolean) right); } } , org.apache.calcite.linq4j.JoinType.INNER).groupBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] a0) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(a0[1]); } public Object apply(Object a0) { return apply( (Object[]) a0); } } , lambdaFactory0.accumulatorInitializer(), lambdaFactory0.accumulatorAdder(), lambdaFactory0.resultSelector(new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(boolean key, Record2_0 acc) { return new Object[] { key, acc.f1}; } public Object[] apply(Boolean key, Record2_0 acc) { return apply( key.booleanValue(), acc); } public Object[] apply(Object key, Object acc) { return apply( (Boolean) key, (Record2_0) acc); } } )).orderBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] v) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(v[0]); } public Object apply(Object v) { return apply( (Object[]) v); } } , org.apache.calcite.linq4j.function.Functions.nullsComparator(false, false)), new org.apache.calcite.linq4j.function.Predicate1() { public boolean apply(Object[] left) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(left[2]); } public boolean apply(Object left) { return apply( (Object[]) left); } } , new org.apache.calcite.linq4j.function.Predicate1() { public boolean apply(Object[] right) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(right[0]); } public boolean apply(Object right) { return apply( (Object[]) right); } } , null, new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(Object[] left, Object[] right) { return new Object[] { left[0], left[1], left[2], right == null ? null : right[0], right == null ? null : right[1]}; } public Object[] apply(Object left, Object right) { return apply( (Object[]) left, (Object[]) right); } } , org.apache.calcite.linq4j.JoinType.LEFT, new java.util.Comparator(){ public int compare(Boolean v0, Boolean v1) { final int c; c = org.apache.calcite.runtime.Utilities.compare(v0, v1); if (c != 0) { return c; } return 0; } public int compare(Object o0, Object o1) { return this.compare((Boolean) o0, (Boolean) o1); } }); return new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable1.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); final Object input_value = current[1]; final Object input_value0 = current[4]; return new Object[] { input_value, input_value0}; } }; } }; } public Class getElementType() { return java.lang.Object[].class; } java.sql.SQLException: Error while executing SQL "select e.department_id, ( select e2.employee_id from employee e2 where e.department_id = 1000 ) from employee e ": Error while compiling generated Java code: public static class Record2_0 implements java.io.Serializable { public boolean f0; public int f1; public Record2_0() {} public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Record2_0)) { return false; } return this.f0 == ((Record2_0) o).f0 && this.f1 == ((Record2_0) o).f1; } public int hashCode() { int h = 0; h = org.apache.calcite.runtime.Utilities.hash(h, this.f0); h = org.apache.calcite.runtime.Utilities.hash(h, this.f1); return h; } public int compareTo(Record2_0 that) { int c; c = org.apache.calcite.runtime.Utilities.compare(this.f0, that.f0); if (c != 0) { return c; } c = org.apache.calcite.runtime.Utilities.compare(this.f1, that.f1); if (c != 0) { return c; } return 0; } public String toString() { return "{f0=" + this.f0 + ", f1=" + this.f1 + "}"; } } public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) { final org.apache.calcite.linq4j.Enumerable _inputEnumerable = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable child = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); return new Object[] { current[0], current[7], org.apache.calcite.runtime.SqlFunctions.toInt(current[7]) == 1000}; } }; } }; final org.apache.calcite.linq4j.Enumerable _inputEnumerable0 = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable left0 = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable0.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[0]); } }; } }; final org.apache.calcite.linq4j.Enumerable _inputEnumerable00 = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable child0 = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable00.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { while (inputEnumerator.moveNext()) { if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[7]) == 1000) { return true; } } return false; } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[7]) == 1000; } }; } }; java.util.List accumulatorAdders = new java.util.LinkedList(); org.apache.calcite.adapter.enumerable.AggregateLambdaFactory lambdaFactory = new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory( new org.apache.calcite.linq4j.function.Function0() { public Object apply() { return org.apache.calcite.runtime.Unit.INSTANCE; } } , accumulatorAdders); java.util.List accumulatorAdders0 = new java.util.LinkedList(); accumulatorAdders0.add(new org.apache.calcite.linq4j.function.Function2() { public Record2_0 apply(Record2_0 acc, Object[] in) { if (acc.f0) { throw new IllegalStateException( "more than one value in agg SINGLE_VALUE"); } acc.f0 = true; acc.f1 = org.apache.calcite.runtime.SqlFunctions.toInt(in[0]); return acc; } public Record2_0 apply(Object acc, Object in) { return apply( (Record2_0) acc, (Object[]) in); } } ); org.apache.calcite.adapter.enumerable.AggregateLambdaFactory lambdaFactory0 = new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory( new org.apache.calcite.linq4j.function.Function0() { public Object apply() { boolean a0s0; int a0s1; a0s0 = false; a0s1 = 0; Record2_0 record0; record0 = new Record2_0(); record0.f0 = a0s0; record0.f1 = a0s1; return record0; } } , accumulatorAdders0); final org.apache.calcite.linq4j.Enumerable _inputEnumerable1 = org.apache.calcite.linq4j.EnumerableDefaults.mergeJoin(child.orderBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] v) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(v[2]); } public Object apply(Object v) { return apply( (Object[]) v); } } , org.apache.calcite.linq4j.function.Functions.nullsComparator(false, false)), org.apache.calcite.linq4j.EnumerableDefaults.nestedLoopJoin(left0, child0.distinct(), new org.apache.calcite.linq4j.function.Predicate2() { public boolean apply(int left, boolean right) { return true; } public boolean apply(Integer left, Boolean right) { return apply( left.intValue(), right.booleanValue()); } public boolean apply(Object left, Object right) { return apply( (Integer) left, (Boolean) right); } } , new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(Integer left, Boolean right) { return new Object[] { left, right}; } public Object[] apply(Object left, Object right) { return apply( (Integer) left, (Boolean) right); } } , org.apache.calcite.linq4j.JoinType.INNER).groupBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] a0) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(a0[1]); } public Object apply(Object a0) { return apply( (Object[]) a0); } } , lambdaFactory0.accumulatorInitializer(), lambdaFactory0.accumulatorAdder(), lambdaFactory0.resultSelector(new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(boolean key, Record2_0 acc) { return new Object[] { key, acc.f1}; } public Object[] apply(Boolean key, Record2_0 acc) { return apply( key.booleanValue(), acc); } public Object[] apply(Object key, Object acc) { return apply( (Boolean) key, (Record2_0) acc); } } )).orderBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] v) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(v[0]); } public Object apply(Object v) { return apply( (Object[]) v); } } , org.apache.calcite.linq4j.function.Functions.nullsComparator(false, false)), new org.apache.calcite.linq4j.function.Predicate1() { public boolean apply(Object[] left) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(left[2]); } public boolean apply(Object left) { return apply( (Object[]) left); } } , new org.apache.calcite.linq4j.function.Predicate1() { public boolean apply(Object[] right) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(right[0]); } public boolean apply(Object right) { return apply( (Object[]) right); } } , null, new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(Object[] left, Object[] right) { return new Object[] { left[0], left[1], left[2], right == null ? null : right[0], right == null ? null : right[1]}; } public Object[] apply(Object left, Object right) { return apply( (Object[]) left, (Object[]) right); } } , org.apache.calcite.linq4j.JoinType.LEFT, new java.util.Comparator(){ public int compare(Boolean v0, Boolean v1) { final int c; c = org.apache.calcite.runtime.Utilities.compare(v0, v1); if (c != 0) { return c; } return 0; } public int compare(Object o0, Object o1) { return this.compare((Boolean) o0, (Boolean) o1); } }); return new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable1.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); final Object input_value = current[1]; final Object input_value0 = current[4]; return new Object[] { input_value, input_value0}; } }; } }; } public Class getElementType() { return java.lang.Object[].class; } at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:542) at org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1562) at org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1501) at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1560) at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1550) at org.apache.calcite.test.CalciteAssert$AssertQuery.returnsCount(CalciteAssert.java:1546) at org.apache.calcite.test.JdbcTest.testCorrelatedScalarSubQuery(JdbcTest.java:5134) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) at org.junit.jupiter.engine.extension.TimeoutInvocation.proceed(TimeoutInvocation.java:46) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185) at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:129) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185) at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:129) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185) at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1067) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1703) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172) Suppressed: org.apache.calcite.util.TestUtil$ExtraInformation: With materializationsEnabled=false, limit=0 at org.apache.calcite.util.TestUtil.rethrow(TestUtil.java:346) at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:574) ... 64 more Caused by: java.lang.RuntimeException: Error while compiling generated Java code: public static class Record2_0 implements java.io.Serializable { public boolean f0; public int f1; public Record2_0() {} public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Record2_0)) { return false; } return this.f0 == ((Record2_0) o).f0 && this.f1 == ((Record2_0) o).f1; } public int hashCode() { int h = 0; h = org.apache.calcite.runtime.Utilities.hash(h, this.f0); h = org.apache.calcite.runtime.Utilities.hash(h, this.f1); return h; } public int compareTo(Record2_0 that) { int c; c = org.apache.calcite.runtime.Utilities.compare(this.f0, that.f0); if (c != 0) { return c; } c = org.apache.calcite.runtime.Utilities.compare(this.f1, that.f1); if (c != 0) { return c; } return 0; } public String toString() { return "{f0=" + this.f0 + ", f1=" + this.f1 + "}"; } } public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) { final org.apache.calcite.linq4j.Enumerable _inputEnumerable = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable child = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); return new Object[] { current[0], current[7], org.apache.calcite.runtime.SqlFunctions.toInt(current[7]) == 1000}; } }; } }; final org.apache.calcite.linq4j.Enumerable _inputEnumerable0 = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable left0 = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable0.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[0]); } }; } }; final org.apache.calcite.linq4j.Enumerable _inputEnumerable00 = org.apache.calcite.schema.Schemas.queryable(root, root.getRootSchema().getSubSchema("foodmart2"), java.lang.Object[].class, "employee").asEnumerable(); final org.apache.calcite.linq4j.AbstractEnumerable child0 = new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable00.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { while (inputEnumerator.moveNext()) { if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[7]) == 1000) { return true; } } return false; } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.SqlFunctions.toInt(((Object[]) inputEnumerator.current())[7]) == 1000; } }; } }; java.util.List accumulatorAdders = new java.util.LinkedList(); org.apache.calcite.adapter.enumerable.AggregateLambdaFactory lambdaFactory = new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory( new org.apache.calcite.linq4j.function.Function0() { public Object apply() { return org.apache.calcite.runtime.Unit.INSTANCE; } } , accumulatorAdders); java.util.List accumulatorAdders0 = new java.util.LinkedList(); accumulatorAdders0.add(new org.apache.calcite.linq4j.function.Function2() { public Record2_0 apply(Record2_0 acc, Object[] in) { if (acc.f0) { throw new IllegalStateException( "more than one value in agg SINGLE_VALUE"); } acc.f0 = true; acc.f1 = org.apache.calcite.runtime.SqlFunctions.toInt(in[0]); return acc; } public Record2_0 apply(Object acc, Object in) { return apply( (Record2_0) acc, (Object[]) in); } } ); org.apache.calcite.adapter.enumerable.AggregateLambdaFactory lambdaFactory0 = new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory( new org.apache.calcite.linq4j.function.Function0() { public Object apply() { boolean a0s0; int a0s1; a0s0 = false; a0s1 = 0; Record2_0 record0; record0 = new Record2_0(); record0.f0 = a0s0; record0.f1 = a0s1; return record0; } } , accumulatorAdders0); final org.apache.calcite.linq4j.Enumerable _inputEnumerable1 = org.apache.calcite.linq4j.EnumerableDefaults.mergeJoin(child.orderBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] v) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(v[2]); } public Object apply(Object v) { return apply( (Object[]) v); } } , org.apache.calcite.linq4j.function.Functions.nullsComparator(false, false)), org.apache.calcite.linq4j.EnumerableDefaults.nestedLoopJoin(left0, child0.distinct(), new org.apache.calcite.linq4j.function.Predicate2() { public boolean apply(int left, boolean right) { return true; } public boolean apply(Integer left, Boolean right) { return apply( left.intValue(), right.booleanValue()); } public boolean apply(Object left, Object right) { return apply( (Integer) left, (Boolean) right); } } , new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(Integer left, Boolean right) { return new Object[] { left, right}; } public Object[] apply(Object left, Object right) { return apply( (Integer) left, (Boolean) right); } } , org.apache.calcite.linq4j.JoinType.INNER).groupBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] a0) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(a0[1]); } public Object apply(Object a0) { return apply( (Object[]) a0); } } , lambdaFactory0.accumulatorInitializer(), lambdaFactory0.accumulatorAdder(), lambdaFactory0.resultSelector(new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(boolean key, Record2_0 acc) { return new Object[] { key, acc.f1}; } public Object[] apply(Boolean key, Record2_0 acc) { return apply( key.booleanValue(), acc); } public Object[] apply(Object key, Object acc) { return apply( (Boolean) key, (Record2_0) acc); } } )).orderBy(new org.apache.calcite.linq4j.function.Function1() { public boolean apply(Object[] v) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(v[0]); } public Object apply(Object v) { return apply( (Object[]) v); } } , org.apache.calcite.linq4j.function.Functions.nullsComparator(false, false)), new org.apache.calcite.linq4j.function.Predicate1() { public boolean apply(Object[] left) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(left[2]); } public boolean apply(Object left) { return apply( (Object[]) left); } } , new org.apache.calcite.linq4j.function.Predicate1() { public boolean apply(Object[] right) { return org.apache.calcite.runtime.SqlFunctions.toBoolean(right[0]); } public boolean apply(Object right) { return apply( (Object[]) right); } } , null, new org.apache.calcite.linq4j.function.Function2() { public Object[] apply(Object[] left, Object[] right) { return new Object[] { left[0], left[1], left[2], right == null ? null : right[0], right == null ? null : right[1]}; } public Object[] apply(Object left, Object right) { return apply( (Object[]) left, (Object[]) right); } } , org.apache.calcite.linq4j.JoinType.LEFT, new java.util.Comparator(){ public int compare(Boolean v0, Boolean v1) { final int c; c = org.apache.calcite.runtime.Utilities.compare(v0, v1); if (c != 0) { return c; } return 0; } public int compare(Object o0, Object o1) { return this.compare((Boolean) o0, (Boolean) o1); } }); return new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable1.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); final Object input_value = current[1]; final Object input_value0 = current[4]; return new Object[] { input_value, input_value0}; } }; } }; } public Class getElementType() { return java.lang.Object[].class; } at org.apache.calcite.avatica.Helper.wrap(Helper.java:37) at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130) at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:324) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:220) at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:647) at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513) at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483) at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249) at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623) at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156) ... 66 more Caused by: org.codehaus.commons.compiler.CompileException: Line 169, Column 111: No applicable constructor/method found for actual parameters "org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.Enumerable, Baz$13, Baz$14, void, Baz$15, org.apache.calcite.linq4j.JoinType, Baz$16"; candidates are: "public static org.apache.calcite.linq4j.Enumerable org.apache.calcite.linq4j.EnumerableDefaults.mergeJoin(org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.function.Function1, org.apache.calcite.linq4j.function.Function1, org.apache.calcite.linq4j.function.Predicate2, org.apache.calcite.linq4j.function.Function2, org.apache.calcite.linq4j.JoinType, java.util.Comparator)", "public static org.apache.calcite.linq4j.Enumerable org.apache.calcite.linq4j.EnumerableDefaults.mergeJoin(org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.function.Function1, org.apache.calcite.linq4j.function.Function1, org.apache.calcite.linq4j.function.Function2, org.apache.calcite.linq4j.JoinType, java.util.Comparator)", "public static org.apache.calcite.linq4j.Enumerable org.apache.calcite.linq4j.EnumerableDefaults.mergeJoin(org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.Enumerable, org.apache.calcite.linq4j.function.Function1, org.apache.calcite.linq4j.function.Function1, org.apache.calcite.linq4j.function.Function2, boolean, boolean)" at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12679) at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:9390) at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9250) at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9168) at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5089) at org.codehaus.janino.UnitCompiler.access$9000(UnitCompiler.java:231) at org.codehaus.janino.UnitCompiler$15.visitMethodInvocation(UnitCompiler.java:4631) at org.codehaus.janino.UnitCompiler$15.visitMethodInvocation(UnitCompiler.java:4604) at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:5443) at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604) at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622) at org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231) at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539) at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523) at org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523) at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218) at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379) at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412) at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231) at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391) at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386) at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359) at org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231) at org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333) at org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330) at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367) at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330) at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245) at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294) at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288) at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267) at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52) at org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428) at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166) at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127) ... 76 more {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)