mirror of
https://github.com/apache/sqoop.git
synced 2025-05-16 08:51:02 +08:00
SQOOP-2024: Hive import doesn't remove target directory in hive
(Abraham Elmahrek via Jarek Jarcec Cecho)
This commit is contained in:
parent
41d8ca2721
commit
6e555218fb
@ -34,6 +34,7 @@
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.mapred.FileOutputCommitter;
|
||||
import org.apache.hadoop.util.ReflectionUtils;
|
||||
import org.apache.hadoop.util.Shell;
|
||||
import org.apache.hadoop.util.ToolRunner;
|
||||
@ -273,6 +274,9 @@ private void cleanUp(Path outputPath) throws IOException {
|
||||
if (statuses.length == 0) {
|
||||
LOG.info("Export directory is empty, removing it.");
|
||||
fs.delete(outputPath, true);
|
||||
} else if (statuses.length == 1 && statuses[0].getPath().getName().equals(FileOutputCommitter.SUCCEEDED_FILE_NAME)) {
|
||||
LOG.info("Export directory is contains the _SUCCESS file only, removing the directory.");
|
||||
fs.delete(outputPath, true);
|
||||
} else {
|
||||
LOG.info("Export directory is not empty, keeping it.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user