【发布时间】:2016-09-26 09:41:15
【问题描述】:
我们已经按照以下步骤,
-
将表从 MySQL 导入到 HDFS 位置
user/hive/warehouse/orders/,表架构为mysql> describe orders; +-------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-------------+------+-----+---------+-------+ | order_id | int(11) | YES | | NULL | | | order_date | varchar(30) | YES | | NULL | | | order_customer_id | int(11) | YES | | NULL | | | order_items | varchar(30) | YES | | NULL | | +-------------------+-------------+------+-----+---------+-------+ -
使用 (1) 中的相同数据在 Hive 中创建了一个外部表。
CREATE EXTERNAL TABLE orders 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:///user/hive/warehouse/retail_stage.db/orders' TBLPROPERTIES ('avro.schema.url'='hdfs://host_name//tmp/sqoop-cloudera/compile/bb8e849c53ab9ceb0ddec7441115125d/orders.avsc');Sqoop 命令:
sqoop import \ --connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \ --username=root \ --password=cloudera \ --table orders \ --target-dir /user/hive/warehouse/retail_stage.db/orders \ --as-avrodatafile \ --split-by order_id -
描述格式化的订单,返回错误,尝试了很多组合但失败了。
hive> describe orders; OK error_error_error_error_error_error_error string from deserializer cannot_determine_schema string from deserializer check string from deserializer schema string from deserializer url string from deserializer and string from deserializer literal string from deserializer Time taken: 1.15 seconds, Fetched: 7 row(s)
同样的事情适用于 --as-textfile ,在 --as-avrodatafile 的情况下抛出错误。
提到了一些堆栈溢出但无法解决。有什么想法吗?
【问题讨论】: