如何在结构类型列中使用“ @”创建配置单元表?

时间:2018-12-06 05:19:05

标签: hadoop hive

hive creata sql:
CREATE EXTERNAL TABLE仓库. aaa ( 属性struct< sk @ aaa :string > ) PARTITIONED BY ( dt string) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' WITH SERDEPROPERTIES ( 'serialization.format' = '1' ) STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' LOCATION 'hdfs://.....';

错误消息:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.IllegalArgumentException: Error: : expected at the position 9 of 'struct<sk@aaa:string>' but '@' is found

如何在结构列中使用@创建配置单元表?

1 个答案:

答案 0 :(得分:1)

对于HBase 0.13和更高版本,如果有特殊字符,则可以使用反引号。

struct<`sk@aaa`:string>

有关更多详细信息,请参阅文档: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Select

In Hive 0.12 and earlier, only alphanumeric and underscore characters are allowed in table and column names.
In Hive 0.13 and later, column names can contain any Unicode character (see HIVE-6013). Any column name that is specified within backticks (`) is treated literally. Within a backtick string, use double backticks (``) to represent a backtick character.
To revert to pre-0.13.0 behavior and restrict column names to alphanumeric and underscore characters, set the configuration property hive.support.quoted.identifiers to none. In this configuration, backticked names are interpreted as regular expressions. For details, see Supporting Quoted Identifiers in Column Names (attached to HIVE-6013). Also see REGEX Column Specification below.