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);

createtable_stmt_errorcreatetable_stmt_error1
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)

createtable_stmt_reservedkeywords

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