Author: gates
Date: Fri Feb  3 00:59:50 2012
New Revision: 1239962

URL: http://svn.apache.org/viewvc?rev=1239962&view=rev
Log:
HCATALOG-232 Dynamic Partitioning broken: keys set to HIVE_DEFAULT_PARTITION

Modified:
    incubator/hcatalog/branches/branch-0.3/CHANGES.txt
    
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java
    
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java

Modified: incubator/hcatalog/branches/branch-0.3/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.3/CHANGES.txt?rev=1239962&r1=1239961&r2=1239962&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.3/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.3/CHANGES.txt Fri Feb  3 00:59:50 2012
@@ -115,6 +115,8 @@ Release 0.3.0 (unreleased changes)
   OPTIMIZATIONS
 
   BUG FIXES
+  HCAT-232. Dynamic Partitioning broken: keys set to HIVE_DEFAULT_PARTITION 
(mithun via gates)
+
   HCAT-229. bin/hcat should put hcatalog.jar into classpath (daiky via gates)
     
   HCAT-234. bin/hcat need to add hbase-site.xml in classpath (daijy via toffer)

Modified: 
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java?rev=1239962&r1=1239961&r2=1239962&view=diff
==============================================================================
--- 
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java
 (original)
+++ 
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileOutputFormatContainer.java
 Fri Feb  3 00:59:50 2012
@@ -67,7 +67,12 @@ class FileOutputFormatContainer extends 
 
     @Override
     public RecordWriter<WritableComparable<?>, 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

Modified: 
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java?rev=1239962&r1=1239961&r2=1239962&view=diff
==============================================================================
--- 
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java
 (original)
+++ 
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/mapreduce/FileRecordWriterContainer.java
 Fri Feb  3 00:59:50 2012
@@ -69,7 +69,6 @@ class FileRecordWriterContainer extends 
         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 @@ class FileRecordWriterContainer extends 
 
 
         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<Integer,HCatOutputStorageDriver>();
             this.baseDynamicWriters = new HashMap<Integer,RecordWriter<? super 
WritableComparable<?>, ? super Writable>>();
             this.baseDynamicCommitters = new 
HashMap<Integer,OutputCommitter>();


Reply via email to