okumin commented on code in PR #5792:
URL: https://github.com/apache/hive/pull/5792#discussion_r2074755644


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergQueryCompactor.java:
##########
@@ -88,28 +89,30 @@ public boolean run(CompactorContext context) throws 
IOException, HiveException,
         // added another filter on file_path as a workaround.
         compactionQuery = String.format("insert overwrite table %1$s select * 
from %1$s " +
                 "where %2$s != %3$d and %4$s is not null %5$s %6$s",
-            compactTableName, VirtualColumn.PARTITION_SPEC_ID.getName(), 
icebergTable.spec().specId(),
+            qualifiedTableName, VirtualColumn.PARTITION_SPEC_ID.getName(), 
icebergTable.spec().specId(),
             VirtualColumn.FILE_PATH.getName(), fileSizePredicate == null ? "" 
: "and " + fileSizePredicate, orderBy);
       } else {
         // Partitioned table without partition evolution with partition spec 
as null in the compaction request - this
         // code branch is not supposed to be reachable
         throw new HiveException(ErrorMsg.COMPACTION_NO_PARTITION);
       }
     } else {
-      long partitionHash = IcebergTableUtil.getPartitionHash(icebergTable, 
partSpec);
+      int partitionSpecId = IcebergTableUtil.getPartitionSpecId(icebergTable, 
partSpec);
       HiveConf.setVar(conf, ConfVars.REWRITE_POLICY, 
RewritePolicy.PARTITION.name());
       conf.set(IcebergCompactionService.PARTITION_PATH, new 
Path(partSpec).toString());
 
       Map<String, String> partSpecMap = new LinkedHashMap<>();
       Warehouse.makeSpecFromName(partSpecMap, new Path(partSpec), null);
 
-      compactionQuery = String.format("insert overwrite table %1$s select * 
from %1$s where %2$s=%3$d " +
-              "and %4$s is not null %5$s %6$s", compactTableName, 
VirtualColumn.PARTITION_HASH.getName(), partitionHash,
-          VirtualColumn.FILE_PATH.getName(), fileSizePredicate == null ? "" : 
"and " + fileSizePredicate, orderBy);
+      compactionQuery = String.format("INSERT OVERWRITE TABLE %1$s SELECT * 
FROM %1$s " +
+              "WHERE %2$s LIKE '%%/%3$s/data/%4$s/%%' AND %5$s = %6$d %7$s 
%8$s",

Review Comment:
   `'%%/%3$s/data/%4$s/%%'` assumes a strict file structure. In case that users 
performed the in-place migration, the file name can't follow the convention. It 
sounds acceptable at this point. We may add a new virtual column in the future.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to