Pivotal Knowledge Base

Follow

Hive select fails with RuntimeException CSVSerde does not exist

Environment

  • Hive 0.12
  • csv-serde-0.9.1

Symptom

Creating the hive table using the following script with command "hive -f mytable.sql" is successful

File: mytable.sql

add jar /tmp/csv-serde-0.9.1.jar;
drop table test_table;
 set hive.cli.print.header=true;
CREATE  TABLE test_table()
	row format serde 'com.bizo.hive.serde.csv.CSVSerde'
	with serdeproperties(
	"separatorChar" = "~",
	"quoteChar" = '"')
stored as textfile;

Selecting the table from hive session returns error

hive> select * from  test_table limit 1;
FAILED: RuntimeException MetaException(message:org.apache.hadoop.hive.serde2.SerDeException SerDe com.bizo.hive.serde.csv.CSVSerde does not exist)

Cause

When creating the hive table csv-serde gets loaded before create statement is executed. Then once user logs back into the hive cli shell the csv-serde jar file is no longer sourced

Fix

Make sure to source csv-serde before executing query. there are several ways this can be done.

  1. Add the csv-serde to hive aux jars at runtime
    $> hive --hiveconf hive.aux.jars.path=/home/gpadmin/3845/csv-serde-0.9.1.jar
  2. Place csv-serde-0.9.1.jar in a commmon direcotry on the hive client node and set hive.aux.jars.path in /etc/gphd/hive/conf/hive-site.xml
  3. Add the jar file during runtime
    hive> add jar /tmp/csv-serde-0.9.1.jar;

Comments

Powered by Zendesk