Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how to load data into hive table(external table crated using .avsc) from avro file

how to load data into hive table(external table crated using .avsc) from avro file

Explorer

I have created hive external table by using .avsc file. now I would like to load the data from avro file to the table.

 

can some one suggest how to load the data.

 

 

CREATE EXTERNAL TABLE data_hive
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
STORED as INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
LOCATION 'hdfs location to save the table'
TBLPROPERTIES ('avro.schema.url'='<avro schema location>');

1 REPLY 1

Re: how to load data into hive table(external table crated using .avsc) from avro file

Explorer

 

I tried using below command but getting error

 

hive> LOAD DATA LOCAL INPATH 'hdfs location of .avro' OVERWRITE INTO TABLE hive_from_avro_schema;
FAILED: SemanticException [Error 10028]: Line 1:23 Path is not legal ''hdfs location of .avro'': Source file system should be "file" if "local" is specified
hive>