Since NOT NULL is so common it would be great to have tables start to enforce that.
ekoifman described a possible approach in
One way to enforce not null constraint is to have the optimizer add enforce_not_null UDF which throws if it sees a NULL, otherwise it's pass through.
So if 'b' has not null constraint,
Insert into T select a,b,c... would become
Insert into T select a, enforce_not_null(b), c.....
This would work for any table type.
HIVE-18598 Disallow NOT NULL constraints to be ENABLED/ENFORCED with EXTERNAL table
- is related to
HIVE-6905 Implement Auto increment, primary-foreign Key, not null constraints and default value in Hive Table columns
- relates to
HIVE-16575 Support for 'UNIQUE' and 'NOT NULL' constraints
- links to