Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

enable to create hive table with primary key constraint

avatar
Expert Contributor

Hi,

I am using HDP 2.5 in hortonworks sanbox. The HIVE version is 1.2.1. I am trying to create hive table with primary key constraint with below query:

CREATE TABLE pk 
       (id1 int,id2 int,
        name string,
        dept string,
        primary key(id1,id2) 
        disable novalidate) 
        PARTITIONED BY (year string);

while executing this create table query it throws below error:

 ParseException line 1:65 cannot recognize input near 'key' '(' 'id1' in column type

I am not getting what this error and how to resolve it.

Is constraints supported in HIVE 1.2.1 ?

can anyone help me out to resolve this issue ?

Thank You.

1 ACCEPTED SOLUTION

avatar

@heta desai

Based on this jira

https://issues.apache.org/jira/browse/HIVE-13290

and the hive docs:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Constraints

This is supported from hive 2.1.0 onwards only.

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

View solution in original post

2 REPLIES 2

avatar

@heta desai

Based on this jira

https://issues.apache.org/jira/browse/HIVE-13290

and the hive docs:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Constraints

This is supported from hive 2.1.0 onwards only.

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

avatar
Expert Contributor
@Felix Albani

Thank you.