3

I try to put data in Hive table via Spark SQL terminal.

I created table based on Avro Schema .avsc :

CREATE TABLE test_table
  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'='file:///C:/some_dir/table_schema.avsc');

Then I try to load data from Avro file which stored in HDFS:

LOAD DATA INPATH 'hdfs://localhost:9000/data/test_table.avro' OVERWRITE INTO TABLE test_table;

I get an error:

Error in query: java.lang.IllegalArgumentException: Wrong FS: hdfs://localhost:9000/data/test_table.avro, expected: file:///;

When I try to load from local file system it works.

Also my core-site.xml:

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000</value>
        <final>true</final>
        <description>NameNode URI</description>
    </property>
</configuration>

How to load data from files which stored in HDFS?

Community
  • 1
  • 1
Bo.
  • 605
  • 1
  • 12
  • 28

0 Answers0