[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2

2018-04-18 Thread Piotr Bojko (JIRA)

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

Piotr Bojko commented on CALCITE-1993:
--

[~julianhyde] are you ok with closing this issue?

> 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
>Priority: Major
>
> 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
(v7.6.3#76005)


[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2

2018-04-13 Thread Piotr Bojko (JIRA)

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

Piotr Bojko commented on CALCITE-1993:
--

This isssue can be closed. All works as desired. I've not interpreted 
JdbcSchema.create params properly.

> 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
>Priority: Major
>
> 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
(v7.6.3#76005)


[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2

2017-10-02 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1993:
--

Thanks for letting us know. This may help people find a workaround if they see 
similar symptoms.

I still consider this a bug; we should do better than throw a 
NullPointerException if someone gives the wrong schema name when they connect.

> 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)


[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2

2017-10-02 Thread Piotr Bojko (JIRA)

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

Piotr Bojko commented on CALCITE-1993:
--

After messing with code, I've found that such snippet work


{code:java}
this.schema = JdbcSchema.create(connection.getRootSchema(), 
"JIRA", datasource, null, null);
connection.getRootSchema().add("JIRA", schema);
{code}


> 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)


[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2

2017-09-29 Thread Piotr Bojko (JIRA)

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

Piotr Bojko commented on CALCITE-1993:
--


{noformat}
[INFO] [talledLocalContainer]   private final java.util.List relClasses;
[INFO] [talledLocalContainer]   public final 
org.apache.calcite.rel.metadata.RelMdCollation provider0;
[INFO] [talledLocalContainer]   public 
GeneratedMetadataHandler_Collation(java.util.List relClasses,
[INFO] [talledLocalContainer]   
org.apache.calcite.rel.metadata.RelMdCollation provider0) {
[INFO] [talledLocalContainer] this.relClasses = relClasses;
[INFO] [talledLocalContainer] this.provider0 = provider0;
[INFO] [talledLocalContainer]   }
[INFO] [talledLocalContainer]   public 
org.apache.calcite.rel.metadata.MetadataDef getDef() {
[INFO] [talledLocalContainer] return 
org.apache.calcite.rel.metadata.BuiltInMetadata$Collation.DEF;
[INFO] [talledLocalContainer]   }
[INFO] [talledLocalContainer]   public com.google.common.collect.ImmutableList 
collations(
[INFO] [talledLocalContainer]   org.apache.calcite.rel.RelNode r,
[INFO] [talledLocalContainer]   
org.apache.calcite.rel.metadata.RelMetadataQuery mq) {
[INFO] [talledLocalContainer] final java.util.List key = 
org.apache.calcite.runtime.FlatLists.of(org.apache.calcite.rel.metadata.BuiltInMetadata$Collation.DEF,
 r);
[INFO] [talledLocalContainer] final Object v = mq.map.get(key);
[INFO] [talledLocalContainer] if (v != null) {
[INFO] [talledLocalContainer]   if (v == 
org.apache.calcite.rel.metadata.NullSentinel.ACTIVE) {
[INFO] [talledLocalContainer] throw 
org.apache.calcite.rel.metadata.CyclicMetadataException.INSTANCE;
[INFO] [talledLocalContainer]   }
[INFO] [talledLocalContainer]   return 
(com.google.common.collect.ImmutableList) v;
[INFO] [talledLocalContainer] }
[INFO] [talledLocalContainer] 
mq.map.put(key,org.apache.calcite.rel.metadata.NullSentinel.ACTIVE);
[INFO] [talledLocalContainer] try {
[INFO] [talledLocalContainer]   final 
com.google.common.collect.ImmutableList x = collations_(r, mq);
[INFO] [talledLocalContainer]   mq.map.put(key, x);
[INFO] [talledLocalContainer]   return x;
[INFO] [talledLocalContainer] } catch (java.lang.Exception e) {
[INFO] [talledLocalContainer]   mq.map.remove(key);
[INFO] [talledLocalContainer]   throw e;
[INFO] [talledLocalContainer] }
[INFO] [talledLocalContainer]   }
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer]   private com.google.common.collect.ImmutableList 
collations_(
[INFO] [talledLocalContainer]   org.apache.calcite.rel.RelNode r,
[INFO] [talledLocalContainer]   
org.apache.calcite.rel.metadata.RelMetadataQuery mq) {
[INFO] [talledLocalContainer] switch (relClasses.indexOf(r.getClass())) {
[INFO] [talledLocalContainer] default:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.RelNode) r, mq);
[INFO] [talledLocalContainer] case 2:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.plan.volcano.RelSubset) r, mq);
[INFO] [talledLocalContainer] case 3:
[INFO] [talledLocalContainer]   return 
collations(((org.apache.calcite.plan.hep.HepRelVertex) r).getCurrentRel(), mq);
[INFO] [talledLocalContainer] case 10:
[INFO] [talledLocalContainer] case 25:
[INFO] [talledLocalContainer] case 34:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.core.Filter) r, mq);
[INFO] [talledLocalContainer] case 14:
[INFO] [talledLocalContainer] case 26:
[INFO] [talledLocalContainer] case 38:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.core.Project) r, mq);
[INFO] [talledLocalContainer] case 15:
[INFO] [talledLocalContainer] case 39:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.core.Sort) r, mq);
[INFO] [talledLocalContainer] case 18:
[INFO] [talledLocalContainer] case 28:
[INFO] [talledLocalContainer] case 42:
[INFO] [talledLocalContainer] case 51:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.core.TableScan) r, mq);
[INFO] [talledLocalContainer] case 20:
[INFO] [talledLocalContainer] case 44:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.core.Values) r, mq);
[INFO] [talledLocalContainer] case 21:
[INFO] [talledLocalContainer] case 45:
[INFO] [talledLocalContainer]   return 
provider0.collations((org.apache.calcite.rel.core.Window) r, mq);
[INFO] [talledLocalContainer] case -1:
[INFO] [talledLocalContainer]   throw new 
org.apache.calcite.rel.metadata.JaninoRelMetadataProvider$NoHandler(r.getClass());
[INFO] [talledLocalContainer] }
[INFO] [talledLocalContainer]   }
[INFO] [talledLocalContainer] 

[jira] [Commented] (CALCITE-1993) Possible bug - NPE when using H2

2017-09-29 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-1993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)