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

Switch to Threaded View
Hive, mail # dev - Inconsistencies around casting booleans


Copy link to this message
-
Inconsistencies around casting booleans
Philip Tromans 2012-08-09, 09:14
Hi all,

We've been using boolean types in partition values (not the best idea,
I know), and we've noticed a few inconsistencies around casting:

SELECT cast('true' as boolean), cast('false' as boolean), cast(true as
string), cast(false as string), cast(cast(false as string) as boolean)
FROM test

returns

true    true    TRUE    FALSE   true

The current logic in UDFToBoolean is that a string is false if it's
empty, and true otherwise. This isn't mirrored in UDFToString(), and
hence the inconsistency above.

I'm happy to file a JIRA to change this to something more reasonable,
but I guess this would break backwards compatibility. What are
people's opinions on this?

Cheers,

Phil.