hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Wiley <kwi...@keithwiley.com>
Subject Combine two overlapping schema?
Date Wed, 06 Mar 2013 18:03:20 GMT
I have two tables which have overlapping but nonidentical schema.  I want to creating a new
table that unions them, leaving nulls in any given row where a column name doesn't occur in
the other table:

SCHEMA 1: { a, b, c, Y }
row:      { 1, 2, 3, 4 }

SCHEMA 2: { a, b, c, Z }
row:      { 5, 6, 7, 8 }

NEW SCHEMA: { a, b, c, Y, Z }
new row:  { a:1, b:2, c:3, Y:4, Z:null }
new row:  { a:5, b:6, c:7, Y:null, Z:8 }

I don't think either "full outer join" or "union all" works.  I'm not sure how to do this.
 Any ideas?

Thanks.

________________________________________________________________________________
Keith Wiley     kwiley@keithwiley.com     keithwiley.com    music.keithwiley.com

"You can scratch an itch, but you can't itch a scratch. Furthermore, an itch can
itch but a scratch can't scratch. Finally, a scratch can itch, but an itch can't
scratch. All together this implies: He scratched the itch from the scratch that
itched but would never itch the scratch from the itch that scratched."
                                           --  Keith Wiley
________________________________________________________________________________


Mime
View raw message