From d3324512c8b30067ab1501226c32edfaf1bbb7d2 Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Mon, 11 May 2026 11:03:14 +0800 Subject: [PATCH 1/3] Split testDatabricksWriteStatsAsJsonEnabled into numeric and non-numeric type groups --- ...TestDeltaLakeCheckpointsCompatibility.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java index 5f7d27731425..79a7ff78b1f1 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java @@ -540,9 +540,17 @@ public void testTrinoWriteStatsAsJsonEnabled(String type, String inputValue, Dou testWriteStatsAsJsonEnabled(sql -> onTrino().executeQuery(sql), tableName, "delta.default." + tableName, type, inputValue, dataSize, distinctValues, nullsFraction, statsValue); } - @Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS}, dataProvider = "testDeltaCheckpointWriteStatsAsJson") + @Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS}, dataProvider = "testDeltaCheckpointWriteStatsAsJsonNumericTypes") @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH) - public void testDatabricksWriteStatsAsJsonEnabled(String type, String inputValue, Double nullsFraction, Object statsValue) + public void testDatabricksWriteStatsAsJsonEnabledNumericTypes(String type, String inputValue, Double nullsFraction, Object statsValue) + { + String tableName = "test_dl_checkpoints_write_stats_as_json_enabled_databricks_" + randomNameSuffix(); + testWriteStatsAsJsonEnabled(sql -> onDelta().executeQuery(sql), tableName, "default." + tableName, type, inputValue, null, null, nullsFraction, statsValue); + } + + @Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS}, dataProvider = "testDeltaCheckpointWriteStatsAsJsonNonNumericTypes") + @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH) + public void testDatabricksWriteStatsAsJsonEnabledNonNumericTypes(String type, String inputValue, Double nullsFraction, Object statsValue) { String tableName = "test_dl_checkpoints_write_stats_as_json_enabled_databricks_" + randomNameSuffix(); testWriteStatsAsJsonEnabled(sql -> onDelta().executeQuery(sql), tableName, "default." + tableName, type, inputValue, null, null, nullsFraction, statsValue); @@ -609,10 +617,9 @@ public Object[][] testTrinoCheckpointWriteStatsAsJson() } @DataProvider - public Object[][] testDeltaCheckpointWriteStatsAsJson() + public Object[][] testDeltaCheckpointWriteStatsAsJsonNumericTypes() { return new Object[][] { - {"boolean", "true", 0.0, null}, {"integer", "1", 0.0, "1"}, {"tinyint", "2", 0.0, "2"}, {"smallint", "3", 0.0, "3"}, @@ -621,6 +628,14 @@ public Object[][] testDeltaCheckpointWriteStatsAsJson() {"double", "1.0", 0.0, "1.0"}, {"decimal(3,2)", "3.14", 0.0, "3.14"}, {"decimal(30,1)", "12345", 0.0, "12345.0"}, + }; + } + + @DataProvider + public Object[][] testDeltaCheckpointWriteStatsAsJsonNonNumericTypes() + { + return new Object[][] { + {"boolean", "true", 0.0, null}, {"string", "'test'", 0.0, null}, {"binary", "X'65683F'", 0.0, null}, {"date", "date '2021-02-03'", 0.0, "2021-02-03"}, From c6d0d50187fdc0e28bbacd0b4312c0d1f976da90 Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Mon, 11 May 2026 11:08:05 +0800 Subject: [PATCH 2/3] Split testReadFromSchemaChangedDeepCloneTable into partitioned and non-partitioned tests --- .../deltalake/TestDeltaLakeCloneTableCompatibility.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCloneTableCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCloneTableCompatibility.java index 0b53392f68a6..e39a59381db8 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCloneTableCompatibility.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCloneTableCompatibility.java @@ -253,10 +253,17 @@ public void testReadFromSchemaChangedShallowCloneTable() @Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS}) @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH) - public void testReadFromSchemaChangedDeepCloneTable() + public void testReadFromSchemaChangedDeepCloneTablePartitioned() { // Deep Clone is not supported on Delta-Lake OSS testReadSchemaChangedCloneTable("DEEP", true); + } + + @Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS}) + @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH) + public void testReadFromSchemaChangedDeepCloneTableNonPartitioned() + { + // Deep Clone is not supported on Delta-Lake OSS testReadSchemaChangedCloneTable("DEEP", false); } From 7901937d7c8bb70937b183da71636688373e401a Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Wed, 13 May 2026 14:10:23 +0800 Subject: [PATCH 3/3] Reduce round trips for testDatabricksWriteStatsAsJsonEnabled Create the table with writeStatsAsJson=true directly instead of transitioning from struct format, dropping the ALTER TABLE and one INSERT. Reduces onDelta() calls from 5 to 3 per variant. --- .../TestDeltaLakeCheckpointsCompatibility.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java index 79a7ff78b1f1..9a628b3f6c70 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCheckpointsCompatibility.java @@ -565,8 +565,8 @@ private void testWriteStatsAsJsonEnabled(Consumer sqlExecutor, String ta "LOCATION 's3://%s/databricks-compatibility-test-%1$s' " + "TBLPROPERTIES (" + " delta.checkpointInterval = 2, " + - " delta.checkpoint.writeStatsAsJson = false, " + - " delta.checkpoint.writeStatsAsStruct = true)", + " delta.checkpoint.writeStatsAsJson = true, " + + " delta.checkpoint.writeStatsAsStruct = false)", tableName, type, bucketName); onDelta().executeQuery(createTableSql); @@ -575,18 +575,10 @@ private void testWriteStatsAsJsonEnabled(Consumer sqlExecutor, String ta sqlExecutor.accept("INSERT INTO " + qualifiedTableName + " SELECT " + inputValue); sqlExecutor.accept("INSERT INTO " + qualifiedTableName + " SELECT " + inputValue); - // SET TBLPROPERTIES increments checkpoint - onDelta().executeQuery("" + - "ALTER TABLE default." + tableName + " SET TBLPROPERTIES (" + - "'delta.checkpoint.writeStatsAsJson' = true, " + - "'delta.checkpoint.writeStatsAsStruct' = false)"); - - sqlExecutor.accept("INSERT INTO " + qualifiedTableName + " SELECT " + inputValue); - assertThat(onTrino().executeQuery("SHOW STATS FOR delta.default." + tableName)) .containsOnly(ImmutableList.of( row("col", dataSize, distinctValues, nullsFraction, null, statsValue, statsValue), - row(null, null, null, null, 3.0, null, null))); + row(null, null, null, null, 2.0, null, null))); } finally { dropDeltaTableWithRetry("default." + tableName);