hive:修改列名后查询结果全部变成null

用Hive创建的Parquet格式的表,在重命名表的列名后,查询重名的列数据时显示当前列所有值为NULL。

ALTER TABLE edw.dim_own_info_snp CHANGE userid user_id bigint COMMENT '用户id'

查询结果:

0: jdbc:hive2://hadoopcbd008098.ppdgdsl.com:2> select user_id from edw.dim_own_info_snp where dt='2020-12-28' limit 1;
INFO  : Compiling command(queryId=hive_20201229102317_642a58c9-b99b-4002-a6ac-730e141629bc): select user_id from edw.dim_own_info_snp where dt='2020-12-28' limit 1
INFO  : Semantic Analysis Completed
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:user_id, type:bigint, comment:null)], properties:null)
INFO  : Completed compiling command(queryId=hive_20201229102317_642a58c9-b99b-4002-a6ac-730e141629bc); Time taken: 1.168 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=hive_20201229102317_642a58c9-b99b-4002-a6ac-730e141629bc): select user_id from edw.dim_own_info_snp where dt='2020-12-28' limit 1
INFO  : Completed executing command(queryId=hive_20201229102317_642a58c9-b99b-4002-a6ac-730e141629bc); Time taken: 0.001 seconds
INFO  : OK
+----------+
| user_id  |
+----------+
| NULL     |
+----------+

解决方法:

1.在Hive的当前会话设置parquet.column.index.access=true属性(临时)

set parquet.column.index.access=true;

2.修改表的属性

ALTER TABLE test_parquet SET TBLPROPERTIES ('parquet.column.index.access'='true');

参考:

https://issues.apache.org/jira/browse/HIVE-6938

https://cloud.tencent.com/developer/article/1158315

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值