Hive SerDe for CSV
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Abhinav Sarkar 8daf918fc8 Added line end delimiter and null string support 9 years ago
src Added line end delimiter and null string support 9 years ago
.gitignore remove .classpath/.project 10 years ago
LICENSE.txt apache 2 license 12 years ago
pom.xml move hive/hadoop deps to provided 10 years ago
readme.md Tell the user what the default quote/escape/sep characters are 9 years ago

readme.md

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

The default separator, quote, and escape characters from the opencsv library are:

DEFAULT_ESCAPE_CHARACTER \
DEFAULT_QUOTE_CHARACTER  "
DEFAULT_SEPARATOR        ,

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. Currently built against Hive 0.11.0, but should be compatible with other hive versions.

Building

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

Eclipse support

Run mvn eclipse:eclipse to generate .project and .classpath files for eclipse.

License

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