Member since
10-11-2022
1
Post
0
Kudos Received
0
Solutions
10-11-2022
08:42 PM
I have a hive table with three columns, delimited by tabs hive (database)> describe formatted my_table; # col_name data_type comment field1 string field2 string field3 string ... ... Storage Desc Params: input.regex (\\S+)\\s+(\\S+)\\s+(.*) hive (database)> select * from my_table limit 2; DataX DataX DataX DataX DataX DataX I want to add two new columns to the hive table schema, so I did: // add two columns hive (database)> alter table my_table add columns(field4 string,field5 string); // add two more (\\S+)\\s+ for the new columns hive (database)> alter table my_table SET SERDEPROPERTIES ("input.regex" = "(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)"); But seems it doesn't work with the old dataset (the old data file with three columns): hive (database)> select * from my_table limit 2; NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL I expected something like this: DataX DataX DataX NULL NULL DataX DataX DataX NULL NULL Could someone help me understand why all the fields show NULL after adding the columns to schema? Thanks in advance!
... View more
Labels:
- Labels:
-
Apache Hadoop
-
Apache Hive