我使用--as sequencefile选项将一个表从mysql导入到hdfs中。然后我创建了一个hive表,其中包含storedassequencefile子句和location子句,它们指向sqoop导入的序列文件所在的hdfs位置。
sqoop导入命令:
sqoop import --connect jdbc:mysql://sandbox.hortonworks.com:3306/hirw --username root --password hadoop --table stocks -m 2 --as-sequencefile --target-dir /user/root/output/hirw/sqoopimport/stocks_seq --delete-target-dir
配置单元表创建
CREATE TABLE stocks_sqoop_seq (id int, symbol string, name string, trade_date date, close_price float, volume int, update_time timestamp) STORED AS SEQUENCEFILE LOCATION '/user/root/output/hirw/sqoopimport/stocks_seq';
当我现在尝试查询表时,它异常地失败了
Failed with exception java.io.IOException:java.lang.RuntimeException: java.io.IOException: WritableName can't load class: stocks
我错过什么了吗
1条答案
按热度按时间pftdvrlh1#
您还必须声明输入和输出格式。创建如下表: