Hive外部表位于Phoenix之上,如下所示
create External table TABLE_NAME (
rowKey STRING,
unique_id string,
USERNAME string,
DAY string,
MONTH string,
YEAR string,
APPID INT)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES
("hbase.columns.mapping" = "
details:unique_id,
details:USERNAME,
details:DAY,
details:MONTH,
details:YEAR,
details:APPID")
TBLPROPERTIES
("hbase.table.name"="HBAE_TABLE_NAME");
当我将数据加载到hive外部表并尝试从Phoenix表访问APPID(整数列)时,我得到以下错误。 问题只有Integer列,其余所有我都可以访问。当我从hive表访问时,数据看起来很好。
java.lang.RuntimeException: java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 4 bytes, but had 2
at sqlline.IncrementalRows.hasNext(IncrementalRows.java:73)
at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
at sqlline.SqlLine.print(SqlLine.java:1653)
at sqlline.Commands.execute(Commands.java:833)
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)
我真的很感激任何帮助!
答案 0 :(得分:0)
将每个hive表列设为 string ,并在phoenix视图中将每列设为 varchar 。问题将得到解决。 Phoenix支持Integer,Date等,但是bug仍然是开放的,所以如果你想使用phoenix将一切转换为string和varchar。它适用于Phoenix 4.4.0