用十六进制分隔Hive CsvSerde表 [英] Delimit Hive CsvSerde Table on Hexadecimal

查看:351
本文介绍了用十六进制分隔Hive CsvSerde表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用由十六进制值1F分隔的csvserde创建一个外部配置单元表。 csvserde在分隔的常规逗号上正常工作。

  CREATE EXTERNAL TABLE example_table(
id bigint,
property_id字符串,
application_date日期,
system_time时间戳,
system_end时间戳

ROW FORMAT SERDE'org.apache.hadoop.hive.serde2。 OpenCSVSerde'
WITH SERDEPROPERTIES(
separatorChar=\1F

STORED AS
TEXTFILE
LOCATION'/ user / nameofdirectory'


解决方案

seperatorChar应以八进制值表示。

在这种情况下,分隔符是1f(十六进制)(相当于31十进制)。



在八进制中,它是037.因此,seperatorChar应该是\037


I am trying to create an external hive table off a directory of files using csvserde that is delimited by the hexadecimal value 1F. The csvserde works fine on regular comma delimited. I am not sure how to express the hexadecimal value in the seperator.

CREATE EXTERNAL TABLE example_table(
id bigint,
property_id string,
application_date date,
system_time timestamp,
system_end timestamp
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES(
"separatorChar" = "\1F"
)
STORED AS
TEXTFILE
LOCATION '/user/nameofdirectory' 

解决方案

The seperatorChar should be expressed in octal value.

In this case the delimiter was 1f in hexadecimal (31 decimal equivalent).

In octal, it is 037. So the seperatorChar should be "\037"

这篇关于用十六进制分隔Hive CsvSerde表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