Reserved Keywords as Columns in Apache Hive

Since the use of reserved keywords for user-defined objects such as tables, columns, etc. is not good practice, However, if there is a situation where it cannot be avoided, there is still a possibility to use the reserved keywords as columns.

  • Note: The below specified implementation is common in both Apache Hive & Apache Impala.

Refer to the below example:

CREATE TABLE exchange(window date, log string);

In the above example, both “exchange” and “window” are the keywords reserved by Apache Hive. Hence it returned an error.

However, in such scenarios, use the keyword in between back-tick characters (`) . Refer to the below example.

CREATE TABLE `exchange`(`window` date, log string)


Finally, the table has been created.

Hope you liked this post.

Please click on the follow button to receive updates on newer posts.

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s