Escaping an invalid identifier
When you need to use reserved words, special characters, or a space in a column or partition name, enclose it in backticks (`).
An identifier in SQL is a sequence of alphanumeric and underscore (_) characters enclosed in backtick characters. In Hive, these identifiers are called quoted identifiers and are case-insensitive. You can use the identifier instead of a column or table partition name.
columnin the hive-site.xml file to enable quoted identifiers:
configuration parameter to
column in the hive-site.xml
file to enable quoted identifiers in column names. Valid values are
column. For example, in Hive execute the following command:
hive.support.quoted.identifiers = column.
Create a table named test that has two columns of strings specified by quoted
CREATE TABLE test (`x+y` String, `a?b` String);
Create a table that defines a partition using a quoted identifier and a region
CREATE TABLE partition_date-1 (key string, value string) PARTITIONED BY (`dt+x` date, region int);
Create a table that defines clustering using a quoted identifier:
CREATE TABLE bucket_test(`key?1` string, value string) CLUSTERED BY (`key?1`) into 5 buckets;