当使用Java通过凤凰查询Hbase时,遇到以下问题: 我的连接正常,因此我可以使用以下查询从SYSTEM.CATALOG获取所有数据:
SELECT * FROM SYSTEM.CATALOG
它给我的结果是:
TENANT_ID TABLE_SCHEM TABLE_NAME ...
null DEVLOCAL BASE_COMMENTS ...
null SYSTEM CATALOG ...
null g edges ...
null g messages ...
...
我猜g.edge确实存在,所以我尝试:
Select * from g.edges
问题从这里开始:
Exception in thread "main" org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=G.EDGES
at org.apache.phoenix.query.ConnectionQueryServicesImpl.getAllTableRegions(ConnectionQueryServicesImpl.java:575)
at org.apache.phoenix.iterate.DefaultParallelScanGrouper.getRegionBoundaries(DefaultParallelScanGrouper.java:72)
at org.apache.phoenix.iterate.BaseResultIterators.getRegionBoundaries(BaseResultIterators.java:529)
at org.apache.phoenix.iterate.BaseResultIterators.getParallelScans(BaseResultIterators.java:696)
at org.apache.phoenix.iterate.BaseResultIterators.getParallelScans(BaseResultIterators.java:627)
at org.apache.phoenix.iterate.BaseResultIterators.<init>(BaseResultIterators.java:499)
at org.apache.phoenix.iterate.ParallelIterators.<init>(ParallelIterators.java:62)
at org.apache.phoenix.execute.ScanPlan.newIterator(ScanPlan.java:242)
at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:351)
at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:212)
at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:207)
at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:202)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:310)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:290)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:289)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:1706)
at HbaseDataProvider.query(HbaseDataProvider.java:29)
at Main.main(Main.java:10)
... G.EDGES不存在。我尝试不大写的“ g”。“ edges”,但仍然给我这样的错误 如果我误解了什么,请给我一个主意或告诉我。 谢谢!
答案 0 :(得分:0)
哦,我解决了我的问题。那是由于缺乏凤凰造成的。实际上,apache phoenix不会自动从hbase同步其元数据,因此,如果您具有使用hbase shell创建的表,则必须首先在phoenix中创建具有相同表名,模式名的表,以便phoenix可以从hbase同步元数据。我的错是我没有仔细阅读文档。 这里是参考:https://phoenix.apache.org/faq.html