Hive 如何避免细度计内串
首先,如果这个问题很常见,请原谅,我对蜂巢很陌生,正在尝试。我需要在逗号(“,”)delimeter的帮助下将数据插入表列,下面是一个示例条目: 列标题:Hive 如何避免细度计内串,hive,hiveql,Hive,Hiveql,首先,如果这个问题很常见,请原谅,我对蜂巢很陌生,正在尝试。我需要在逗号(“,”)delimeter的帮助下将数据插入表列,下面是一个示例条目: 列标题:名称、状态、位置 样本数据:Arverne,已关闭,“312海滩54街Arverne,NY 11692(40.59428994144626,-73.78442865540268)” 问题是,当我尝试以“,”结尾的字段作为位置时,只能获取”312 Beach 54 Street Arverne,但要求获取 312纽约州阿凡纳54街海滩11692(
名称、状态、位置
样本数据:Arverne,已关闭,“312海滩54街Arverne,NY 11692(40.59428994144626,-73.78442865540268)”
问题是,当我尝试以“,”结尾的字段作为位置时,只能获取”312 Beach 54 Street Arverne,但要求获取
312纽约州阿凡纳54街海滩11692(40.59428994144626,-73.78442865540268)
1.
TBLProperty('serialization.last.column.takes.rest'='true')
2. OpenCSVSerde
默认SerDe属性
create external table library (Name string,status string,location string)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
stored as textfile
;
create external table library (Name string,status string,location string)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
with serdeproperties
(
'separatorChar' = ','
,'quoteChar' = '"'
,'escapeChar' = '\\'
)
stored as textfile
;
显式SerDe属性
create external table library (Name string,status string,location string)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
stored as textfile
;
create external table library (Name string,status string,location string)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
with serdeproperties
(
'separatorChar' = ','
,'quoteChar' = '"'
,'escapeChar' = '\\'
)
stored as textfile
;
逃离qoute。所以“将成为”谢谢@Dudu,感谢你的帮助,它工作顺利
create external table library (Name string,status string,location string)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
stored as textfile
;
select * from library
;
+---------+--------+-------------------------------------------------------------------------------+
| name | status | location |
+---------+--------+-------------------------------------------------------------------------------+
| Arverne | closed | 312 Beach 54 Street Arverne,NY 11692 (40.59428994144626, -73.78442865540268) |
+---------+--------+-------------------------------------------------------------------------------+
create external table library (Name string,status string,location string)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
with serdeproperties
(
'separatorChar' = ','
,'quoteChar' = '"'
,'escapeChar' = '\\'
)
stored as textfile
;
select * from library
;
+---------+--------+-------------------------------------------------------------------------------+
| name | status | location |
+---------+--------+-------------------------------------------------------------------------------+
| Arverne | closed | 312 Beach 54 Street Arverne,NY 11692 (40.59428994144626, -73.78442865540268) |
+---------+--------+-------------------------------------------------------------------------------+