hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "@Sanjiv Singh" <sanjiv.is...@gmail.com>
Subject Re: Keys in Hive
Date Wed, 24 Jun 2015 05:07:52 GMT
Hi ,

DDL  is not syntactically correct. You must be getting parsing error as
keys are not supported on hive:

Sample Error :

NoViableAltException(26@[])
    at
org.apache.hadoop.hive.ql.parse.HiveParser.type(HiveParser.java:37295)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.colType(HiveParser.java:37060)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.columnNameType(HiveParser.java:36760)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.columnNameTypeList(HiveParser.java:34985)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:4777)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2350)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1574)
    at
org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1052)
    at
org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:199)
    at
org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:389)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
    at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
    at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1129)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
    at
org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:201)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:153)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:364)
    at
org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:712)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:631)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:570)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 1:38 cannot recognize input near 'key' '('
'name' in column type

For valid syntax, refer doc :

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



Regards
Sanjiv Singh
Mob :  +091 9990-447-339

On Tue, Jun 2, 2015 at 7:09 PM, Prem Yadav <ipremyadav@gmail.com> wrote:

> I believe there is support for primary key which is basically UNIQUE NOT
> NULL constraint.
>
> Ravi,
> what is the error you are getting?
>
> On Tue, Jun 2, 2015 at 2:20 PM, Edward Capriolo <edlinuxguru@gmail.com>
> wrote:
>
>> Hive does not support primary key or other types of index constraints.
>>
>> On Tue, Jun 2, 2015 at 4:37 AM, Ravisankar Mani <
>> ravisankarmani@syncfusion.com> wrote:
>>
>>>  Hi everyone,
>>>
>>>
>>>
>>> I am unable to create an table in hive with primary key
>>>
>>> Example :
>>>
>>>
>>>
>>> create table Hivetable((name string),primary key(name));
>>>
>>>
>>>
>>> Could please help about the primary key query?
>>>
>>>
>>>
>>> Regards,
>>>
>>>
>>>
>>> Ravisankar M R
>>>
>>
>>
>

Mime
View raw message