felipepessoto commented on code in PR #13704:
URL: https://github.com/apache/gluten/pull/13704#discussion_r4703231157
##########
.github/workflows/util/delta-spark-ut/patches/data-skipping-stats-file-layout.patch:
##########
@@ -0,0 +1,51 @@
+Subject: [PATCH] Give data-skipping statistics fixtures a deterministic file
layout
+
+The flags and before/after OPTIMIZE tests assert per-file statistics, but
+repartition(2) does not specify which IDs go in each file. Spark and the
+Gluten columnar shuffle can produce different valid round-robin layouts.
+Create the range with two partitions and no shuffle. The two files now
+contain IDs 0-4 and 5-9; update their expected counts and bounds. The file
+pruning and post-OPTIMIZE checks stay unchanged.
+
+Remove this patch when the pinned Delta tests no longer rely on an
+incidental round-robin layout.
+
+diff --git
a/spark/src/test/scala/org/apache/spark/sql/delta/stats/DataSkippingDeltaTests.scala
b/spark/src/test/scala/org/apache/spark/sql/delta/stats/DataSkippingDeltaTests.scala
+---
a/spark/src/test/scala/org/apache/spark/sql/delta/stats/DataSkippingDeltaTests.scala
++++
b/spark/src/test/scala/org/apache/spark/sql/delta/stats/DataSkippingDeltaTests.scala
+@@ -1064,15 +1064,14 @@ trait DataSkippingDeltaTests extends
DataSkippingDeltaTestsBase
+ "OPTIMIZE is blocked on catalog-managed tables")
+ val t = "ds_stats_before_after_optimize"
+ withTable(t) {
+- val (numTuples, numFiles) = (10, 2)
+- val data = spark.range(0, numTuples, 1, 2).repartition(numFiles)
++ val data = spark.range(0, 10, 1, numPartitions = 2)
+ data.write.format("delta").saveAsTable(t)
+ var r = checkpointAndCreateNewLogIfNecessary(
+ DeltaLog.forTable(spark, TableIdentifier(t)))
+ def rStats: DataFrame =
+ getStatsDf(r, $"numRecords", $"minValues.id".as("id_min"),
$"maxValues.id".as("id_max"))
+
+- checkAnswer(rStats, Seq(Row(4, 0, 8), Row(6, 1, 9)))
++ checkAnswer(rStats, Seq(Row(5, 0, 4), Row(5, 5, 9)))
Review Comment:
My earlier note that the statistics assertions were unchanged was out of
date. Both tests now expect `(count, min, max)` of `(5, 0, 4)` and `(5, 5, 9)`.
The pruning and compaction checks are unchanged: `id = 0` reads 4 files with
skipping off and 3 with it on, and `OPTIMIZE` leaves one file with `(10, 0,
9)`. The PR description and README now make that distinction.
I applied the patch from `19488e74f` to Delta 4.4.1 and verified that the
resulting Scala source was byte-for-byte identical to the one tested with this
PR’s Spark 4.1 Velox bundle. All 14 flags cases and all 8 OPTIMIZE cases ran
and passed; none were skipped. The strict gate flagged exactly those 22 as
now-passing against the old 171-entry baseline and passed against the 149-entry
baseline. The separate [full CI
run](https://github.com/apache/gluten/actions/runs/45741425168) is still in
progress.
--
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]