Hive 0.13 allows the use of quoted identifiers in
the names of table columns. An identifier in SQL is a sequence of alphanumeric and
underscore characters surrounded by backtick characters. 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 | |
---|---|
Identifiers are case-insensitive. |
Note | |
---|---|
Use a backtick character to escape a backtick character
( |
Enabling Quoted Identifiers
Set the hive.support.quoted.identifiers
configuration parameter to
column
in hive-site.xml
to enable quoted
identifiers in SQL column names. For Hive 0.13, the valid values are none
and column
.
hive.support.quoted.identifiers = column