deniskuzZ commented on code in PR #6256:
URL: https://github.com/apache/hive/pull/6256#discussion_r2660828950
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/BaseHiveIcebergMetaHook.java:
##########
@@ -304,6 +298,44 @@ private boolean isZOrderJSON(String jsonString) {
}
}
+ /**
+ * Parses Hive SortFields JSON and returns the list of sort field
descriptors.
+ * This is a common utility method used by both CREATE TABLE and ALTER TABLE
flows.
+ *
+ * @param sortOrderJSONString The JSON string containing Hive SortFields
+ * @return List of SortFieldDesc, or null if parsing fails or JSON is empty
+ */
+ protected List<SortFieldDesc> parseSortFieldsJSON(String
sortOrderJSONString) {
+ if (Strings.isNullOrEmpty(sortOrderJSONString) ||
isZOrderJSON(sortOrderJSONString)) {
+ return null;
+ }
+
+ try {
+ SortFields sortFields =
JSON_OBJECT_MAPPER.reader().readValue(sortOrderJSONString, SortFields.class);
+ if (sortFields != null && !sortFields.getSortFields().isEmpty()) {
+ return sortFields.getSortFields();
+ }
+ } catch (Exception e) {
+ LOG.warn("Failed to parse sort order JSON: {}", sortOrderJSONString, e);
+ }
+ return null;
+ }
+
+ /**
+ * Converts Hive NullOrdering to Iceberg NullOrder.
+ */
+ protected static NullOrder convertNullOrder(NullOrdering nullOrdering) {
Review Comment:
protected?
--
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]