在配置单元中,如何使用自定义分隔符serde2为结构数据类型指定半列分隔符

avkwfej4  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(392)

我试图创建如下表。

CREATE TABLE r_test (foo INT, bar STRING, address  STRUCT<street:STRING, city:STRING, state:STRING, zip:INT>)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe'
WITH SERDEPROPERTIES (
"field.delim"="<=>",
"collection.delim"="\;",
"mapkey.delim"="@"
    );

我在创建的表中遇到如下错误

Error: Error while compiling statement: FAILED: ParseException line 5:25 mismatched input '<EOF>' expecting StringLiteral near '=' in specifying key/value property (state=42000,code=40000)

有人能帮忙吗?

w80xi6nr

w80xi6nr1#

尝试使用unicode字符作为分号,即\u003b

hive> CREATE TABLE r_test (foo INT, bar STRING, address  STRUCT<street:STRING, city:STRING, state:STRING, zip:INT>)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe'
WITH SERDEPROPERTIES (
"field.delim"="<=>",
"collection.delim"="\u003B",
"mapkey.delim"="@"
    );

我用unicode字符创建了表,并检查collection.delim是;下图:

hive> desc formatted r_test;
    | Storage Desc Params:| NULL                 | NULL                        |
    |                     | collection.delim     | ;                           |
    |                     | field.delim          | <=>                         |
    |                     | mapkey.delim         | @                           |
    |                     | serialization.format | 1                           |

相关问题