Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using reserved words in Hive

I'm migrating data to Hive 1.2, and I realized that, by default, I'm no longer allowed to use reserved words as column names. If you want to use reserved words, you need to explicitly set the below setting:

hive.support.sql11.reserved.keywords=false

My question is, does changing this default value result in any unexpected issues? Are there any problems I should be aware of before changing it?

By the way, this change is documented in this ticket: https://issues.apache.org/jira/browse/HIVE-6617

like image 555
Nadine Avatar asked Jan 11 '16 18:01

Nadine


People also ask

How do you escape a reserved keyword in SQL?

To escape reserved keywords in DDL statements, enclose them in backticks (`). To escape reserved keywords in SQL SELECT statements and in queries on views, enclose them in double quotes ('').

Which are the reserved words?

A reserved word is one that "looks like" a normal word, but is not allowed to be used as a normal word. Formally this means that it satisfies the usual lexical syntax (syntax of words) of identifiers – for example, being a sequence of letters – but cannot be used where identifiers are used.

How do you use reserved words in Impala?

A reserved word is one that cannot be used directly as an identifier. If you need to use it as an identifier, you must quote it with backticks.

What is Tblproperties?

The TBLPROPERTIES clause allows you to tag the table definition with your own metadata key/value pairs. Some predefined table properties also exist, such as last_modified_user and last_modified_time which are automatically added and managed by Hive.


1 Answers

This configuration property hive.support.sql11.reserved.keywords was added in Hive 1.2.0 with HIVE-6617 and is removed in Hive 2.3.0 with HIVE-14872

It was removed to simplify parser logic and reduce the size of generated parser code. Please read the description in the HIVE-14872 for more details.

Taking this into account, rewrite your code using quoted identifiers (using backticks) OR rename identifiers the sooner the better.

like image 119
leftjoin Avatar answered Dec 16 '22 08:12

leftjoin