You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/09/29 20:34:00 UTC
[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2
[ https://issues.apache.org/jira/browse/CALCITE-1993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16186361#comment-16186361 ]
Julian Hyde commented on CALCITE-1993:
--------------------------------------
I tried to reproduce this, but it's difficult without a jira.PROJECT_KEY table and data. Can you please set system property "calcite.debug" to true (or run with {{-Dcalcite.debug}}), and it will print the generated code (including the Baz.bind method) to stdout.
I saw you (or someone) posted a similar question to stackoverflow. That's not very helpful - now we need to respond in two places.
> Possible bug - NPE when using H2
> --------------------------------
>
> Key: CALCITE-1993
> URL: https://issues.apache.org/jira/browse/CALCITE-1993
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.13.0
> Environment: JIRA Container. Developed code is part of JIRA addon.
> Reporter: Piotr Bojko
> Assignee: Julian Hyde
>
> I've receiving NPE When using Calcite. My code is as follows
> {code:java}
> @Autowired
> public CalciteBootstrap(DatasourceProvider datasourceProvider) throws SQLException {
> this.datasource = datasourceProvider.fetchDatasource();
> log.debug("Datasource fetched - {}", datasource);
> this.connection = createRootSchema();
> this.schema = JdbcSchema.create(connection.getRootSchema(), "PUBLIC", datasource, null, null);
> connection.getRootSchema().add("jira", schema);
> connection.createStatement().executeQuery("select * from jira.PROJECT_KEY");
> }
> private CalciteConnection createRootSchema() {
> try {
> Class.forName("org.apache.calcite.jdbc.Driver");
> Properties info = new Properties();
> info.setProperty("lex", "JAVA");
> Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
> CalciteConnection calciteConnection
> = connection.unwrap(CalciteConnection.class);
> return calciteConnection;
> } catch (SQLException | ClassNotFoundException ex) {
> throw new RuntimeException(ex);
> }
> }
> {code}
> And NPE:
> {noformat}
> [INFO] [talledLocalContainer] java.sql.SQLException: Error while executing SQL "select * from jira.PROJECT_KEY": null
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
> [INFO] [talledLocalContainer] at com.codedoers.jira.smartql.QueryController.request(QueryController.java:23)
> ...
> [INFO] [talledLocalContainer] Caused by: java.lang.NullPointerException
> [INFO] [talledLocalContainer] at Baz.bind(Unknown Source)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:335)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:559)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:550)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:630)
> [INFO] [talledLocalContainer] at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:607)
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
> [INFO] [talledLocalContainer] at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
> [INFO] [talledLocalContainer] ... 240 more
> {noformat}
> I am developing an addon for JIRA, hence the container is JIRA. DB is H2. I am borrowing JIRAs datasource for Calcite.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)