Reputation: 37
Say I'm running a Hive query with a left outer join to pull in a new column X from table B. Instead of having null values in column X for records in table A that weren't matched, is there a way to, say, default it to a string?
Upvotes: 0
Views: 1124
Reputation: 1270873
You do this using coalesce()
:
coalesce(b.x, 'default value')
This is an ANSI standard function and is supported in Hive.
Upvotes: 4