如何在结构类型列中创建带有'@'的Hive表?



配置单元创建sql:
CREATE EXTERNAL TABLE仓库.aaa( 属性struct< sk@aaa:string > ) PARTITIONED BY (dtstring) 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

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

在HBase 0.13及更高版本中出现特殊字符的情况下,可以使用倒勾号。

struct<`sk@aaa`:string>

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

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.

最新更新