[ 
https://issues.apache.org/jira/browse/CALCITE-1952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16140572#comment-16140572
 ] 

Julian Hyde commented on CALCITE-1952:
--------------------------------------

I added a test case in 
http://git-wip-us.apache.org/repos/asf/calcite/commit/210fa866.

> Apache Calcite 1.13.0 produced null pointer exception compared to 1.12.0
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-1952
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1952
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.13.0
>         Environment: Windows 7
> Java 8
> Maven
> IntelliJ
>            Reporter: Mark Ashworth
>            Assignee: Julian Hyde
>            Priority: Minor
>             Fix For: 1.14.0
>
>
> 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.
> {code}
> 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));
>     }
> {code}
> And the exception is as follows:-
> {noformat}
> 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)
> {noformat}
> Below is the files.json
> {code}
> {
>   "version": "1.0",
>   "defaultSchema": "XXX",
>   "schemas": [
>     {
>       "name": "FILES",
>       "type": "custom",
>       "factory": "org.apache.calcite.adapter.file.FileSchemaFactory",
>       "operand": {
>         "directory": "files"
>       }
>     }
>   ]
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to