From 77021d2a61b155f47734f1047403ab1eb4281e65 Mon Sep 17 00:00:00 2001 From: Hari Shreedharan Date: Mon, 9 Nov 2015 21:55:25 -0800 Subject: [PATCH] SQOOP-2651. Do not dump data on error in TextExportMapper by default (Jarcec via Hari) --- .../org/apache/sqoop/mapreduce/TextExportMapper.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) {