简体   繁体   English

Hive:当插入分区表时,在大多数行中,hive double url-encode分区键列

[英]Hive: When insert into partitioned table, in most of the rows, hive double url-encode the partition key column

I created a partitioned table: 我创建了一个分区表:

create table  t1 ( amount double) partitioned by ( events_partition_key string) stored as paquet;

added some data to tmp_table, where column 'events_partition_key' contains timestamp (string type) in the following format: "2018-02-25 00:00:00" 向tmp_table添加了一些数据,其中'events_partition_key'列包含以下格式的时间戳(字符串类型):“2018-02-25 00:00:00”

Then I insert some data into the partitioned table. 然后我将一些数据插入到分区表中。

insert into table t1 partition (events_partition_key)
select amount, events_partition_key
from tmp_table

when selecting from the new partitioned table t1, in some cases events_partition_key column is presented regularly the same it appeared in tmp_table ie "2018-02-25 00:00:00", but in most cases, it appears URL-encoded, ie "2018-02-25 00%3A00%3A00" 当从新的分区表t1中选择时,在某些情况下,events_partition_key列定期呈现与tmp_table中出现的相同,即“2018-02-25 00:00:00”,但在大多数情况下,它看起来是URL编码的,即“ 2018-02-25 00%3A00%3A00“

这是选择不同的events_partition_key时的样子

In any case, the original column partition_key has no difference in cases where it was URL-encoded or not, 在任何情况下,原始列partition_key在URL编码与否的情况下没有区别,

when showing partitions for the new table: 显示新表的分区时:

show partitions t1;

I got everything URL-encoded twice (ie "2018-02-25 00%253A00%253A00"), but some cases it was only once (ie "2018-02-25 00%3A00%3A00") 我得到了两次URL编码的两次(即“2018-02-25 00%253A00%253A00”),但有些情况只有一次(即“2018-02-25 00%3A00%3A00”)

在此输入图像描述

there is nothing wrong in the original values, only after it has become a partition key. 只有在成为分区键之后,原始值才会出错。

This Jira HIVE-3679 adds hive.decode.partition.name property to the HiveConf.java in release 0.10.0 这个Jira HIVE-3679hive.decode.partition.name属性添加到版本0.10.0中的HiveConf.java

Try to set it true. 尝试将其设置为true。

set hive.decode.partition.name=true;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM