大叔经验分享(106)Impala读取parquet时间字段时区偏移问题

parquet文件中的时间字段,在hive和spark-sql中读取正常,在impala中读取会偏移8个小时(少),经测试结果如下:

一 不修改impala配置

1 由spark或hive写入parquet

  • spark和hive读取正常
  • impala读取偏移8小时(少),需要手工偏移 from_unixtime(unix_timestamp(time) + 28800)

二 修改impala配置

use_local_tz_for_unix_timestamp_conversions=true

convert_legacy_hive_parquet_utc_timestamps=true

1 由spark或hive写入parquet

  • spark和hive读取正常
  • impala读取正常

2 由impala写入parquet

  • spark和hive读取偏移8小时(多)
  • impala读取正常

 

参考:https://docs.cloudera.com/documentation/enterprise/latest/topics/impala_timezone.html

posted @ 2020-06-08 20:44  匠人先生  阅读(1169)  评论(0编辑  收藏  举报