andygrove commented on code in PR #7249:
URL: https://github.com/apache/datafusion-comet/pull/7249#discussion_r4696488153


##########
native/core/src/execution/memory_pools/mod.rs:
##########
@@ -94,22 +92,16 @@ fn create_pool(
     match pool_type {
         MemoryPoolType::GreedyUnified => {
             acquire_task_shared_pool(task_attempt_id, running_tasks, || {
-                Arc::new(SpillReplayPool::new(
-                    task_attempt_id,
-                    tracked(CometUnifiedMemoryPool::with_spark(spark())),
-                ))
+                tracked(CometUnifiedMemoryPool::with_spark(spark()))
             })
         }
         MemoryPoolType::FairUnified => {
             acquire_task_shared_pool(task_attempt_id, running_tasks, || {
-                Arc::new(SpillReplayPool::new(
-                    task_attempt_id,
-                    tracked(CometFairMemoryPool::with_spark(
-                        spark(),
-                        pool_size,
-                        off_heap_size,
-                        running_tasks.clone(),
-                    )),
+                tracked(CometFairMemoryPool::with_spark(

Review Comment:
   You're right. In 56.0.0, `get_sorted_spill_files_to_merge` asks for twice 
the buffers and then shrinks back to the accepted buffers before the replay 
(`multi_level_merge.rs:612-684`). The replay is a `Full` 
`ClusteredFinalAggregateStream` with no spill context, under the outer 
aggregate's consumer (`spill.rs:303-335`). Its only fallback is to emit 
completed groups, and it returns the error when the table holds one group. So 
both of your cases can still fail the task, and none of the #6254/#6857 tests 
reach either one. They all run one task with small groups.
   
   I put `SpillReplayPool` back and updated it for the 56 names: 
`FinalHashAggregateStream`, `ClusteredFinalAggregateStream`, 
`SingleHashAggregateStream`, and the new `ClusteredSingleAggregateStream`, 
which replays the same way. Its check that the consumer holds more than the 
growing reservation still identifies the replay in 56, because the merge's 
headroom check grows and shrinks a single reservation. I added a pool test for 
case 1, `..._may_pass_a_share_lowered_after_the_merge`: the merge probes and 
releases, a sort becomes active, and the replay's request goes past the lowered 
share. It fails without the wrapper. The module docs and the memory management 
guide now say why apache/datafusion#25383 isn't enough. (188f7cd6e3)



##########
.github/workflows/pr_build_linux.yml:
##########
@@ -484,13 +484,16 @@ jobs:
   # native/native-executors, the Comet Native Executors cluster (issue #7288),
   # is a Cargo workspace of its own so that the main build never depends on
   # Ballista. linux-test-rust doesn't build it, so this job does, and the lint
-  # job checks its formatting. When Comet moves to a DataFusion major that
-  # Ballista hasn't released yet, the upgrade can turn this job off until
-  # Ballista catches up.
+  # job checks its formatting. The job is turned off because Comet is pinned
+  # to DataFusion's 56.0.0 tag and Ballista main is still on its 56.0.0-rc1
+  # tag, so the build has two copies of DataFusion. Turn it back on, by
+  # restoring the `if:` below, once the Ballista pin in
+  # native/native-executors/Cargo.toml is on the 56.0.0 tag.
   linux-test-native-executors:
     needs: lint
     name: ubuntu-latest/native-executors
-    if: ${{ !inputs.cache-refresh-only && inputs.profiles != 'nightly' }}
+    # if: ${{ !inputs.cache-refresh-only && inputs.profiles != 'nightly' }}
+    if: false

Review Comment:
   Ballista `main` is on the DataFusion 56.0.0 release now, so I moved 
`native/native-executors` to Ballista `5a387e1`, and DataFusion and 
`datafusion-proto` to 56.0.0 from crates.io. The workspace resolves one copy of 
DataFusion again and builds and passes clippy locally, so the job is back on 
with main's original `if:`. The comments in the workflow and in 
`native-executors/Cargo.toml` are updated too. (ad6ed8c602)



##########
native/core/src/parquet/parquet_exec.rs:
##########
@@ -839,6 +841,7 @@ mod tests {
     /// Spark's string type as those types, not as `Binary`. A malformed value 
must still decode
     /// to U+FFFD.
     #[tokio::test]
+    #[ignore = "DataFusion 56 coerces nested BINARY to unvalidated Utf8: 
https://github.com/apache/datafusion-comet/issues/7469";]

Review Comment:
   The plan is a backport. apache/datafusion#27067 cherry-picks cleanly onto 
`branch-56`, and its tests pass there. I opened apache/datafusion#27754 to 
backport it, so that it can go into a 56.0.1. This PR stays a draft until Comet 
can use that release. Then the two ignored tests go back on.



##########
native/Cargo.toml:
##########
@@ -85,9 +85,13 @@ aws-credential-types = "1.2.13"
 aws-sdk-sts = { version = "1.114.0", default-features = false }
 # Pinned to a revision rather than a release because no published iceberg-rust
 # version is on our arrow: 0.10.1 requires arrow/parquet ^58. Move to a plain
-# version requirement once a release ships on arrow 59. Bump policy: #5645.
-iceberg = { git = "https://github.com/apache/iceberg-rust";, rev = 
"de0a6ac8471da43f63382d66fac27d7e56fd273e" }
-iceberg-storage-opendal = { git = "https://github.com/apache/iceberg-rust";, 
rev = "de0a6ac8471da43f63382d66fac27d7e56fd273e", features = ["opendal-memory", 
"opendal-fs", "opendal-s3", "opendal-gcs", "opendal-oss", "opendal-azdls", 
"opendal-hdfs-native"] }
+# version requirement once a release ships on arrow 60. Bump policy: #5645.
+# The revision is on the andygrove/iceberg-rust fork: apache/iceberg-rust#3257 
(Arrow 60,

Review Comment:
   Done. The fork is gone, and the pin is now `219078c` on iceberg-rust `main`, 
which includes apache/iceberg-rust#3257 and apache/iceberg-rust#3539. I stopped 
one commit short of the current head: `986153c` moves iceberg-rust to opendal 
0.59, and Comet's own `opendal` and `object_store_opendal` would have to move 
with it, so I'd rather do that in its own PR. Two iceberg-rust API changes came 
along: reader settings now go through `ArrowReaderOptions`, and 
`FileScanTaskDeleteFile::file_size_in_bytes` is an `Option`. (5c04cc9252)



##########
native/core/src/execution/planner/aggregate.rs:
##########
@@ -256,15 +256,15 @@ impl OperatorBuilder for HashAggBuilder {
 
         // DataFusion 55 runs Single over input sorted on some of its keys 
with the legacy
         // GroupedHashAggregateStream, whose spill can fail against the fair 
limit (#6880). Final
-        // runs an OrderedFinalAggregateStream there, which spills, and which 
the fair pool exempts
+        // runs a ClusteredFinalAggregateStream there, which spills, and which 
the fair pool exempts
         // from that limit (`limited_to_its_share`). MergeAsPartial evaluates 
to its state under
         // Final as under Single.
         // Only partially sorted input switches: with fully sorted input Final 
has no spill path.
         // Final also reads states from the columns after the keys, so the 
input must be the keys
         // followed by native states (Spark's binary collect buffers keep 
Single, and arrive
         // unordered anyway).
         // Drop this on DataFusion 56, where the stream is 
ClusteredFinalAggregateStream

Review Comment:
   Not for the reason it gives. On 56, `Single` over partially sorted input 
runs `ClusteredSingleAggregateStream` (`mod.rs:1422-1428`, with 
`enable_migration_aggregate` defaulting to true), which spills, and 
`SpillReplayPool` now covers its replay. What `Final` still gets is the name 
exemption in `limited_to_its_share`. Removing the switch also means removing 
the `Final` path in `merge_as_partial.rs`, and the #6880 JVM tests need to 
confirm it, so I filed #7765 for that. The comment now says why the switch 
exists and links the issue. (11002211a3)



##########
native/core/src/execution/delta_dv.rs:
##########
@@ -2154,6 +2160,9 @@ mod tests {
         // `out[0]`'s extensions) and the clone are live at once, exactly like 
the real reader.
         let cloned_plan = attached_plan.clone();
         let metadata = read_metadata_with_page_index(&path);
+        // Deprecated in DataFusion 56 in favor of row-group-local entries; 
these tests still model

Review Comment:
   It still bounds it. In 56, `ParquetAccessPlan::prepare` moves each row 
group's selection into the push decoder (`access_plan.rs:633-693`, 
`opener/mod.rs:1761-1773`), so the combined selection that term 3 modelled is 
no longer allocated. What replaced it is the decoder's `peek_next_row_group` 
clone of the remaining row groups at row-group boundaries (exact-length) and 
the active row group's clone. Both are at most `selectors`, which is less than 
term 3's `2 * selectors + 6 * num_row_groups`. So the bound is a little looser 
than before, but still an upper bound. I updated the doc comments on 
`reader_peak_bytes` and on the reservation, and the comments on the three 
tests, to say so. (8ebda31a32)



##########
native/spark-expr/src/hash_funcs/xxhash64.rs:
##########
@@ -44,9 +44,11 @@ const SPARK_DEFAULT_SEED: i64 = 42;
 /// Compatible arguments at the default seed are delegated to 
`datafusion-spark`'s
 /// `SparkXxhash64`. The Comet kernel is kept for:
 /// - a non-default seed (`SparkXxhash64` always starts from 42)
-/// - `Struct` (and anything containing one): `SparkXxhash64` does not push a 
parent null
-///   mask into children, so hidden values of a NULL struct would affect the 
hash
-/// - a `Dictionary` nested in a list/map: `SparkXxhash64` restarts those 
hashes from 42
+/// - `Struct` (and anything containing one): before DataFusion 56, 
`SparkXxhash64` did not push
+///   a parent null mask into children, so hidden values of a NULL struct 
would affect the hash
+///   (fixed by apache/datafusion#25774)

Review Comment:
   Filed #7764 and linked it from the comment. Widening the routing changes 
which kernel runs for struct and nested dictionary input, so it should come 
with benchmarks of both kernels. I'd rather keep that out of the upgrade. 
(11002211a3)



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

Reply via email to