Hello,
the exception in the object is raised when the following query is issued to
Calcite:

*select x*


>
>
>
>
> *from (values (1, 'a'), (2, 'b')) as t(x, y)where x > 1 unionselect xfrom
> (values (1, 'a'), (2, 'b'), (1, 'b'), (2, 'c'), (2, 'c')) as t(x, y)where x
> > 1*


I found several issues involving code compilation but none of them seemed
relevant for this case.

The query looks fine to me, can you please check whether this it is an
issue?

You can check it here by launching *testUnionWithFiltersProject() *method in
 *SparkAdapterTest.java*:
https://github.com/asolimando/calcite/tree/SPARK-TESTS

Full stack trace below:

java.lang.RuntimeException: With materializationsEnabled=false, limit=0
at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:600)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1346)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1329)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1357)
at
org.apache.calcite.test.SparkAdapterTest.commonTester(SparkAdapterTest.java:93)
at
org.apache.calcite.test.SparkAdapterTest.testUnionWithFiltersProject(SparkAdapterTest.java:651)
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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.sql.SQLException: Error while executing SQL "select x
from (values (1, 'a'), (2, 'b')) as t(x, y)
where x > 1
 union
select x
from (values (1, 'a'), (2, 'b'), (1, 'b'), (2, 'c'), (2, 'c')) as t(x, y)
where x > 1
": Error while compiling generated Java code:
public static class Record2_0 implements java.io.Serializable {
  public int X;
  public String Y;
  public Record2_0() {}
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Record2_0)) {
      return false;
    }
    return this.X == ((Record2_0) o).X && java.util.Objects.equals(this.Y,
((Record2_0) o).Y);
  }
  public int hashCode() {
    int h = 0;
    h = org.apache.calcite.runtime.Utilities.hash(h, this.X);
    h = org.apache.calcite.runtime.Utilities.hash(h, this.Y);
    return h;
  }
  public int compareTo(Record2_0 that) {
    int c;
    c = org.apache.calcite.runtime.Utilities.compare(this.X, that.X);
    if (c != 0) {
      return c;
    }
    c = org.apache.calcite.runtime.Utilities.compare(this.Y, that.Y);
    if (c != 0) {
      return c;
    }
    return 0;
  }
  public String toString() {
    return "{X=" + this.X + ", Y=" + this.Y + "}";
  }
}
org.apache.calcite.DataContext root;
public org.apache.calcite.linq4j.Enumerable bind(final
org.apache.calcite.DataContext root0) {
  root = root0;
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Object[] {
    new Object[] {
      1,
      "a"},
    new Object[] {
      2,
      "b"}});
  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
= _inputEnumerable.enumerator();
          public void reset() {
            inputEnumerator.reset();
          }
          public boolean moveNext() {
            while (inputEnumerator.moveNext()) {
              if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[])
inputEnumerator.current())[0]) > 1) {
                return true;
              }
            }
            return false;
          }
          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 _inputEnumerable0 =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Record2_0[] {
    new Record2_0(
      1,
      "a"),
    new Record2_0(
      2,
      "b"),
    new Record2_0(
      1,
      "b"),
    new Record2_0(
      2,
      "c"),
    new Record2_0(
      2,
      "c")});
  final org.apache.calcite.linq4j.AbstractEnumerable child1 = 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() {
            while (inputEnumerator.moveNext()) {
              if (((Record2_0) inputEnumerator.current()).X > 1) {
                return true;
              }
            }
            return false;
          }
          public void close() {
            inputEnumerator.close();
          }
          public Object current() {
            return ((Record2_0) inputEnumerator.current()).X;
          }
        };
    }
  };
  return child0.union(child1);
}

public Class getElementType() {
  return int.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:156)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:568)
