deniskuzZ commented on code in PR #5995: URL: https://github.com/apache/hive/pull/5995#discussion_r2284858080
########## iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java: ########## @@ -131,20 +134,68 @@ public static void updateHmsTableForIcebergTable( tbl.setParameters(parameters); } - private static void setCommonParameters( - String newMetadataLocation, - String uuid, - Set<String> obsoleteProps, - String currentLocation, - Map<String, String> parameters, - String tableType, - Schema schema, + public static SortOrder getSortOrder(Properties props, Schema schema) { + String sortOrderJsonString = props.getProperty(TableProperties.DEFAULT_SORT_ORDER); + return Strings.isNullOrEmpty(sortOrderJsonString) ? SortOrder.unsorted() : SortOrderParser.fromJson(schema, + sortOrderJsonString); + } + + /** + * Calculates the properties we would like to send to the catalog. + * <ul> + * <li>The base of the properties is the properties stored at the Hive Metastore for the given table + * <li>We add the {@link HiveRESTCatalogClient#LOCATION} as the table location + * <li>We add the {@link HiveRESTCatalogClient#NAME} as + * TableIdentifier defined by the database name and table name + * <li>We add the serdeProperties of the HMS table + * <li>We remove some parameters that we don't want to push down to the Iceberg table props + * </ul> + * @param hmsTable Table for which we are calculating the properties + * @return The properties we can provide for Iceberg functions + */ + public static Properties getCatalogProperties(org.apache.hadoop.hive.metastore.api.Table hmsTable) { Review Comment: you just introduced CatalogUtils, why not move there (i.e CatalogUtils.getProperties(hmsTable))? ########## iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java: ########## @@ -131,20 +134,68 @@ public static void updateHmsTableForIcebergTable( tbl.setParameters(parameters); } - private static void setCommonParameters( - String newMetadataLocation, - String uuid, - Set<String> obsoleteProps, - String currentLocation, - Map<String, String> parameters, - String tableType, - Schema schema, + public static SortOrder getSortOrder(Properties props, Schema schema) { + String sortOrderJsonString = props.getProperty(TableProperties.DEFAULT_SORT_ORDER); + return Strings.isNullOrEmpty(sortOrderJsonString) ? SortOrder.unsorted() : SortOrderParser.fromJson(schema, + sortOrderJsonString); + } + + /** + * Calculates the properties we would like to send to the catalog. + * <ul> + * <li>The base of the properties is the properties stored at the Hive Metastore for the given table + * <li>We add the {@link HiveRESTCatalogClient#LOCATION} as the table location + * <li>We add the {@link HiveRESTCatalogClient#NAME} as + * TableIdentifier defined by the database name and table name + * <li>We add the serdeProperties of the HMS table + * <li>We remove some parameters that we don't want to push down to the Iceberg table props + * </ul> + * @param hmsTable Table for which we are calculating the properties + * @return The properties we can provide for Iceberg functions + */ + public static Properties getCatalogProperties(org.apache.hadoop.hive.metastore.api.Table hmsTable) { Review Comment: you just introduced CatalogUtils, why not move there (i.e `CatalogUtils.getProperties(hmsTable)`)? -- 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