Permalink
Browse files

Changes in HowlOutputStorageDriver to create partition location based…

… only on partition values
  • Loading branch information...
1 parent fe2c2b1 commit 3d2089fdd0bb0254ab28746a48ce6eec8fc77d9f @pradeepkth pradeepkth committed Nov 10, 2010
Showing with 20 additions and 1 deletion.
  1. +20 −1 howl/src/java/org/apache/hadoop/hive/howl/mapreduce/HowlOutputStorageDriver.java
View
21 howl/src/java/org/apache/hadoop/hive/howl/mapreduce/HowlOutputStorageDriver.java
@@ -24,6 +24,8 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.common.FileUtils;
+import org.apache.hadoop.hive.howl.common.ErrorType;
+import org.apache.hadoop.hive.howl.common.HowlException;
import org.apache.hadoop.hive.howl.data.HowlRecord;
import org.apache.hadoop.hive.howl.data.schema.HowlSchema;
import org.apache.hadoop.io.Writable;
@@ -115,10 +117,27 @@ public String getPartitionLocation(JobContext jobContext,
values.add(partitionValues.get(partitionCol));
}
- String partitionLocation = FileUtils.makePartName(partitionCols, values);
+ String partitionLocation = makePartName(partitionCols, values);
Path path = new Path(tableLocation, partitionLocation);
return path.toString();
}
+ protected String makePartName(List<String> partCols,
+ List<String> vals) throws HowlException {
+ if(partCols.size() != vals.size()) {
+ throw new HowlException(ErrorType.ERROR_INVALID_PARTITION_VALUES,
+ "Table has " + partCols.size() + " partition keys, got "+
+ vals.size());
+ }
+ StringBuilder name = new StringBuilder();
+ for (int i = 0; i < partCols.size(); i++) {
+ if (i > 0) {
+ name.append(Path.SEPARATOR);
+ }
+ name.append(FileUtils.escapePathName(vals.get(i)));
+ }
+ return name.toString();
+ }
+
}

0 comments on commit 3d2089f

Please sign in to comment.