calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hongze Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CALCITE-3046) CompileException when inserting casted value of composited user defined type
Date Thu, 02 May 2019 05:44:00 GMT
Hongze Zhang created CALCITE-3046:
-------------------------------------

             Summary: CompileException when inserting casted value of composited user defined
type
                 Key: CALCITE-3046
                 URL: https://issues.apache.org/jira/browse/CALCITE-3046
             Project: Calcite
          Issue Type: Bug
            Reporter: Hongze Zhang


Reproduce the error by running following test case from {{ServerTest.java}}:

{code:java}
  @Test public void testInsertCastedValueOfCompositeUdt() throws Exception {
    try (Connection c = connect();
         Statement s = c.createStatement()) {
      // CALCITE-2464: Allow to set nullability for columns of structured types
      boolean b = s.execute("create type mytype as (i int, j int)");
      assertThat(b, is(false));
      b = s.execute("create table w (i int not null, j mytype)");
      assertThat(b, is(false));
      int x = s.executeUpdate("insert into w "
          + "values (1, cast((select j from w) as mytype))");
      assertThat(x, is(1));
    }
  }
{code}

Root cause of the error:

{code}
Caused by: org.codehaus.commons.compiler.CompileException: Line 96, Column 84: Cannot determine
simple type name "Record2_0"
	at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
	at org.codehaus.janino.UnitCompiler.getReferenceType(UnitCompiler.java:6833)
	at org.codehaus.janino.UnitCompiler.getReferenceType(UnitCompiler.java:6594)
	at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:6573)
	at org.codehaus.janino.UnitCompiler.access$13900(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$22$1.visitReferenceType(UnitCompiler.java:6481)
	at org.codehaus.janino.UnitCompiler$22$1.visitReferenceType(UnitCompiler.java:6476)
	at org.codehaus.janino.Java$ReferenceType.accept(Java.java:3928)
	at org.codehaus.janino.UnitCompiler$22.visitType(UnitCompiler.java:6476)
	at org.codehaus.janino.UnitCompiler$22.visitType(UnitCompiler.java:6469)
	at org.codehaus.janino.Java$ReferenceType.accept(Java.java:3927)
	at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:6469)
	at org.codehaus.janino.UnitCompiler.access$1300(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$36.getParameterTypes2(UnitCompiler.java:10383)
	at org.codehaus.janino.IClass$IInvocable.getParameterTypes(IClass.java:960)
	at org.codehaus.janino.IClass$IMethod.getDescriptor2(IClass.java:1227)
	at org.codehaus.janino.IClass$IInvocable.getDescriptor(IClass.java:983)
	at org.codehaus.janino.IClass.getIMethods(IClass.java:248)
	at org.codehaus.janino.IClass.getIMethods(IClass.java:237)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:492)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:981)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:951)
	at org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:409)
	at org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:406)
	at org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1149)
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406)
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5509)
	at org.codehaus.janino.UnitCompiler.access$9500(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4432)
	at org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4396)
	at org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5238)
	at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396)
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662)
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5182)
	at org.codehaus.janino.UnitCompiler.access$9100(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$16.visitMethodInvocation(UnitCompiler.java:4423)
	at org.codehaus.janino.UnitCompiler$16.visitMethodInvocation(UnitCompiler.java:4396)
	at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:5073)
	at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396)
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2580)
	at org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1503)
	at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1487)
	at org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3522)
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
	at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567)
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3388)
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1357)
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1330)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:822)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:432)
	at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:411)
	at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:406)
	at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1414)
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406)
	at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:378)
	at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:237)
	at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:465)
	at org.codehaus.janino.ClassBodyEvaluator.compileToClass(ClassBodyEvaluator.java:313)
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:235)
	at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:207)
	at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:50)
	at org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:347)
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:162)
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:125)
	... 37 more
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message