Quoted Identifiers in Column Names
Quoted identifiers in the names of table columns are supported in Hive 0.13 and later. An identifier in SQL is a sequence of
alphanumeric and underscore (_) characters surrounded by backtick (`) characters. Quoted identifiers in Hive are case-insensitive. In the following example,
`x+y`
and `a?b`
are valid column names for a new table.
CREATE TABLE test (`x+y` String, `a?b` String);
Quoted identifiers can be used anywhere a column name is expected, including table partitions and buckets:
CREATE TABLE partition_date-1 (key string, value string) PARTITIONED BY (`dt+x` date, region int); CREATE TABLE bucket_test(`key?1` string, value string) CLUSTERED BY (`key?1`) into 5 buckets;
Note | |
---|---|
Use a backtick character to escape a backtick character ( ``). |
Enabling Quoted Identifiers
Set the hive.support.quoted.identifiers
configuration parameter
to column
in the hive-site.xml
file to enable
quoted identifiers in SQL column names. For Hive 0.13, the valid values are
none
and column
.
hive.support.quoted.identifiers = column