Database Reference
In-Depth Information
CREATE TABLE my_avro_table (userID int,
userName string)
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'
TBLPROPERTIES (
'avro.schema.literal'='{
"type": "record",
"name": "user_record",
"fields": [
{"name": "userID", "type": "int"},
{"name": "userName", "type":
"string"}
]}');
INSERT OVERWRITE TABLE my_avro_table SELECT *,
"avro"
FROM functional.alltypes;
Once the file is created in Hive, you can just use it in Impala as any other file as fol-
lows:
SELECT * from my_avro_table;
Tip
Please visit the Cloudera Impala documentation for Avro file format support at
the following URL:
http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/
Installing-and-Using-Impala/ciiu_avro.html
Search WWH ::




Custom Search