This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 72ac0111f2 [#8245] improvement: verify partitioning and sort order 
contents in Iceberg table tests (#8264)
72ac0111f2 is described below

commit 72ac0111f2957a75f3e93f35df4fe53d1d66871f
Author: 박용현 <[email protected]>
AuthorDate: Mon Aug 25 18:50:16 2025 +0900

    [#8245] improvement: verify partitioning and sort order contents in Iceberg 
table tests (#8264)
    
    ### What changes were proposed in this pull request?
    
    - Expanded `CatalogIcebergBaseIT` tests to verify contents of
    partitioning and sortOrders.
    
    ### Why are the changes needed?
    
    - Previous tests only checked length.
    
    Fix: #8245
    
    ### Does this PR introduce _any_ user-facing change?
    
    - No.
    
    ### How was this patch tested?
    
    (Please test your changes, and provide instructions on how to test it:
    1. If you add a feature or fix a bug, add a test to cover your changes.
    2. If you fix a flaky test, repeat it for many times to prove it works.)
    
    ---------
    
    Co-authored-by: Justin Mclean <[email protected]>
---
 .../integration/test/CatalogIcebergBaseIT.java        | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git 
a/catalogs/catalog-lakehouse-iceberg/src/test/java/org/apache/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java
 
b/catalogs/catalog-lakehouse-iceberg/src/test/java/org/apache/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java
index 269d2f32ac..1260d7d795 100644
--- 
a/catalogs/catalog-lakehouse-iceberg/src/test/java/org/apache/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java
+++ 
b/catalogs/catalog-lakehouse-iceberg/src/test/java/org/apache/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java
@@ -495,8 +495,7 @@ public abstract class CatalogIcebergBaseIT extends BaseIT {
     }
 
     // TODO add partitioning and sort order check
-    Assertions.assertEquals(partitioning.length, 
createdTable.partitioning().length);
-    Assertions.assertEquals(sortOrders.length, 
createdTable.sortOrder().length);
+    assertPartitioningAndSortOrder(partitioning, sortOrders, createdTable);
 
     Table loadTable = tableCatalog.loadTable(tableIdentifier);
     Assertions.assertEquals(tableName, loadTable.name());
@@ -511,8 +510,7 @@ public abstract class CatalogIcebergBaseIT extends BaseIT {
       assertColumn(columns[i], loadTable.columns()[i]);
     }
 
-    Assertions.assertEquals(partitioning.length, 
loadTable.partitioning().length);
-    Assertions.assertEquals(sortOrders.length, loadTable.sortOrder().length);
+    assertPartitioningAndSortOrder(partitioning, sortOrders, loadTable);
 
     // catalog load check
     org.apache.iceberg.Table table =
@@ -549,6 +547,19 @@ public abstract class CatalogIcebergBaseIT extends BaseIT {
                     sortOrders));
   }
 
+  private void assertPartitioningAndSortOrder(
+      Transform[] expectedPartitioning, SortOrder[] expectedSortOrders, Table 
actualTable) {
+    Assertions.assertArrayEquals(expectedPartitioning, 
actualTable.partitioning());
+    Assertions.assertEquals(expectedSortOrders.length, 
actualTable.sortOrder().length);
+    for (int i = 0; i < expectedSortOrders.length; i++) {
+      SortOrder expected = expectedSortOrders[i];
+      SortOrder actual = actualTable.sortOrder()[i];
+      Assertions.assertEquals(expected.expression().toString(), 
actual.expression().toString());
+      Assertions.assertEquals(expected.direction(), actual.direction());
+      Assertions.assertEquals(expected.nullOrdering(), actual.nullOrdering());
+    }
+  }
+
   @Test
   void testTimestampTypeConversion() {
 

Reply via email to