Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name of Hive table is now a reserved keyword

Tags:

hadoop

hive

One of my hive tables has a column named "location" which is now a reserved keyword. I want to create a copy of the table in development, is there any way to get around the name during the create table statement? If I do something like

CREATE TABLE users (id int, location string);

I see:

FAILED: Parse Error: line 1:0 mismatched input ''location'' expecting Identifier near ',' in column specification
like image 500
Vlad the Impala Avatar asked Mar 27 '13 18:03

Vlad the Impala


People also ask

How to use reserved keywords as identifiers in hive?

Most of the keywords are reserved through HIVE-6617 in order to reduce the ambiguity in grammar (version 1.2.0 and later). There are two ways if the user still would like to use those reserved keywords as identifiers: (1) use quoted identifiers, (2) set hive.support.sql11.reserved.keywords =false. (version 2.1.0 and earlier)

What is a hive table?

Introduction to Hive Table In the hive, the tables are consisting of columns and rows and store the related data in the table format within the same database. The table is storing the records or data in tabular format. The tables are broadly classified into two parts i.e.; external table and internal table.

How to create a table like view_name in hive?

In Hive 0.8.0 and later releases, CREATE TABLE LIKE view_name creates a table by adopting the schema of view_name (fields and partition columns) using defaults for SerDe and file formats.

What is a Transact-SQL reserved keyword?

SQL Server does not have to distinguish this as a reserved keyword. Transact-SQL reserved keywords can be used as identifiers or names of databases or database objects, such as tables, columns, views, and so on.


1 Answers

Figured it out:

CREATE TABLE users (`id` int, `location` string);
like image 76
Vlad the Impala Avatar answered Sep 19 '22 17:09

Vlad the Impala