SQOOP-2651. Do not dump data on error in TextExportMapper by default
(Jarcec via Hari)
diff --git a/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java b/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java
index 8a354b5..7e05d42 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<LongWritable, Text, SqoopRecord, NullWritable> {
+ 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 @@
throw new IOException("Could not instantiate object of type "
+ recordClassName);
}
+
+ enableDataDumpOnError = conf.getBoolean(DUMP_DATA_ON_ERROR_KEY, false);
}
@@ -89,7 +95,11 @@
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) {