我正在尝试通过phoenix脚本创建的HBase表之上创建Hive外部表。
如果HBase中的列值为“ true”,我希望将其填充到Hive中,否则为1,否则为0。如何实现此目的?
我尝试使用 case..when 表达式,同时尝试创建如下的Hive外部表。没用请指教。谢谢!
CREATE external TABLE hiveExtTables.hiveExtTestTable (rowkey STRING,
COLFAMILY_app_id STRING,
COLFAMILY_app_name STRING)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,
CASE WHEN COLFAMILY:app_id='true' THEN 1
WHEN COLFAMILY:app_id='false' THEN 0
ELSE COLFAMILY:app_id END AS COLFAMILY:app_id,
COLFAMILY:app_name) TBLPROPERTIES ( 'hbase.table.name' = 'HBASE_TEST_TABLE');