phoenix:
1.表/字段名要加双引号。
2.不加双引号,默认英文单词,创建的表/字段为大写。
3.select 字段的时候要加单引号
select * from "aaa" where "name" = 'zys'
等价于
select * from AAA where NAME = 'zys'
4.联动hbase, hbase int用phoenix bigint类型,直接用代码操作hbase存int类型(正负数),
会导致在phoenix select * from tb 操作读不出来数据,报错"字段长度不够"
那是因为你用hbase存数据的时候要调用phoenix的toBytes方法存才行,hbase自身的toBytes不行.
总而言之,你要保证hbase存的数字也是byte类型的,建议用phoenix的tobyte转换数字再存hbase。
其实更好的做法是,操作phoenix来存int类型的数据。
参考:
https://stackoverflow.com/questions/36131091/phoenix-doesnt-display-negative-integer-values-correctly
https://stackoverflow.com/questions/52829944/apache-phoenix-illegal-data-exception
5.如果你要联动presto,不要打开命名空间的配置。(phoenix.schema.isNamespaceMappingEnabled -> false)
6.sqlline sdk 必须和 hbase sdk对应上,才能连接!!!如果创建了部分这些表,然后报错,手动在hbase清掉(disable+drop),再重连,重创建
SYSTEM:
hbase-presto-phoenix遇到的坑
最新推荐文章于 2023-05-24 08:54:32 发布