没有从avsc架构创建的配置单元表的数据

时间:2017-09-13 06:56:21

标签: hive sqoop

我将数据从mysql导入到hdfs作为avroformat。我将.avsc文件移动到hdfs并使用.avsc文件创建hive表。请参阅下表:

.AVSC文件:-rw-r - r-- 3 jonnavithulasivakrishna hdfs 1041 2017-09-13 00:05 hdfs://nn01.itversity.com:8020 / user / jonnavithulasivakrishna / products.avsc

创建表:

hive (siv_sqoop_import)> CREATE EXTERNAL TABLE Products_1
                       > 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 '/user/jonnavithulasivakrishna/products'
                       > TBLPROPERTIES('avro.schema.url'='hdfs://nn01.itversity.com:8020/user/jonnavithulasivakrishna/products.avsc');
OK
Time taken: 0.155 seconds
hive (siv_sqoop_import)> select * from Products_1 limit 10;
OK
Time taken: 0.294 seconds

如您所见,它创建时没有数据。请您帮我解释为什么我没有在此表中获取数据。

1 个答案:

答案 0 :(得分:0)

请在下面找到sqoop命令:

sqoop import \ --connect" jdbc:mysql://nn01.itvserity.com:3306 / retail_db" \ --username retail_dba -P \ - 产品 --as-avrodatafile \ --num-mappers 6 \ --target-dir" / user / jonnavithulasivakrishna / products" \