Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Hive assert()?


I would like to implement some kind of assert functionality in Hive QL.

Here is how I do it in MySQL. I can assert that a given query returns no
(bad) rows by creating a table with one row containing '1' and a unique
index. Then, I try to insert into that table select 1 from (query). If the
query returns something, I have an assert failure. I've found such asserts
very helpful in catching data bugs early.

Can I do something similar in Hive? I suppose I could implement a UDF that
fails if it gets executed. This way I can ensure there is no records
matching a given query.
That doesn't sound too bad but perhaps there is a cleaner solution.

Thanks!