Support Questions

Find answers, ask questions, and share your expertise

our Hive version is 1.2, please help to confirm whether the NOT NULL function is supported for specific columns in HIVE table.

Per the doc in Apache, only after Hive version 3.0 the function of NOT NULL constraints could be supported (https://issues.apache.org/jira/browse/HIVE-16575).

-bash-4.2$ hive --version

Hive 1.2.1000.2.6.4.0-91

Since our Hive version is 1.2, please help to confirm whether the NOT NULL function is supported for specific columns in HIVE table. If supported, how to implement such function in the table DDL. Thanks!

1 REPLY 1

Rising Star

At this time, NOT NULL constraints are not supported in Hive. The most recent release of Hive is 2.3.3. The version supported in the latest HDP release currently supports Hive 1.2.1 and Hive 2.1.0. As you noted, the JIRA addressing NOT NULL constraints is targeted for a 3.0 release.

There are some ways to work around this, such as creating a staging table, then using a COALESCE to default NULL values to something or a WHERE clause to filter out rows with NULL values. If you are using HDF/NiFi to load the tables, you could consider other options, such as routing filtered rows to an alternate table or queue to raise alerts.