我正在尝试使用localhost:2181上的zookeeper访问在本地计算机上运行的hbase。我安装了phoenix-3.3.1-bin,并尝试访问一个已经存在的hbase Tabe,但无法访问。因此,仅出于测试目的,我使用phoenix命令行创建了一个表,并在运行!tables命令时查看该表。但是当我运行selet命令时,它显示错误。

这就是我正在做的事情,我正在使用hbase-0.94.26 mac。 squirrel-sql客户端也会发生同样的事情。

0:jdbc:phoenix:localhost> CREATE TABLE stats.prod_metrics(host char(50)not null,created_date date not null,

。 。 。 。 。 。 。 。 。 。 。 。 。> txn_count bigint CONSTRAINT pk PRIMARY KEY(host,created_date));

没有受影响的行(1.82秒)

0:jdbc:phoenix:localhost>!表

+ ------------------------------------------ + ------ ------------------------------------ + ------------- ----------------------------- + -------------------- ------- +

| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE |

+ ------------------------------------------ + ------ ------------------------------------ + ------------- ----------------------------- + -------------------- ------- +

| |系统|产品目录系统表|

| |系统|序列|系统表|

| |系统|统计系统表|

| |统计PROD_METRICS |表格|

+ ------------------------------------------ + ------ ------------------------------------ + ------------- ----------------------------- + -------------------- ------- +

0:jdbc:phoenix:localhost>从PROD_METRICS中选择*;

Error: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS (state=42M03,code=1012)
org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS
    at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:336)
    at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:236)
    at org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:159)
    at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:318)
    at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:308)
    at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225)
    at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:221)
    at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:54)
    at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:221)
    at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1059)
    at sqlline.Commands.execute(Commands.java:822)
    at sqlline.Commands.sql(Commands.java:732)
    at sqlline.SqlLine.dispatch(SqlLine.java:808)
    at sqlline.SqlLine.begin(SqlLine.java:681)
    at sqlline.SqlLine.start(SqlLine.java:398)
    at sqlline.SqlLine.main(SqlLine.java:292)

最佳答案

如果在HBase中使用小写字母创建了表,则需要将表名括在引号中。否则,Phoenix会将表名转换为大写,并且找不到您的表。

关于java - Phoenix 错误:hbase表未定义,即使存在,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31725355/

10-15 13:32