diff --git a/src/java/com/cloudera/sqoop/lib/LargeObjectLoader.java b/src/java/com/cloudera/sqoop/lib/LargeObjectLoader.java index 43df7fc4..89665799 100644 --- a/src/java/com/cloudera/sqoop/lib/LargeObjectLoader.java +++ b/src/java/com/cloudera/sqoop/lib/LargeObjectLoader.java @@ -47,10 +47,9 @@ public class LargeObjectLoader extends org.apache.sqoop.lib.LargeObjectLoader { /** * Create a new LargeObjectLoader. * @param conf the Configuration to use - * @param workPath the HDFS working directory for this task. */ - public LargeObjectLoader(Configuration conf, Path workPath) + public LargeObjectLoader(Configuration conf) throws IOException { - super(conf, workPath); + super(conf); } } diff --git a/src/java/org/apache/sqoop/lib/LargeObjectLoader.java b/src/java/org/apache/sqoop/lib/LargeObjectLoader.java index bc51277a..a0f94d29 100644 --- a/src/java/org/apache/sqoop/lib/LargeObjectLoader.java +++ b/src/java/org/apache/sqoop/lib/LargeObjectLoader.java @@ -69,12 +69,11 @@ public class LargeObjectLoader implements Closeable { /** * Create a new LargeObjectLoader. * @param conf the Configuration to use - * @param workPath the HDFS working directory for this task. */ - public LargeObjectLoader(Configuration conf, Path workPath) + public LargeObjectLoader(Configuration conf) throws IOException { this.conf = conf; - this.workPath = workPath; + this.workPath = new Path(System.getProperty("java.io.tmpdir"), "SQOOP"); this.fs = FileSystem.get(conf); this.curBlobWriter = null; this.curClobWriter = null; diff --git a/src/java/org/apache/sqoop/mapreduce/AvroImportMapper.java b/src/java/org/apache/sqoop/mapreduce/AvroImportMapper.java index 6fc656f5..6adad794 100644 --- a/src/java/org/apache/sqoop/mapreduce/AvroImportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/AvroImportMapper.java @@ -52,8 +52,7 @@ protected void setup(Context context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); schema = AvroJob.getMapOutputSchema(conf); - lobLoader = new LargeObjectLoader(conf, - FileOutputFormat.getWorkOutputPath(context)); + lobLoader = new LargeObjectLoader(conf); bigDecimalFormatString = conf.getBoolean( ImportJobBase.PROPERTY_BIGDECIMAL_FORMAT, ImportJobBase.PROPERTY_BIGDECIMAL_FORMAT_DEFAULT); diff --git a/src/java/org/apache/sqoop/mapreduce/HBaseBulkImportMapper.java b/src/java/org/apache/sqoop/mapreduce/HBaseBulkImportMapper.java index 9c9d6cd3..10891e92 100644 --- a/src/java/org/apache/sqoop/mapreduce/HBaseBulkImportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/HBaseBulkImportMapper.java @@ -54,10 +54,7 @@ public class HBaseBulkImportMapper protected void setup(Context context) throws IOException, InterruptedException { this.conf = context.getConfiguration(); - Path largeFilePath = new Path(this.conf.get("sqoop.hbase.lob.extern.dir", - "/tmp/sqoop-hbase-" + context.getTaskAttemptID())); - this.lobLoader = new LargeObjectLoader(context.getConfiguration(), - largeFilePath); + this.lobLoader = new LargeObjectLoader(this.conf); // Get the implementation of PutTransformer to use. // By default, we call toString() on every non-null field. diff --git a/src/java/org/apache/sqoop/mapreduce/ParquetImportMapper.java b/src/java/org/apache/sqoop/mapreduce/ParquetImportMapper.java index cc2982c3..effbadd1 100644 --- a/src/java/org/apache/sqoop/mapreduce/ParquetImportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/ParquetImportMapper.java @@ -42,9 +42,7 @@ public class ParquetImportMapper @Override protected void setup(Context context) throws IOException, InterruptedException { - Configuration conf = context.getConfiguration(); - Path workPath = new Path("/tmp/sqoop-parquet-" + context.getTaskAttemptID()); - lobLoader = new LargeObjectLoader(conf, workPath); + lobLoader = new LargeObjectLoader(context.getConfiguration()); } @Override diff --git a/src/java/org/apache/sqoop/mapreduce/SequenceFileImportMapper.java b/src/java/org/apache/sqoop/mapreduce/SequenceFileImportMapper.java index 528eeec3..fde5d661 100644 --- a/src/java/org/apache/sqoop/mapreduce/SequenceFileImportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/SequenceFileImportMapper.java @@ -38,8 +38,7 @@ public class SequenceFileImportMapper @Override protected void setup(Context context) throws IOException, InterruptedException { - this.lobLoader = new LargeObjectLoader(context.getConfiguration(), - FileOutputFormat.getWorkOutputPath(context)); + this.lobLoader = new LargeObjectLoader(context.getConfiguration()); } @Override diff --git a/src/java/org/apache/sqoop/mapreduce/TextImportMapper.java b/src/java/org/apache/sqoop/mapreduce/TextImportMapper.java index a63faedc..f0bca93f 100644 --- a/src/java/org/apache/sqoop/mapreduce/TextImportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/TextImportMapper.java @@ -45,8 +45,7 @@ public TextImportMapper() { @Override protected void setup(Context context) throws IOException, InterruptedException { - this.lobLoader = new LargeObjectLoader(context.getConfiguration(), - FileOutputFormat.getWorkOutputPath(context)); + this.lobLoader = new LargeObjectLoader(context.getConfiguration()); } @Override diff --git a/src/java/org/apache/sqoop/mapreduce/hcat/SqoopHCatImportHelper.java b/src/java/org/apache/sqoop/mapreduce/hcat/SqoopHCatImportHelper.java index c2fc2e59..598483d8 100644 --- a/src/java/org/apache/sqoop/mapreduce/hcat/SqoopHCatImportHelper.java +++ b/src/java/org/apache/sqoop/mapreduce/hcat/SqoopHCatImportHelper.java @@ -112,8 +112,7 @@ public SqoopHCatImportHelper(Configuration conf) throws IOException, hCatFullTableSchema.append(hfs); } fieldCount = hCatFullTableSchema.size(); - lobLoader = new LargeObjectLoader(conf, new Path(jobInfo.getTableInfo() - .getTableLocation())); + lobLoader = new LargeObjectLoader(conf); bigDecimalFormatString = conf.getBoolean( ImportJobBase.PROPERTY_BIGDECIMAL_FORMAT, ImportJobBase.PROPERTY_BIGDECIMAL_FORMAT_DEFAULT); diff --git a/src/test/com/cloudera/sqoop/lib/TestLargeObjectLoader.java b/src/test/com/cloudera/sqoop/lib/TestLargeObjectLoader.java index 7dada965..c6bebf70 100644 --- a/src/test/com/cloudera/sqoop/lib/TestLargeObjectLoader.java +++ b/src/test/com/cloudera/sqoop/lib/TestLargeObjectLoader.java @@ -49,14 +49,14 @@ public void setUp() throws IOException, InterruptedException { conf.set(CommonArgs.FS_DEFAULT_NAME, CommonArgs.LOCAL_FS); } String tmpDir = System.getProperty("test.build.data", "/tmp/"); - this.outDir = new Path(new Path(tmpDir), "testLobLoader"); + this.outDir = new Path(System.getProperty("java.io.tmpdir")); FileSystem fs = FileSystem.get(conf); if (fs.exists(outDir)) { fs.delete(outDir, true); } fs.mkdirs(outDir); - loader = new LargeObjectLoader(conf, outDir); + loader = new LargeObjectLoader(conf); } public void testReadClobRef()