Apache Calcite | Querying data from MongoDB by using Relational algebra -


i able mongodb connection , able node

(logicaltablescan(table=[[enlivendev, collection1]])) 

but when execute node, getting null pointer exception.

complete code:

private void executemongodb(){         final frameworkconfig config = mongoconfig().build();         final relbuilder builder = relbuilder.create(config);         final relnode node =  builder.scan("collection1").build();         system.out.println(reloptutil.tostring(node));           preparedstatement ps = relrunners.run(node);         resultset resultset = ps.executequery(); }     public static frameworks.configbuilder mongoconfig() {             final schemaplus rootschema = frameworks.createrootschema(true);             org.apache.calcite.tools.frameworks.configbuilder configbuilder =frameworks.newconfigbuilder()                     .parserconfig(sqlparser.config.default)                     .defaultschema(                         mongodbconnection.addmongoschema(rootschema, calciteassert.schemaspec.mongo_db))                     .traitdefs((list<reltraitdef>) null)                     .programs(programs.heuristicjoinorder(programs.rule_set, true, 2));             return configbuilder;         } public static schemaplus addmongoschema(schemaplus rootschema, schemaspec schema) {         switch (schema) {         case mongo_db:             return rootschema.add("enlivendev",                     mongoschemafactory.create(rootschema, "192.168.1.01", "enlivendev", 27017, "mgp", "mg1"));         default:             throw new assertionerror("unknown schema " + schema);         }     } 

getting following exception above code,there schema getting null values,while execute relnode of mongo db collection severe: exception while executing query: null java.sql.sqlexception: exception while executing query: null @ org.apache.calcite.avatica.helper.createexception(helper.java:56) @ org.apache.calcite.avatica.helper.createexception(helper.java:41) @ org.apache.calcite.avatica.avaticaconnection.executequeryinternal(avaticaconnection.java:540) @ org.apache.calcite.avatica.avaticapreparedstatement.executequery(avaticapreparedstatement.java:133) @ org.ramyam.eis.core.apachecalcitepoc.processmongodb(apachecalcitepoc.java:106) @ org.ramyam.eis.core.apachecalcitepoc.main(apachecalcitepoc.java:42) caused by: java.lang.nullpointerexception @ org.apache.calcite.schema.schemas.queryable(schemas.java:232) @ baz.bind(unknown source) @ org.apache.calcite.jdbc.calciteprepare$calcitesignature.enumerable(calciteprepare.java:335) @ org.apache.calcite.jdbc.calciteconnectionimpl.enumerable(calciteconnectionimpl.java:294) @ org.apache.calcite.jdbc.calcitemetaimpl._createiterable(calcitemetaimpl.java:559) @ org.apache.calcite.jdbc.calcitemetaimpl.createiterable(calcitemetaimpl.java:550) @ org.apache.calcite.avatica.avaticaresultset.execute(avaticaresultset.java:204) @ org.apache.calcite.jdbc.calciteresultset.execute(calciteresultset.java:67) @ org.apache.calcite.jdbc.calciteresultset.execute(calciteresultset.java:44) @ org.apache.calcite.avatica.avaticaconnection.executequeryinternal(avaticaconnection.java:536)


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -