- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
hive create table with not null constraint
- Labels:
-
Apache Hive
Created on ‎02-19-2017 11:18 PM - edited ‎09-16-2022 04:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to analyze if we can have a NOT NULL constraints in Hive tables.
In the below link of Apache Hive page,
It has a "constraint_specification" for the Create table statement for primary_keyt etc. I tried but couldn't find the "constraint_specification" in Cloudera site for Hive. My questions are
1. Is it possible to create a Hive table with Not Null constraints? If yes, can you please provide me syntax.
2. What are the constraints are supported in Hive table? If possible please provide me the link which has the details on constraints supported by Hive for Cloudera distribution.
Appreciate you help.
Thanks
Ravi
Created ‎02-20-2017 07:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think so we can able to create the table with null constraints.
please refer the below link
Created on ‎02-20-2017 09:33 PM - edited ‎02-20-2017 09:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hive is designed for schema on Read. Meaning Hive has not control over the underlying storage .
You can damage the data and still managed to query using hive . Let say if the schema does not match the file contents then Hive will try its best to read it. going down fruther it will produce null values if its non numberic strings. Where as in traditional database you write update insert and the database has control over the storage it will enforce the schema while writing thats why it is schema on write. So to sum up you wont be ablecreate Not Null constraints hive table and enforce it by design .
Created ‎06-25-2017 03:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ravi
They have this issue fixed in hive 3.0.0 , They have been able to add hive support for "Not NULL " & "UNIQUE" constraint . Check out this link
https://issues.apache.org/jira/browse/HIVE-16575
Regards
Vishnu Gupta
