Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes in HowlOutputStorageDriver to create partition location based…

… only on partition values
  • Loading branch information...
commit 3d2089fdd0bb0254ab28746a48ce6eec8fc77d9f 1 parent fe2c2b1
pradeepkth pradeepkth authored
21 howl/src/java/org/apache/hadoop/hive/howl/mapreduce/HowlOutputStorageDriver.java
View
@@ -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();
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.