Support for Key Constraints and Delete Cascade in Hive

Viewed 41

I have come to know that primary and foreign keys are introduced to Hive tables. Is it possible to achieve delete cascade functionality for the rows through Hive QL?

Can anyone help me in understanding the reason and uses of implementing key constraints in Hive (as the constraints are not imposed on table data directly)? Also please help me in understanding the possibility to achieve delete cascade functionality through Hive Schema and HiveQL without coding

1 Answers

These constraints can be only in DISABLE state, meaning that all incoming data is not checked:

  • PRIMARY KEY
  • FOREIGN KEY
  • UNIQUE KEY

These constraints in Hive are not backed by indexes like it is in RDBMS and NO CASCADE operations supported.

The purpose of having disabled constraints is to

  • provide information to CBO (RELY | NORELY) to make it possible to make smart optimizations
  • provide information to modelling tools like ERWin
  • document what is supposed to be PK, UK, FK
Related