Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1952

Apache Calcite 1.13.0 produced null pointer exception compared to 1.12.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.13.0
    • 1.14.0
    • core
    • None
    • Windows 7
      Java 8
      Maven
      IntelliJ

    Description

      Using Apache Calcite on Windows and trying to query the DEPTS.csv used on the website tutorial I get a NullPointerException when using Calcite Core 1.13.0 but when I use 1.12.0 the issue disappears.

      Properties info = new Properties();
          info.put("model",  "../src/test/resources/files.json");
          info.setProperty("lex", "JAVA");
      
          Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
          Statement stmt = connection.createStatement();
      
          String sql = "select * from FILES.DEPTS"; 
          ResultSet rs = stmt.executeQuery(sql);
          while(rs.next()) {
              System.out.println(rs.getString(1));
          }
      

      And the exception is as follows:-

      java.sql.SQLException: Error while executing SQL "select * from FILES.DEPTS": null
        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 za.co.bb8.CalciteTests.testConnection(CalciteTests.java:24)
        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.NullPointerException
        at org.apache.calcite.plan.volcano.VolcanoPlanner.validate(VolcanoPlanner.java:891)
        at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:866)
        at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:883)
        at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:101)
        at org.apache.calcite.rel.AbstractRelNode.onRegister(AbstractRelNode.java:336)
        at org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1496)
      

      Below is the files.json

      {
        "version": "1.0",
        "defaultSchema": "XXX",
        "schemas": [
          {
            "name": "FILES",
            "type": "custom",
            "factory": "org.apache.calcite.adapter.file.FileSchemaFactory",
            "operand": {
              "directory": "files"
            }
          }
        ]
      }
      

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              mpashworth Mark Ashworth
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: