0

我正在尝试使用 localhost:2181 的 zookeeper 访问在本地机器上运行的 hbase。我安装了 phoenix-3.3.1-bin 并尝试访问已经存在的 hbase 表,但不能。所以,只是为了测试,我使用 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)
4

3 回答 3

7

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

于 2016-02-10T06:09:09.950 回答
1

Phoenix 表(和视图)是特别“装饰”的 hbase 表。即它们附加了协处理器和一些额外的元数据,而且它们在 Phoenix 系统目录中注册,而普通的 hbase 表没有。所以所有的 Phoenix 表都是 hbase 表,但是 hbase 表不一定是 Phoenix 表。

于 2015-07-31T10:50:46.963 回答
0

我也面临同样的问题。这是由于 phoneix-client.jar 的版本与服务器不同。

于 2017-01-25T10:14:01.213 回答