Exception in using bootstrap-storage-plugins.json file for storage plugin in apache-drill

别说谁变了你拦得住时间么 提交于 2019-12-24 13:19:41

问题


I want to add storage plugins for MongoDB in apache-drill. After reading docs, I came to know that programmatically I can do that in two ways:

  1. Rest API
  2. using bootstrap-storage-plugins.json for configuration

I am using 2nd way for my java code.

Useful portion of my code:

Connection conn = new Driver().connect("jdbc:drill:zk=local",null);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("show databases");
        while (rs.next())
        {
            String SCHEMA_NAME = rs.getString("SCHEMA_NAME");
            System.out.println(SCHEMA_NAME);
        }

bootstrap-storage-plugins.json:

{
  "type": "mongo",
  "connection": "mongodb://localhost:27017/",
  "enabled": true
}

But on firing

"select * from mongo.testDB.`testCollection`";

I got following exception:

org.apache.calcite.sql.validate.SqlValidatorException SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: Table 'mongo.testDB.testCollection' not found Aug 12, 2015 3:47:05 AM org.apache.calcite.runtime.CalciteException SEVERE: org.apache.calcite.runtime.CalciteContextException: From line 1, column 15 to line 1, column 19: Table 'mongo.testDB.testCollection' not found java.sql.SQLException: PARSE ERROR: From line 1, column 15 to line 1, column 19: Table 'mongo.testDB.testCollection' not found

bootstrap-storage-plugins.json is in my classpath. Do I need to provide and additional information?

Edit:

I tried show databases query and it's not showing schemas from MongoDB. It's only showing:

INFORMATION_SCHEMA
cp.default
dfs.default
dfs.root
dfs.tmp
sys 

回答1:


Your query looks like a query on the file system. Using the mongo storage plugin configuration, there's no workspace or file, so try making your query look like this:

SELECT * FROM testCollection;

Make sure you're using the right database name and your and collection is listed (SHOW DATABASES and SHOW TABLES).

This published correction of the Drill doc might help.



来源:https://stackoverflow.com/questions/31962882/exception-in-using-bootstrap-storage-plugins-json-file-for-storage-plugin-in-apa

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!