Saturday 24 December 2022

Hive: assert_true: throw exception when the condition evaluates to false

Signature

assert_true(boolean condition)

 

This method does nothing when the condition evaluates to true, else throw an exception.

hive> SELECT assert_true(true);
OK
NULL
Time taken: 1.16 seconds, Fetched: 1 row(s)
hive> SELECT assert_true(false);
OK
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: ASSERT_TRUE(): assertion failed.
Time taken: 0.063 seconds

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment