Options
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to create hive table with different columns as alias pointing to one column
Labels:
- Labels:
-
Apache Hive
Explorer
Created ‎01-02-2019 08:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1 REPLY 1
Super Collaborator
Created ‎01-04-2019 05:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Dinesh Singh,
If I understand correctly you need to select value which ever has non null out of two columns,
for instance if your data has this manner.
Col1 | Col2 |
A1 | B1 |
NULL | B2 |
A3 | NULL |
and you would like to select the data as (A1,B2,A3) you may use COALESCE(Col1,Col2,'<Your Default value>')
and on top of this table you may create a view so that end user directly view the result as single columns
NB: If you are convenient you may use case statement for complex logic implementation to retrieve as single column.
Thanks,
