6. Hive 0.13 Feature: Quoted Identifiers in Column Names

Hive 0.13 introduced 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. 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; 

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