版本:Sqoop1.99.7
问题描述:在项目上需要从oracle交换数据到hive中,oracle表中有大字段(clob,blob等),在mapper阶段抛出了encoded string too long 错误。
原因:因为Sqoop中间交换的数据格式默认使用的是CSVIntermediateDataFormat
public void write(DataOutput out)
方法会把mapper抽取的一行数据转为String写入,out.writeUTF() 这里当数据过长时会抛出该异常
解决方法:将data转为byte[]后再写出DataOutput中。
write方法:
read方法: