mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 01:00:46 +08:00
SQOOP-2651. Do not dump data on error in TextExportMapper by default
(Jarcec via Hari)
This commit is contained in:
parent
408358930d
commit
77021d2a61
@ -39,11 +39,15 @@
|
|||||||
public class TextExportMapper
|
public class TextExportMapper
|
||||||
extends AutoProgressMapper<LongWritable, Text, SqoopRecord, NullWritable> {
|
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 =
|
public static final Log LOG =
|
||||||
LogFactory.getLog(TextExportMapper.class.getName());
|
LogFactory.getLog(TextExportMapper.class.getName());
|
||||||
|
|
||||||
private SqoopRecord recordImpl;
|
private SqoopRecord recordImpl;
|
||||||
|
|
||||||
|
boolean enableDataDumpOnError;
|
||||||
|
|
||||||
public TextExportMapper() {
|
public TextExportMapper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +78,8 @@ protected void setup(Context context)
|
|||||||
throw new IOException("Could not instantiate object of type "
|
throw new IOException("Could not instantiate object of type "
|
||||||
+ recordClassName);
|
+ 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("");
|
||||||
|
|
||||||
LOG.error("Exception: ", e);
|
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();
|
InputSplit is = context.getInputSplit();
|
||||||
if (is instanceof FileSplit) {
|
if (is instanceof FileSplit) {
|
||||||
|
Loading…
Reference in New Issue
Block a user