You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2019/07/30 16:35:07 UTC
[incubator-iceberg] branch master updated: Fix out of order Pig
partition fields (#326)
This is an automated email from the ASF dual-hosted git repository.
blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new 08e0873 Fix out of order Pig partition fields (#326)
08e0873 is described below
commit 08e087335203864b031fa85bd5296a9f5f535b50
Author: Daniel Weeks <dw...@apache.org>
AuthorDate: Tue Jul 30 09:35:01 2019 -0700
Fix out of order Pig partition fields (#326)
---
.../main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/pig/src/main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java b/pig/src/main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java
index ca2529b..e9b41ec 100644
--- a/pig/src/main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java
+++ b/pig/src/main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java
@@ -197,12 +197,16 @@ public class IcebergPigInputFormat<T> extends InputFormat<Void, T> {
if (hasJoinedPartitionColumns) {
Schema readSchema = TypeUtil.selectNot(projectedSchema, idColumns);
- Schema partitionSchema = TypeUtil.select(tableSchema, idColumns);
Schema projectedPartitionSchema = TypeUtil.select(projectedSchema, idColumns);
+ Map<String, Integer> partitionSpecFieldIndexMap = Maps.newHashMap();
+ for(int i=0; i<spec.fields().size(); i++) {
+ partitionSpecFieldIndexMap.put(spec.fields().get(i).name(), i);
+ }
+
for (Types.NestedField field : projectedPartitionSchema.columns()) {
int tupleIndex = projectedSchema.columns().indexOf(field);
- int partitionIndex = partitionSchema.columns().indexOf(field);
+ int partitionIndex = partitionSpecFieldIndexMap.get(field.name());
Object partitionValue = file.partition().get(partitionIndex, Object.class);
partitionValueMap.put(tupleIndex, convertPartitionValue(field.type(), partitionValue));