无法通过phoenix从hbase上的现有表读取数据

pu3pd22g  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(542)

当使用java通过phoenix查询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”来代替大写字母,但是仍然给我这样的错误,请给我一个想法,如果我误解了什么,请告诉我。谢谢您!

ctrmrzij

ctrmrzij1#

哦,我解决了我的问题。那是因为没有Phoenix城。实际上,apachephoenix并不是从hbase自动同步元数据的,因此如果您使用hbase shell创建了表,那么首先必须在phoenix中创建具有相同表名(schema name)的表,以便phoenix可以从hbase同步元数据。我的错是我没有仔细阅读文件。参考资料如下:https://phoenix.apache.org/faq.html

相关问题