... 27 more
Caused by: java.lang.RuntimeException: Error while compiling generated Java
code:
public static class Record2_0 implements java.io.Serializable {
  public int X;
  public String Y;
  public Record2_0() {}
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Record2_0)) {
      return false;
    }
    return this.X == ((Record2_0) o).X && java.util.Objects.equals(this.Y,
((Record2_0) o).Y);
  }
  public int hashCode() {
    int h = 0;
    h = org.apache.calcite.runtime.Utilities.hash(h, this.X);
    h = org.apache.calcite.runtime.Utilities.hash(h, this.Y);
    return h;
  }
  public int compareTo(Record2_0 that) {
    int c;
    c = org.apache.calcite.runtime.Utilities.compare(this.X, that.X);
    if (c != 0) {
      return c;
    }
    c = org.apache.calcite.runtime.Utilities.compare(this.Y, that.Y);
    if (c != 0) {
      return c;
    }
    return 0;
  }
  public String toString() {
    return "{X=" + this.X + ", Y=" + this.Y + "}";
  }
}
org.apache.calcite.DataContext root;
public org.apache.calcite.linq4j.Enumerable bind(final
org.apache.calcite.DataContext root0) {
  root = root0;
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Object[] {
    new Object[] {
      1,
      "a"},
    new Object[] {
      2,
      "b"}});
  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
= _inputEnumerable.enumerator();
          public void reset() {
            inputEnumerator.reset();
          }
          public boolean moveNext() {
            while (inputEnumerator.moveNext()) {
              if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[])
inputEnumerator.current())[0]) > 1) {
                return true;
              }
            }
            return false;
          }
          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 _inputEnumerable0 =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Record2_0[] {
    new Record2_0(
      1,
      "a"),
    new Record2_0(
      2,
      "b"),
    new Record2_0(
      1,
      "b"),
    new Record2_0(
      2,
      "c"),
    new Record2_0(
      2,
      "c")});
  final org.apache.calcite.linq4j.AbstractEnumerable child1 = 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() {
            while (inputEnumerator.moveNext()) {
              if (((Record2_0) inputEnumerator.current()).X > 1) {
                return true;
              }
            }
            return false;
          }
          public void close() {
            inputEnumerator.close();
          }
          public Object current() {
            return ((Record2_0) inputEnumerator.current()).X;
          }
        };
    }
  };
  return child0.union(child1);
}

public Class getElementType() {
  return int.class;
}


at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
at
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:108)
at
org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1254)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:331)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:781)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:640)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:610)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
at
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
at
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
... 29 more
Caused by: java.lang.RuntimeException: while compiling CalciteProgram211242
at
org.apache.calcite.util.javac.JaninoCompiler.compile(JaninoCompiler.java:83)
at
org.apache.calcite.adapter.spark.SparkHandlerImpl.compile(SparkHandlerImpl.java:128)
at
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:103)
... 39 more
Caused by: java.lang.ClassNotFoundException: File
'CalciteProgram211242.java', Line 84, Column 8: No applicable
constructor/method found for actual parameters "int, java.lang.String";
candidates are: "CalciteProgram211242$Record2_0()"
at
org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:226)
at
org.apache.calcite.util.javac.JaninoCompiler$AccountingClassLoader.generateBytecodes(JaninoCompiler.java:160)
at
org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at
org.apache.calcite.util.javac.JaninoCompiler.compile(JaninoCompiler.java:81)
... 41 more
Caused by: org.codehaus.commons.compiler.CompileException: File
'CalciteProgram211242.java', Line 84, Column 8: No applicable
constructor/method found for actual parameters "int, java.lang.String";
candidates are: "CalciteProgram211242$Record2_0()"
at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10092)
at
org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:7506)
at
org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:6452)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:4103)
at org.codehaus.janino.UnitCompiler.access$7600(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$10.visitNewClassInstance(UnitCompiler.java:3263)
at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:4085)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:3278)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4345)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4303)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:4279)
at org.codehaus.janino.UnitCompiler.access$7500(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$10.visitNewInitializedArray(UnitCompiler.java:3262)
at org.codehaus.janino.Java$NewInitializedArray.accept(Java.java:4263)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:3278)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4345)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3952)
at org.codehaus.janino.UnitCompiler.access$6900(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$10.visitMethodInvocation(UnitCompiler.java:3251)
at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:3974)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:3278)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4345)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1835)
at org.codehaus.janino.UnitCompiler.access$2000(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$4.visitLocalVariableDeclarationStatement(UnitCompiler.java:943)
at
org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:2508)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:956)
at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:997)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2283)
at
org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:820)
at
org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:792)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:505)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:391)
at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:345)
at
org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1139)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:352)
at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:320)
at
org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:224)
... 46 more
java.lang.RuntimeException: exception while executing [select x
from (values (1, 'a'), (2, 'b')) as t(x, y)
where x > 1
 union
select x
from (values (1, 'a'), (2, 'b'), (1, 'b'), (2, 'c'), (2, 'c')) as t(x, y)
where x > 1
]
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1351)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1329)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1357)
at
org.apache.calcite.test.SparkAdapterTest.commonTester(SparkAdapterTest.java:93)
at
org.apache.calcite.test.SparkAdapterTest.testUnionWithFiltersProject(SparkAdapterTest.java:651)
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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.RuntimeException: With materializationsEnabled=false,
limit=0
at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:600)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1346)
... 26 more
Caused by: java.sql.SQLException: Error while executing SQL "select x
from (values (1, 'a'), (2, 'b')) as t(x, y)
where x > 1
 union
