我正在尝试使用localhost:2181上的zookeeper来访问我在本地机器上运行的hbase。我安装了phoenix-3.3.1-bin,并试图访问已经存在的hbase tabe,但无法访问。因此,为了进行简单的测试,我使用phoenix命令行创建了一个表,并在运行!tables命令时看到它。但是当我运行selet命令时,它显示错误。
这就是我正在做的事情,我使用的是mac,hbase-0.94.26。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) );
No rows affected (1.82 seconds)
0: jdbc:phoenix:localhost> !tables
+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE |
+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+
| | SYSTEM | CATALOG | SYSTEM TABLE |
| | SYSTEM | SEQUENCE | SYSTEM TABLE |
| | SYSTEM | STATS | SYSTEM TABLE |
| | STATS | PROD_METRICS | TABLE |
+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+
0: jdbc:phoenix:localhost> select * from 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)发布于 2016-02-10 14:09:10
如果您在HBase中使用小写字母创建了表,则需要用引号将表名括起来。否则,Phoenix会将表名转换为大写,它将找不到您的表。
发布于 2015-07-31 18:50:47
Phoenix表(和视图)是经过特殊“装饰”的hbase表。也就是说,它们具有附加的协处理器和一些额外的元数据块,而且它们在Phoenix系统目录中注册,而普通hbase表没有。所以所有的Phoenix表都是hbase表,但hbase表不一定是Phoenix表。
发布于 2017-01-25 18:14:01
我也面临着同样的问题。这是由于不同版本的phoneix-client.jar和服务器造成的。
https://stackoverflow.com/questions/31725355
复制相似问题