sqoop 从sqlserver导入hive表报错 Imported Failed: Cannot convert SQL type 2005
运用CDH5.7.5 sqoop 1.4.6从sqlserver 导入数据到hive表中,报错,报错信息如下。# sqoop --options-file alipay_systemlog
Warning: /opt/cloudera/parcels/CDH-5.7.5-1.cdh5.7.5.p0.3/bin/../lib/sqoop/../accumulo does not exist! Accumulo imports will fail.Please set $ACCUMULO_HOME to the root of your Accumulo installation.17/05/04 16:01:58 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.7.517/05/04 16:01:58 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.17/05/04 16:01:58 INFO manager.SqlManager: Using default fetchSize of 100017/05/04 16:01:58 INFO tool.CodeGenTool: Beginning code generation17/05/04 16:01:58 INFO tool.CodeGenTool: Will generate java class as codegen_alipay_systemlog17/05/04 16:01:58 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM AS t WHERE 1=017/05/04 16:01:58 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /opt/cloudera/parcels/CDH/lib/hadoop-mapreduceNote: /tmp/sqoop-root/compile/2b31d0e634e6b8dcd9f287f88b7f8f33/codegen_alipay_systemlog.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.17/05/04 16:01:59 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-root/compile/2b31d0e634e6b8dcd9f287f88b7f8f33/codegen_alipay_systemlog.jar17/05/04 16:01:59 INFO tool.ImportTool: Destination directory /dianmei/sqoop/alipay_systemlog is not present, hence not deleting.17/05/04 16:01:59 INFO mapreduce.ImportJobBase: Beginning import of alipay_systemlog17/05/04 16:01:59 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar17/05/04 16:01:59 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM AS t WHERE 1=017/05/04 16:01:59 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM AS t WHERE 1=017/05/04 16:01:59 ERROR tool.ImportTool: Imported Failed: Cannot convert SQL type 2005
alipay_systemlog文件内容如下:
import --connect jdbc:jtds:sqlserver://10.97.0.144:1433;DatabaseName=dianmei --username sa --password root --table alipay_systemlog --map-column-hive createdate=string,type=string --as-parquetfile --fields-terminated-by '\t' --hive-import --hive-drop-import-delims --hive-overwrite --hive-database sqoop --hive-table alipay_systemlog --delete-target-dir --target-dir /dianmei/sqoop/alipay_systemlog --null-string '' --null-non-string '\\N' -m 1 --compression-codec org.apache.hadoop.io.compress.SnappyCodec
sqlserver中表alipay_systemlog表的结构如下所示:
id varchar no 50 no no no Chinese_PRC_CI_ASactionname varchar no 100 yes no yes Chinese_PRC_CI_AScompid varchar no 50 yes no yes Chinese_PRC_CI_AScompname varchar no 200 yes no yes Chinese_PRC_CI_ASalipaypartner varchar no 50 yes no yes Chinese_PRC_CI_ASout_trade_no varchar no 100 yes no yes Chinese_PRC_CI_AStrade_no varchar no 200 yes no yes Chinese_PRC_CI_ASmessage varchar no -1 yes no yes Chinese_PRC_CI_ASremark varchar no 2000 yes no yes Chinese_PRC_CI_AScreatedate datetime no 8 yes (n/a) (n/a)
type int no 4 10 0 yes (n/a) (n/a)
把 --map-column-hive createdate=string,type=string 这个参数去掉或者随便删除一个都还是报这个错,搞了大半天了,有哪位高手能帮忙看下么,谢谢了。
自己给自己顶,哪个能人过来帮我看下解决下啊。。。。 记得红字部分有的大写,特别是类型,比如String,S要大写
--map-column-java DATE_COLUMN1=String,DATE_COLUMN2=String
大哥,我把
--map-column-hive
createdate=string,type=string
修改成
--map-column-java
createdate=String
还是不行啊。。。。。。。。
还是原来的错。。。。 zhufeng8407 发表于 2017-5-4 17:38
大哥,我把
--map-column-hive
createdate=string,type=string
createdate=string,type=string
改成下面
CREAREDATE=String,TYPE=Int
页:
[1]