diff --git a/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java b/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java index 8a354b5f..7e05d424 100644 --- a/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java @@ -39,11 +39,15 @@ public class TextExportMapper extends AutoProgressMapper { + private static final String DUMP_DATA_ON_ERROR_KEY = "org.apache.sqoop.export.text.dump_data_on_error"; + public static final Log LOG = LogFactory.getLog(TextExportMapper.class.getName()); private SqoopRecord recordImpl; + boolean enableDataDumpOnError; + public TextExportMapper() { } @@ -74,6 +78,8 @@ protected void setup(Context context) throw new IOException("Could not instantiate object of type " + recordClassName); } + + enableDataDumpOnError = conf.getBoolean(DUMP_DATA_ON_ERROR_KEY, false); } @@ -89,7 +95,11 @@ public void map(LongWritable key, Text val, Context context) LOG.error(""); LOG.error("Exception: ", e); - LOG.error("On input: " + val); + if(enableDataDumpOnError) { + LOG.error("On input: " + val); + } else { + LOG.error("Dumping data is not allowed by default, please run the job with -D" + DUMP_DATA_ON_ERROR_KEY + "=true to get corrupted line."); + } InputSplit is = context.getInputSplit(); if (is instanceof FileSplit) {