Index: src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java (revision 1236032) +++ src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java (revision ) @@ -69,7 +69,6 @@ super(context,baseWriter); this.context = context; jobInfo = HCatOutputFormat.getJobInfo(context); - storageDriver = HCatOutputFormat.getOutputDriverInstance(context,jobInfo); // If partition columns occur in data, we want to remove them. partColsToDel = jobInfo.getPosOfPartCols(); @@ -84,12 +83,14 @@ if (!dynamicPartitioningUsed) { + storageDriver = HCatOutputFormat.getOutputDriverInstance(context,jobInfo); this.baseDynamicStorageDrivers = null; this.baseDynamicWriters = null; this.baseDynamicCommitters = null; prepareForStorageDriverOutput(context); } else { + storageDriver = null; this.baseDynamicStorageDrivers = new HashMap(); this.baseDynamicWriters = new HashMap, ? super Writable>>(); this.baseDynamicCommitters = new HashMap(); Index: src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java (revision 1236032) +++ src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java (revision ) @@ -68,7 +68,12 @@ @Override public RecordWriter, HCatRecord> getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException { - return new FileRecordWriterContainer(of.getRecordWriter(context),context); + // When Dynamic partitioning is used, the RecordWriter instance initialized here isn't used. Can use null. + // (That's because records can't be written until the values of the dynamic partitions are deduced. + // By that time, a new local instance of RecordWriter, with the correct output-path, will be constructed.) + return new FileRecordWriterContainer(HCatOutputFormat.getJobInfo(context) + .isDynamicPartitioningUsed()? null : of.getRecordWriter(context), + context); } @Override