csv-serde/readme.md

1.4 KiB

Hive CSV Support

Build Status

This SerDe adds real CSV input and ouput support to hive using the excellent opencsv library.

Using

Basic Use

add jar path/to/csv-serde.jar;

create table my_table(a string, b string, ...)
  row format serde 'com.bizo.hive.serde.csv.CSVSerde'
  stored as textfile
;

Custom formatting

You can also specify custom separator, quote, or escape characters.

add jar path/to/csv-serde.jar;

create table my_table(a string, b string, ...)
 row format serde 'com.bizo.hive.serde.csv.CSVSerde'
 with serdeproperties (
   "separatorChar" = "\t",
   "quoteChar"     = "'",
   "escapeChar"    = "\\"
  )	  
 stored as textfile
;

Files

The following include opencsv along with the serde, so only the single jar is needed. Different builds are needed depending on your version of Hive.

Hive 0.8.*

Building

Run mvn package to build. Both a basic artifact as well as a "fat jar" (with opencsv) are produced.

License

csv-serde is open source and licensed under the Apache 2 License.