select x
from (values (1, 'a'), (2, 'b'), (1, 'b'), (2, 'c'), (2, 'c')) as t(x, y)
where x > 1
": Error while compiling generated Java code:
public static class Record2_0 implements java.io.Serializable {
  public int X;
  public String Y;
  public Record2_0() {}
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Record2_0)) {
      return false;
    }
    return this.X == ((Record2_0) o).X && java.util.Objects.equals(this.Y,
((Record2_0) o).Y);
  }
  public int hashCode() {
    int h = 0;
    h = org.apache.calcite.runtime.Utilities.hash(h, this.X);
    h = org.apache.calcite.runtime.Utilities.hash(h, this.Y);
    return h;
  }
  public int compareTo(Record2_0 that) {
    int c;
    c = org.apache.calcite.runtime.Utilities.compare(this.X, that.X);
    if (c != 0) {
      return c;
    }
    c = org.apache.calcite.runtime.Utilities.compare(this.Y, that.Y);
    if (c != 0) {
      return c;
    }
    return 0;
  }
  public String toString() {
    return "{X=" + this.X + ", Y=" + this.Y + "}";
  }
}
org.apache.calcite.DataContext root;
public org.apache.calcite.linq4j.Enumerable bind(final
org.apache.calcite.DataContext root0) {
  root = root0;
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Object[] {
    new Object[] {
      1,
      "a"},
    new Object[] {
      2,
      "b"}});
  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
= _inputEnumerable.enumerator();
          public void reset() {
            inputEnumerator.reset();
          }
          public boolean moveNext() {
            while (inputEnumerator.moveNext()) {
              if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[])
inputEnumerator.current())[0]) > 1) {
                return true;
              }
            }
            return false;
          }
          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 _inputEnumerable0 =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Record2_0[] {
    new Record2_0(
      1,
      "a"),
    new Record2_0(
      2,
      "b"),
    new Record2_0(
      1,
      "b"),
    new Record2_0(
      2,
      "c"),
    new Record2_0(
      2,
      "c")});
  final org.apache.calcite.linq4j.AbstractEnumerable child1 = 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() {
            while (inputEnumerator.moveNext()) {
              if (((Record2_0) inputEnumerator.current()).X > 1) {
                return true;
              }
            }
            return false;
          }
          public void close() {
            inputEnumerator.close();
          }
          public Object current() {
            return ((Record2_0) inputEnumerator.current()).X;
          }
        };
    }
  };
  return child0.union(child1);
}

public Class getElementType() {
  return int.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:156)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:568)
... 27 more
Caused by: java.lang.RuntimeException: Error while compiling generated Java
code:
public static class Record2_0 implements java.io.Serializable {
  public int X;
  public String Y;
  public Record2_0() {}
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Record2_0)) {
      return false;
    }
    return this.X == ((Record2_0) o).X && java.util.Objects.equals(this.Y,
((Record2_0) o).Y);
  }
  public int hashCode() {
    int h = 0;
    h = org.apache.calcite.runtime.Utilities.hash(h, this.X);
    h = org.apache.calcite.runtime.Utilities.hash(h, this.Y);
    return h;
  }
  public int compareTo(Record2_0 that) {
    int c;
    c = org.apache.calcite.runtime.Utilities.compare(this.X, that.X);
    if (c != 0) {
      return c;
    }
    c = org.apache.calcite.runtime.Utilities.compare(this.Y, that.Y);
    if (c != 0) {
      return c;
    }
    return 0;
  }
  public String toString() {
    return "{X=" + this.X + ", Y=" + this.Y + "}";
  }
}
org.apache.calcite.DataContext root;
public org.apache.calcite.linq4j.Enumerable bind(final
org.apache.calcite.DataContext root0) {
  root = root0;
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Object[] {
    new Object[] {
      1,
      "a"},
    new Object[] {
      2,
      "b"}});
  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
