Repository: sqoop
Updated Branches:
  refs/heads/trunk 408358930 -> 77021d2a6


SQOOP-2651. Do not dump data on error in TextExportMapper by default

(Jarcec via Hari)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/77021d2a
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/77021d2a
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/77021d2a

Branch: refs/heads/trunk
Commit: 77021d2a61b155f47734f1047403ab1eb4281e65
Parents: 4083589
Author: Hari Shreedharan <[email protected]>
Authored: Mon Nov 9 21:55:25 2015 -0800
Committer: Hari Shreedharan <[email protected]>
Committed: Mon Nov 9 21:55:25 2015 -0800

----------------------------------------------------------------------
 .../org/apache/sqoop/mapreduce/TextExportMapper.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/77021d2a/src/java/org/apache/sqoop/mapreduce/TextExportMapper.java
----------------------------------------------------------------------
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 @@ import org.apache.commons.logging.LogFactory;
 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 @@ public class TextExportMapper
       throw new IOException("Could not instantiate object of type "
           + recordClassName);
     }
+
+    enableDataDumpOnError = conf.getBoolean(DUMP_DATA_ON_ERROR_KEY, false);
   }
 
 
@@ -89,7 +95,11 @@ public class TextExportMapper
       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) {

Reply via email to