difin commented on code in PR #5792: URL: https://github.com/apache/hive/pull/5792#discussion_r2087311018
########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergQueryCompactor.java: ########## @@ -96,16 +106,46 @@ public boolean run(CompactorContext context) throws IOException, HiveException, throw new HiveException(ErrorMsg.COMPACTION_NO_PARTITION); } } else { - long partitionHash = IcebergTableUtil.getPartitionHash(icebergTable, partSpec); + Pair<Integer, StructProjection> partSpecPair = + IcebergTableUtil.getPartitionSpecIdAndStruct(icebergTable, partSpec); Review Comment: Done, now not scanning `partitions` table anymore to get partition struct and spec id. The only thing I did differently is the condition on struct fields. instead of ```where `partition` = named_struct('field1','value1','field2','value2') ``` I implemented ```where `partition`.`field1` = 'value1' and `partition`.`field2` = 'value2' ``` because this is equivalent and the first variant doesn't work - the values in named_struct condition need to be of exact Iceberg types, it requires to type cast the values, I tried that, but I bumped into cases where it was not evident which type to use in casting in some cases. ``` SELECT * FROM default.ice_orc WHERE FILE__PATH IN (SELECT FILE_PATH FROM default.ice_orc.FILES WHERE partition = named_struct('dept_id',1)) failed with error message (responseCode = 10014, errorMessage = FAILED: CalciteSubquerySemanticException [Error 10014]: Line 1:140 Wrong arguments '1': Type mismatch in EQUAL(struct<dept_id:bigint>,struct<dept_id:int>), hiveErrorCode = 40000, SQLState = 42000, exception = Line 1:140 Wrong arguments '1': Type mismatch in EQUAL(struct<dept_id:bigint>,struct<dept_id:int>)) ``` > Iceberg partition values are strongly typed, and Hive is trying to compare a struct with a bigint field (struct<dept_id:bigint>) to a struct where you're passing an int (1, which is int by default in Hive). -- 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