= _inputEnumerable.enumerator();
          public void reset() {
            inputEnumerator.reset();
          }
          public boolean moveNext() {
            while (inputEnumerator.moveNext()) {
              if (org.apache.calcite.runtime.SqlFunctions.toInt(((Object[])
inputEnumerator.current())[0]) > 1) {
                return true;
              }
            }
            return false;
          }
          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 _inputEnumerable0 =
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Record2_0[] {
    new Record2_0(
      1,
      "a"),
    new Record2_0(
      2,
      "b"),
    new Record2_0(
      1,
      "b"),
    new Record2_0(
      2,
      "c"),
    new Record2_0(
      2,
      "c")});
  final org.apache.calcite.linq4j.AbstractEnumerable child1 = 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() {
            while (inputEnumerator.moveNext()) {
              if (((Record2_0) inputEnumerator.current()).X > 1) {
                return true;
              }
            }
            return false;
          }
          public void close() {
            inputEnumerator.close();
          }
          public Object current() {
            return ((Record2_0) inputEnumerator.current()).X;
          }
        };
    }
  };
  return child0.union(child1);
}

public Class getElementType() {
  return int.class;
}


at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
at
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:108)
at
org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1254)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:331)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:781)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:640)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:610)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
at
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
at
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
... 29 more
Caused by: java.lang.RuntimeException: while compiling CalciteProgram211242
at
org.apache.calcite.util.javac.JaninoCompiler.compile(JaninoCompiler.java:83)
at
org.apache.calcite.adapter.spark.SparkHandlerImpl.compile(SparkHandlerImpl.java:128)
at
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:103)
... 39 more
Caused by: java.lang.ClassNotFoundException: File
'CalciteProgram211242.java', Line 84, Column 8: No applicable
constructor/method found for actual parameters "int, java.lang.String";
candidates are: "CalciteProgram211242$Record2_0()"
at
org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:226)
at
org.apache.calcite.util.javac.JaninoCompiler$AccountingClassLoader.generateBytecodes(JaninoCompiler.java:160)
at
org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at
org.apache.calcite.util.javac.JaninoCompiler.compile(JaninoCompiler.java:81)
... 41 more
Caused by: org.codehaus.commons.compiler.CompileException: File
'CalciteProgram211242.java', Line 84, Column 8: No applicable
constructor/method found for actual parameters "int, java.lang.String";
candidates are: "CalciteProgram211242$Record2_0()"
at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10092)
at
org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:7506)
at
org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:6452)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:4103)
at org.codehaus.janino.UnitCompiler.access$7600(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$10.visitNewClassInstance(UnitCompiler.java:3263)
at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:4085)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:3278)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4345)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4303)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:4279)
at org.codehaus.janino.UnitCompiler.access$7500(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$10.visitNewInitializedArray(UnitCompiler.java:3262)
at org.codehaus.janino.Java$NewInitializedArray.accept(Java.java:4263)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:3278)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4345)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3952)
at org.codehaus.janino.UnitCompiler.access$6900(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$10.visitMethodInvocation(UnitCompiler.java:3251)
at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:3974)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:3278)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4345)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1835)
at org.codehaus.janino.UnitCompiler.access$2000(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$4.visitLocalVariableDeclarationStatement(UnitCompiler.java:943)
at
org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:2508)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:956)
at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:997)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2283)
at
org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:820)
at
org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:792)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:505)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:391)
at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:183)
at
org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:345)
at
org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1139)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:352)
at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:320)
at
org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:224)
... 46 more

Reply via email to