Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

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.