Consider the following scenario
Hive table with 5 columns (col1, col2, col3, col4, col5)
CSV file with 3 columns (col1, col3, col5)
Now I want to load CSV file data into hive table with exact csv to hive column mapping as follows.
hive csv data
col1 <-> col1
col3 <-> col3
col5 <-> col5
Any kind of help would be greatly appreciate.
@Wes Floyd@srai @mqureshi Thank you so much for your quick responses to my question. As I already have staging table to orc table implementation structure I will try to use csv column headers to create staging tables and then I will load staging data to actual table.
Check out section 3.4 from the tutorial using the reg-ex. This would help you load the table with columns you need.
Also, Another way is like @srai said, create an external table, mapped it to the the csv file. Create a managed table and insert the data using insert into managed table select from external table, explicitly state the columns you want to load with the insert statement.