-Inconsistencies around casting booleans
Philip Tromans 2012-08-09, 08:52
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)
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?