Hive table
Copy ora_hive_pos.avsc
to In Hive, create a table using the generated Avro schema file. Modify the TBLPROPERTIES
string to point to the correct location.
CREATE TABLE OracleHive 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.url'='hdfs://localhost:9000/avro/ora_hive_pos.avsc');
The new table should look like this:
hive> describe formatted oraclehive; OK # col_name data_type comment data map<string,string> before map<string,string> metadata map<string,string> …. Time taken: 0.481 seconds, Fetched: 34 row(s) hive>
Configure the above to table to read from generated avro data
hive>LOAD DATA INPATH '/output/ora_hive_pos.bin' OVERWRITE INTO TABLE OracleHive;