Created
November 7, 2014 00:50
-
-
Save t3rmin4t0r/51262d1346094b6b5f7f to your computer and use it in GitHub Desktop.
Hive Serialization.ddl to Create Table helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
for l in sys.stdin: | |
l = l.strip() | |
name = l[0:l.find("{")] | |
cols = [x.strip().split(" ") for x in l[l.find("{")+1:l.find("}")].split(",")] | |
print "create table ", name, "(", | |
print ",".join(["%s %s" % (b,a) for (a,b) in cols]), ");" | |
[gopal@cn041-10 comcast]$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
grep --text serialization.ddl orig_plan.txt | sort | sed "s/ *//" | uniq | python ddl.py