deniskuzZ commented on code in PR #5961: URL: https://github.com/apache/hive/pull/5961#discussion_r2223067758
########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java: ########## @@ -392,27 +396,47 @@ public static void cherryPick(Table table, long snapshotId) { } public static boolean isV2Table(Map<String, String> props) { - return props == null || - "2".equals(props.get(TableProperties.FORMAT_VERSION)) || props.get(TableProperties.FORMAT_VERSION) == null; + return IcebergTableUtil.formatVersion(props) >= 2; } - public static boolean isCopyOnWriteMode(Context.Operation operation, BinaryOperator<String> props) { - String mode = null; - switch (operation) { - case DELETE: - mode = props.apply(TableProperties.DELETE_MODE, - TableProperties.DELETE_MODE_DEFAULT); - break; - case UPDATE: - mode = props.apply(TableProperties.UPDATE_MODE, - TableProperties.UPDATE_MODE_DEFAULT); - break; - case MERGE: - mode = props.apply(TableProperties.MERGE_MODE, - TableProperties.MERGE_MODE_DEFAULT); - break; + public static boolean isV2Table(BinaryOperator<String> props) { + return IcebergTableUtil.formatVersion(props) >= 2; + } + + public static Integer formatVersion(Map<String, String> props) { + if (props == null) { + return 2; // default to V2 } - return RowLevelOperationMode.COPY_ON_WRITE.modeName().equalsIgnoreCase(mode); + return IcebergTableUtil.formatVersion(props::getOrDefault); + } + + private static Integer formatVersion(BinaryOperator<String> props) { Review Comment: we don't always have a Map, sometimes it's a Properties object -- 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