2

我正在尝试创建如下表。

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)

有人可以帮忙吗?

4

1 回答 1

3

尝试使用 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                           |
于 2018-07-14T02:10:33.793 回答