关于Sqoop-Cannot understand character argument: \u0001
作者:互联网
sqoop导出数据,报Cannot understand character argument: \u0001
解决方案:
#不要用'\u0001',换成 '\001'
#不要用'\u0001',换成 '\001'
#不要用'\u0001',换成 '\001'
#export用:
--input-fields-terminated-by '\001'
#import用
--fields-terminated-by '\001'
其他一些备忘:
如果分隔符写在配置文件中了,直接用\001就行,不用再加单引号,因为读取方式是awk
FIELDS_SEPARATOR=`echo $line | awk -F '|' '{print $7}'`
if [ -z "$FIELDS_SEPARATOR" ]
then
FIELDS_SEPARATOR='\011' #默认分隔符
fi
sqoop export --table ${TARGET_TABLE} \
--connect ${JDBC_DRIVER} \
--username ${USERNAME} \
--password ${PASSWORD} \
--export-dir /user/hive/warehouse/${SROUCE_DB}.db/${SOURCE_TABLE}/${PARTITION_KEY}/* \
--columns ${COLUMN_STR} \
--outdir ${SHELL_PATH}/java_file/ \
--input-fields-terminated-by ${FIELDS_SEPARATOR} \
--input-lines-terminated-by '\n' \
--input-null-string '\\N' \
--input-null-non-string '\\N'
标签:u0001,terminated,--,FIELDS,Sqoop,character,001,input 来源: https://blog.csdn.net/Lvbey/article/details/119149671