JDBC 和 Hive 查询错误 10 或 9

JDBC and Hive query error 10 or 9

5 月,我创建了一个 Java servlet,它允许我在 Cosmos 上查询我的配置单元 tables。

在迁移到 cygnus 0.8.2 之前,我的数据被推送到一个名为 "hostabee" 的 table,我仍然可以从我的 Java 应用程序中查询它。但是现在为每个推送到 cosmos 的实体自动创建一个 table 。起初,我没有发现任何问题,这甚至让我的项目变得更简单。但是我无法从我的应用程序中查询新的 tables。相反,我收到此错误

java.sql.SQLException: Query returned non-zero code: 10, cause: FAILED: Error in semantic analysis: Line 1:15 Table not found 'guillaume_jourdain_hostabee_hives_a_hive_column'
        at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:194)
        at HiveBasicClientServlet.doQuery(HiveBasicClientServlet.java:100)
        at HiveBasicClientServlet.demo(HiveBasicClientServlet.java:189)
        at HiveBasicClientServlet.doGet(HiveBasicClientServlet.java:44)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:701)

或者这个

java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code -101 from shark.execution.SparkTask
        at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:194)
        at HiveBasicClientServlet.doQuery(HiveBasicClientServlet.java:100)
        at HiveBasicClientServlet.demo(HiveBasicClientServlet.java:189)
        at HiveBasicClientServlet.doGet(HiveBasicClientServlet.java:44)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:701)

table "guillaume_jourdain_hostabee_hives_a_hive_column" 存在,我可以使用 ssh 连接从配置单元查询它。你知道我的问题是从哪里来的吗?如有必要,我可以向您展示我的部分代码。

出现以下错误:

Error in semantic analysis: Line 1:15 Table not found 'guillaume_jourdain_hostabee_hives_a_hive_column'

不是因为 Cygnus 0.8.2,而是因为我们在 FIWARE 实验室使用我们的 Cosmos 全局实例时遇到的罕见行为。幸运的是,通过在 table 名称前加上默认数据库名称(default :))可以很容易地解决这个问题。 IE。如果你有类似的东西:

select * from mytable;

现在你必须写:

select * from default.mytable;