Reputation: 13
Primary key and foreign key constraints feature are available from Hive 2.1 version. How this constraint relation works in the hive, is it similar as in the normal database. Hive works on "Schema on reading", So How these constraints effects while loading or deleting the data?
Upvotes: 1
Views: 4246
Reputation: 886
Hive does not validate primary and foreign key contraints. So, no, it is not similar to a "normal database", e.g. an RDBMS like PostgreSQL, in terms of support for constraint validation.
Please refer to the Hive documentation where it is stated that:
As of Hive 2.1.0 (HIVE-13290)... Hive includes support for non-validated primary and foreign key constraints. Some SQL tools generate more efficient queries when constraints are present. Since these constraints are not validated, an upstream system needs to ensure data integrity before it is loaded into Hive.
Upvotes: 3