I’m going to show you a neat way to work with CSV files and Apache Hive. Usually, you’d have to do some preparatory work on CSV data before you can consume it with Hive but I’d like to show you a built-in SerDe (Serializer/Deseriazlier) for Hive that will make it a lot more convenient to work with CSV. This work was merged in Hive 0.14 and there’s no additional steps necessary to work with CSV from Hive.
Suppose you have a CSV file with the following entries
id first_name last_name email gender ip_address
1 James Coleman email@example.com Male 22.214.171.124
2 Lillian Lawrence firstname.lastname@example.org Female 126.96.36.199
3 Theresa Hall email@example.com Female 188.8.131.52
4 Samuel Tucker firstname.lastname@example.org Male 184.108.40.206