I'm able to create a hive table from data in external file. Now I wish to create another table from data in previous table with additional columns with default value.
I understand that CREATE TABLE AS SELECT can be used but how do I add additional columns with default value?
I've been looking for a solution for this too and came up with this:
You could specify which columns to select from table on create/update. Simply provide default value as one of columns. Example with UPDATE is below:
Creating simple table and populating it with value:
Allowing dynamic partitions:
Creating second table:
Populating it from table1 with default value: