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

In Hive ,how to specify semi-column delimiters for struct data types with in custom delimiters serde2

我正在尝试创建 table,如下所示。

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"="@"
    );

我在创建 table 时遇到如下错误

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)

有人可以帮忙吗?

尝试使用 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 字符创建了 table 并检查下面的 collection.delim 是 ;:

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