pvary commented on a change in pull request #3060:
URL: https://github.com/apache/hive/pull/3060#discussion_r816653572



##########
File path: 
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
##########
@@ -307,6 +328,41 @@ public boolean supportsPartitionTransform() {
     }).collect(Collectors.toList());
   }
 
+  @Override
+  public DynamicPartitionCtx createDPContext(HiveConf hiveConf, 
org.apache.hadoop.hive.ql.metadata.Table hmsTable)
+      throws SemanticException {
+    TableDesc tableDesc = Utilities.getTableDesc(hmsTable);
+    Table table = IcebergTableUtil.getTable(conf, tableDesc.getProperties());
+    if (table.spec().isUnpartitioned()) {
+      return null;
+    }
+    // Iceberg currently doesn't have publicly accessible partition transform 
information, hence use above string parse
+    List<PartitionTransformSpec> partitionTransformSpecs = 
getPartitionTransformSpec(hmsTable);
+
+    DynamicPartitionCtx dpCtx = new DynamicPartitionCtx(new LinkedHashMap<>(),
+        hiveConf.getVar(HiveConf.ConfVars.DEFAULTPARTITIONNAME),
+        hiveConf.getIntVar(HiveConf.ConfVars.DYNAMICPARTITIONMAXPARTSPERNODE));
+    List<Function<List<ExprNodeDesc>, ExprNodeDesc>> customSortExprs = new 
LinkedList<>();
+    dpCtx.setCustomSortExpressions(customSortExprs);
+
+    Map<String, Integer> fieldOrderMap = new HashMap<>();
+    List<Types.NestedField> fields = table.schema().columns();
+    for (int i = 0; i < fields.size(); ++i) {
+      fieldOrderMap.put(fields.get(i).name(), i);
+    }
+
+    for (PartitionTransformSpec spec : partitionTransformSpecs) {
+      int order = fieldOrderMap.get(spec.getColumnName());

Review comment:
       Is it possible to create 2 transforms for a single column?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to