Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
@@ -24,6 +24,8 @@
24 24
25 25 import org.apache.hadoop.fs.Path;
26 26 import org.apache.hadoop.hive.common.FileUtils;
  27 +import org.apache.hadoop.hive.howl.common.ErrorType;
  28 +import org.apache.hadoop.hive.howl.common.HowlException;
27 29 import org.apache.hadoop.hive.howl.data.HowlRecord;
28 30 import org.apache.hadoop.hive.howl.data.schema.HowlSchema;
29 31 import org.apache.hadoop.io.Writable;
@@ -115,10 +117,27 @@ public String getPartitionLocation(JobContext jobContext,
115 117 values.add(partitionValues.get(partitionCol));
116 118 }
117 119
118   - String partitionLocation = FileUtils.makePartName(partitionCols, values);
  120 + String partitionLocation = makePartName(partitionCols, values);
119 121
120 122 Path path = new Path(tableLocation, partitionLocation);
121 123 return path.toString();
122 124 }
123 125
  126 + protected String makePartName(List<String> partCols,
  127 + List<String> vals) throws HowlException {
  128 + if(partCols.size() != vals.size()) {
  129 + throw new HowlException(ErrorType.ERROR_INVALID_PARTITION_VALUES,
  130 + "Table has " + partCols.size() + " partition keys, got "+
  131 + vals.size());
  132 + }
  133 + StringBuilder name = new StringBuilder();
  134 + for (int i = 0; i < partCols.size(); i++) {
  135 + if (i > 0) {
  136 + name.append(Path.SEPARATOR);
  137 + }
  138 + name.append(FileUtils.escapePathName(vals.get(i)));
  139 + }
  140 + return name.toString();
  141 + }
  142 +
124 143 }

0 comments on commit 3d2089f

Please sign in to comment.
Something went wrong with that request. Please try again.