deniskuzZ commented on code in PR #5541:
URL: https://github.com/apache/hive/pull/5541#discussion_r1883862612


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -271,6 +275,23 @@ public void preCreateTable(CreateTableRequest request) {
     setOrcOnlyFilesParam(hmsTable);
     // Remove hive primary key columns from table request, as iceberg doesn't 
support hive primary key.
     request.setPrimaryKeys(null);
+    addSortOrder(hmsTable, schema, catalogProperties);
+  }
+
+  private void addSortOrder(org.apache.hadoop.hive.metastore.api.Table 
hmsTable, Schema schema,
+      Properties properties) {
+    SortOrder.Builder sortOderBuilder = SortOrder.builderFor(schema);
+    hmsTable.getSd().getSortCols().forEach(item -> {
+      NullOrder nullOrder = item.getNullOrdering() == 
NullOrderingType.NULLS_FIRST ?
+          NullOrder.NULLS_FIRST : NullOrder.NULLS_LAST;
+      if (item.getOrder() == 0) {

Review Comment:
   ````
   sortOderBuilder.sortBy(
       item.getCol(), SortDirection.fromString(field.getOrder), nullOrder)
   ````



-- 
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