androidnoob
androidnoob

Reputation: 31

How do I Insert data from text table (using MultiDelimitSerDe) to Avro Table?

I noticed that I can use an insert into statement from text table to avro table when not using the MultiDelimitSerDe. It also works with ROW FORMAT DELIMITED FIELDS TERMINATED BY "," i.e. a single character.

I create 2 tables - 1 text table and 1 avro table:

CREATE TABLE example1 ( example STRING, example2 STRING, example3 STRING ) ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe' WITH SERDEPROPERTIES ("field.delim"="**") STORED AS TEXTFILE ;

CREATE TABLE example2 ( example STRING, example2 STRING, example3 STRING ) STORED AS AVRO;

I then load data into example1 table (file delimited by "**")i.e.

LOAD DATA INPATH 'HDFS-path' INTO TABLE example1;

example1 now has data inside it. I want to insert the data from example1 to example2.

INSERT INTO TABLE example2 SELECT * from example1;

This however, gives a "return code 2" error. I have no idea why I am unable to insert the data using the MultiDelimitSerDe but I am able to do this with "ROW FORMAT DELIMITED FIELDS TERMINATED BY". But, I need to use a multi-delimiter.

Could anyone help me please?

Upvotes: 2

Views: 1000

Answers (1)

user3078689
user3078689

Reputation: 51

Have you added the required JAR file?

'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe' - Make sure you have the required JAR file for this (hive_contrib.jar).

Upvotes: 0

Related Questions