Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2803

Initializing ToCharFunction with the List<Expression> constructor fails

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.7.0
    • Fix Version/s: 4.8.0
    • Labels:
      None

      Description

      The following test can be used to repro

      @Test
          public void testToCharWithExpressionListConstructor() throws SQLException {
              Connection conn = DriverManager.getConnection(getUrl());
          	String ddl = "create table t (k varchar primary key, v integer[])";
              conn.createStatement().execute(ddl);
              conn.createStatement().executeQuery("select to_char(v[1]) from t");
          }
      

      throws this exception

      java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      	at org.apache.phoenix.expression.function.ScalarFunction.clone(ScalarFunction.java:44)
      	at org.apache.phoenix.expression.visitor.CloneExpressionVisitor.visitLeave(CloneExpressionVisitor.java:106)
      	at org.apache.phoenix.expression.visitor.ReplaceArrayFunctionExpressionVisitor.visitLeave(ReplaceArrayFunctionExpressionVisitor.java:44)
      	at org.apache.phoenix.expression.visitor.CloneExpressionVisitor.visitLeave(CloneExpressionVisitor.java:1)
      	at org.apache.phoenix.expression.function.ScalarFunction.accept(ScalarFunction.java:58)
      	at org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:462)
      	at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:546)
      	at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:496)
      	at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:202)
      	at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:158)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:396)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:1)
      	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:263)
      	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:1)
      	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:257)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:1261)
      	at org.apache.phoenix.end2end.ToCharFunctionIT.testToCharWithExpressionListConstructor(ToCharFunctionIT.java:250)
      	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:497)
      	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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      	at org.apache.phoenix.expression.function.ScalarFunction.clone(ScalarFunction.java:42)
      	... 46 more
      Caused by: java.lang.NullPointerException
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
      	at org.apache.phoenix.expression.function.ToCharFunction.<init>(ToCharFunction.java:66)
      	at org.apache.phoenix.expression.function.ToCharFunction.<init>(ToCharFunction.java:61)
      	... 51 more
      
      

        Attachments

        1. PHOENIX-2803-v3-4.x-HBase-0.98.patch
          12 kB
          Thomas D'Silva
        2. PHOENIX-2803-v2-4.x-HBase-0.98.patch
          12 kB
          Thomas D'Silva
        3. PHOENIX-2803.patch
          5 kB
          Thomas D'Silva

          Issue Links

            Activity

              People

              • Assignee:
                tdsilva Thomas D'Silva
                Reporter:
                tdsilva Thomas D'Silva
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: