Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hive- issue with Create Table with column have space

Tags:

sql

hive

Will need some advice. In HIVE DB is it possible to create table with column have space as below

CREATE TABLE TEST2("Kod ASS" String)

get an error as below

Error: Error while compiling statement: FAILED: ParseException line 1:19 cannot recognize input near '"Kod ASS"' 'String' ')' in column specification SQLState: 42000 ErrorCode: 40000

like image 617
Aiman Avatar asked Aug 13 '16 20:08

Aiman


1 Answers

show manual about column names:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL

In Hive 0.12 and earlier, only alphanumeric and underscore characters are allowed in table and column names.

In Hive 0.13 and later, column names can contain any Unicode character (see HIVE-6013). Any column name that is specified within backticks (`) is treated literally. Within a backtick string, use double backticks (``) to represent a backtick character. Backtick quotation also enables the use of reserved keywords for table and column identifiers.

To revert to pre-0.13.0 behavior and restrict column names to alphanumeric and underscore characters, set the configuration property hive.support.quoted.identifiers to none. In this configuration, backticked names are interpreted as regular expressions. For details, see Supporting Quoted Identifiers in Column Names.

like image 69
Piotr Rogowski Avatar answered Sep 28 '22 07:09

Piotr Rogowski