You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "mzabaluev (via GitHub)" <gi...@apache.org> on 2026/07/16 18:10:27 UTC

[PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

mzabaluev opened a new pull request, #23648:
URL: https://github.com/apache/datafusion/pull/23648

   ## Which issue does this PR close?
   
   - Part of #22682.
   
   ## Rationale for this change
   
   This adds column-native `GroupColumn` implementations for `List<T>` and `LargeList<T>`, so a `GROUP BY` containing these (along with other supported data types) no longer falls back from `GroupValuesColumn` to `GroupValuesRows`.
   
   ## What changes are included in this PR?
   
   Cherry-picked @zhuqi-lucas's changes in #22706 that pertained to `List` / `LargeList`, and made some optimizations.
   
   ## Are these changes tested?
   
   Cherry-picked the unit tests for the `list` module from #22706.
   Added supported/unsupported cases for `List` in the `group_column_supported_type_matches_make_group_column` test.
   
   Benchmarked in a proprietary application using several HashAggregate operations on 20 columns including two string lists, to about 8% cumulative improvement.
   
   ## Are there any user-facing changes?
   
   No.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5558410598

   🤖 Benchmark running (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5558396112)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5558396112-2154-cg82r 6.12.94+ #1 SMP Fri Jul 17 09:42:57 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing nested-group-column-for-lists (6f73226c277e9b36b070c77da99678eed904a5f6) to 3a4c310 (merge-base) [diff](https://github.com/apache/datafusion/compare/3a4c310da72ea419e777bf56bbedaf1fb83e087e..6f73226c277e9b36b070c77da99678eed904a5f6)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506959295

   🤖 Benchmark running (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5506924659)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5506924659-2080-cpphr 6.12.94+ #1 SMP Fri Jul 17 09:42:57 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing nested-group-column-for-lists (6f73226c277e9b36b070c77da99678eed904a5f6) to 3a4c310 (merge-base) [diff](https://github.com/apache/datafusion/compare/3a4c310da72ea419e777bf56bbedaf1fb83e087e..6f73226c277e9b36b070c77da99678eed904a5f6)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3602302229


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -218,20 +214,11 @@ impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
         let cut_offset = self.offsets[n];
         let cut = cut_offset.as_usize();
 
-        // First-n offsets: 0, off[1], ..., off[n].
-        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
-
-        // Remaining offsets shifted so that what was offsets[n] becomes 0.
-        // Overwrite the array in place.
-        // SAFETY: the write range is at most as large as offsets.len().
-        // Values in the possible overlap are read before being overwritten.
-        unsafe {
-            let dst = self.offsets.as_mut_ptr();
-            for (i, &off) in self.offsets[n..].iter().enumerate() {
-                *dst.add(i) = off - cut_offset;
-            }
-        }
-        self.offsets.truncate(self.offsets.len() - n);

Review Comment:
   @KonaeAkira if we're going into micro-benchmarking territory, the previous code might be better in smaller take case when the remaining vector is drained in place, because it's subtract-while-copying vs. copy, then subtract in place. But this highly depends on vectorization, and the other case benefits from a smaller alloc-and-copy. Maybe there needs to be another split helper with a map closure to address both cases.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "KonaeAkira (via GitHub)" <gi...@apache.org>.
KonaeAkira commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3602428224


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -218,20 +214,11 @@ impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
         let cut_offset = self.offsets[n];
         let cut = cut_offset.as_usize();
 
-        // First-n offsets: 0, off[1], ..., off[n].
-        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
-
-        // Remaining offsets shifted so that what was offsets[n] becomes 0.
-        // Overwrite the array in place.
-        // SAFETY: the write range is at most as large as offsets.len().
-        // Values in the possible overlap are read before being overwritten.
-        unsafe {
-            let dst = self.offsets.as_mut_ptr();
-            for (i, &off) in self.offsets[n..].iter().enumerate() {
-                *dst.add(i) = off - cut_offset;
-            }
-        }
-        self.offsets.truncate(self.offsets.len() - n);

Review Comment:
   One more thing that just occurred to me: `split_vec_min_alloc(&mut self.offsets, n)` returns a vector with exact capacity in case `n * 2 <= self.offsets.len()`:
   
   https://github.com/apache/datafusion/blob/fb8fe7ae61efc12c6c09a00d025e35c750e2ee86/datafusion/common/src/utils/mod.rs#L405-L412
   
   in which case `first_n_offsets.push(cut_offset);` will always reallocate, which is bad.
   
   Maybe a separate PR can address this. This affects `bytes.rs` as well.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5226207774

   <!-- semver-check-comment -->
   Thank you for opening this pull request!
   
   Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks) reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).
   
   <details>
   <summary>Details</summary>
   
   ```
        Cloning apache/main
       Building datafusion-physical-plan v54.1.0 (current)
          Built [  44.418s] (current)
        Parsing datafusion-physical-plan v54.1.0 (current)
         Parsed [   0.142s] (current)
       Building datafusion-physical-plan v54.1.0 (baseline)
          Built [  37.205s] (baseline)
        Parsing datafusion-physical-plan v54.1.0 (baseline)
         Parsed [   0.142s] (baseline)
       Checking datafusion-physical-plan v54.1.0 -> v54.1.0 (no change; assume patch)
        Checked [   0.687s] 223 checks: 221 pass, 2 fail, 0 warn, 30 skip
   
   --- failure inherent_method_missing: pub method removed or renamed ---
   
   Description:
   A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
           ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
          impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/inherent_method_missing.ron
   
   Failed in:
     ProjectionExec::try_new_with_schema_metadata, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/4acdc9b4283f42eae33126e3915abf7a7f0c6e73/datafusion/physical-plan/src/projection.rs:157
   
   --- failure trait_method_missing: pub trait method removed or renamed ---
   
   Description:
   A trait method is no longer callable, and may have been renamed or removed entirely.
           ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
          impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/trait_method_missing.ron
   
   Failed in:
     method dynamic_expressions_produced of trait ExecutionPlan, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/4acdc9b4283f42eae33126e3915abf7a7f0c6e73/datafusion/physical-plan/src/execution_plan.rs:181
     method dynamic_expressions_produced of trait ExecutionPlan, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/4acdc9b4283f42eae33126e3915abf7a7f0c6e73/datafusion/physical-plan/src/execution_plan.rs:181
   
        Summary semver requires new major version: 2 major and 0 minor checks failed
       Finished [  84.369s] datafusion-physical-plan
   ```
   
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "KonaeAkira (via GitHub)" <gi...@apache.org>.
KonaeAkira commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3601347169


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);

Review Comment:
   Nit: why convert `self.current_end()` to `usize` and then convert back to `O` when you can do just one conversion by converting `additional` to `O` and doing the `checked_add` on `O`?
   
   Makes the logic a bit easier to follow.
   
   ```suggestion
           let additional = O::from_usize(additional).ok_or_else(|| {
               internal_datafusion_err!(
                   "List sublist length {additional} overflows the offset type"
               )
           })?;
           let next = self.current_end().checked_add(&additional).ok_or_else(|| {
               internal_datafusion_err!(
                   "List offset overflow: current={} additional={}",
                   self.current_end(),
                   additional
               )
           })?;
           self.offsets.push(next);
   ```



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3602302229


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -218,20 +214,11 @@ impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
         let cut_offset = self.offsets[n];
         let cut = cut_offset.as_usize();
 
-        // First-n offsets: 0, off[1], ..., off[n].
-        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
-
-        // Remaining offsets shifted so that what was offsets[n] becomes 0.
-        // Overwrite the array in place.
-        // SAFETY: the write range is at most as large as offsets.len().
-        // Values in the possible overlap are read before being overwritten.
-        unsafe {
-            let dst = self.offsets.as_mut_ptr();
-            for (i, &off) in self.offsets[n..].iter().enumerate() {
-                *dst.add(i) = off - cut_offset;
-            }
-        }
-        self.offsets.truncate(self.offsets.len() - n);

Review Comment:
   @KonaeAkira if we're going into micro-benchmarking territory, the previous code might be better in smaller take case when the remaining vector is drained in place, because it's subtract-while-copying vs. copy, then subtract in place. But this highly depends on vectorization and the other case benefits from smaller alloc-and-copy. Maybe there needs to be another split helper with a map closure to address both cases.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5497506950

   run benchmark multi_group_by


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "KonaeAkira (via GitHub)" <gi...@apache.org>.
KonaeAkira commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3598984214


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:
##########
@@ -1067,6 +1072,20 @@ fn make_group_column(field: &Field) -> Result<Box<dyn GroupColumn>> {
                 v.push(Box::new(BooleanGroupValueBuilder::<false>::new()));
             }
         }
+        DataType::List(child_field) => {
+            let child = make_group_column(child_field.as_ref())?;
+            v.push(Box::new(list::ListGroupValueBuilder::<i32>::new(
+                Arc::clone(child_field),
+                child,
+            )));
+        }

Review Comment:
   I'm not sure about using `ListGroupValueBuilder::<i32>`. What happens when the concatenated length of all the children exceeds `i32::MAX`? I think `ListGroupValueBuilder` should drop the `O: OffsetSizeTrait` generic and always use `usize` to store its offsets.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506337172

   @adriangb Do you have any idea why it is unable to run the benchmarks?
   there is no explaination and it works localy for


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506298560

   
   run benchmark multi_group_by
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506335076

   🤖 Benchmark running (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5506298560)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5506298560-2079-g946q 6.12.94+ #1 SMP Fri Jul 17 09:42:57 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing nested-group-column-for-lists (c701d0449b953f4fe3756eac85472bc86db669fd) to da89c7c (merge-base) [diff](https://github.com/apache/datafusion/compare/da89c7c85b1c888ba4038317eacbdcfe03ab9b1a..c701d0449b953f4fe3756eac85472bc86db669fd)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5497541183

   Benchmark for [this request](https://github.com/apache/datafusion/pull/23648#issuecomment-5497506950) failed before finishing (Kubernetes reason: `BackoffLimitExceeded`).
   
   Benchmarks requested: `multi_group_by`
   
   <details><summary>Kubernetes message</summary>
   
   ```
   Job has reached the specified backoff limit
   ```
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3599338099


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:
##########
@@ -1067,6 +1072,20 @@ fn make_group_column(field: &Field) -> Result<Box<dyn GroupColumn>> {
                 v.push(Box::new(BooleanGroupValueBuilder::<false>::new()));
             }
         }
+        DataType::List(child_field) => {
+            let child = make_group_column(child_field.as_ref())?;
+            v.push(Box::new(list::ListGroupValueBuilder::<i32>::new(
+                Arc::clone(child_field),
+                child,
+            )));
+        }

Review Comment:
   As I understand it, the `build`/`take_n` of this builder must produce a `ListArray`, with `i32` offsets. So an overflow would result in an error.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3597889534


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,857 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(&self, lhs_row: usize, array: &GenericListArray<O>, rhs_row: usize) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }

Review Comment:
   Would it be worthwhile to use `vectorized_equal_to` here, maybe with chunked iteration?



##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,857 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(&self, lhs_row: usize, array: &GenericListArray<O>, rhs_row: usize) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }
+        true
+    }
+
+    fn append_val_typed(&mut self, array: &GenericListArray<O>, row: usize) -> Result<()> {
+        if array.is_null(row) {
+            self.outer_nulls.append(true);
+            // Zero-length range for null outer rows: do not push any child
+            // elements, and the offset for the next row stays the same.
+            let end = self.current_end();
+            self.offsets.push(end);
+        } else {
+            self.outer_nulls.append(false);
+            let sublist: ArrayRef = array.value(row);
+            let n = sublist.len();
+            for j in 0..n {
+                self.child.append_val(&sublist, j)?;
+            }

Review Comment:
   Likewise, a case for `vectorized_append`?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "KonaeAkira (via GitHub)" <gi...@apache.org>.
KonaeAkira commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3601232493


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(
+        &self,
+        lhs_row: usize,
+        array: &GenericListArray<O>,
+        rhs_row: usize,
+    ) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }
+        true
+    }
+
+    fn append_val_typed(
+        &mut self,
+        array: &GenericListArray<O>,
+        row: usize,
+    ) -> Result<()> {
+        if array.is_null(row) {
+            self.outer_nulls.append(true);
+            // Zero-length range for null outer rows: do not push any child
+            // elements, and the offset for the next row stays the same.
+            let end = self.current_end();
+            self.offsets.push(end);
+        } else {
+            self.outer_nulls.append(false);
+            let sublist: ArrayRef = array.value(row);
+            let n = sublist.len();
+            for j in 0..n {
+                self.child.append_val(&sublist, j)?;
+            }
+            self.push_offset(n)?;
+        }
+        self.outer_len += 1;
+        Ok(())
+    }
+}
+
+impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
+    fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
+        self.equal_to_typed(lhs_row, Self::list_array(array), rhs_row)
+    }
+
+    fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()> {
+        self.append_val_typed(Self::list_array(array), row)
+    }
+
+    fn vectorized_equal_to(
+        &self,
+        lhs_rows: &[usize],
+        array: &ArrayRef,
+        rhs_rows: &[usize],
+        equal_to_results: &mut BooleanBufferBuilder,
+    ) {
+        let l = Self::list_array(array);
+        for (idx, (&lhs_row, &rhs_row)) in
+            lhs_rows.iter().zip(rhs_rows.iter()).enumerate()
+        {
+            if !equal_to_results.get_bit(idx) {
+                continue;
+            }
+            if !self.equal_to_typed(lhs_row, l, rhs_row) {
+                equal_to_results.set_bit(idx, false);
+            }
+        }
+    }
+
+    fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()> {
+        let l = Self::list_array(array);
+        for &row in rows {
+            self.append_val_typed(l, row)?;
+        }
+        Ok(())
+    }
+
+    fn len(&self) -> usize {
+        self.outer_len
+    }
+
+    fn size(&self) -> usize {
+        self.offsets.allocated_size()
+            + self.outer_nulls.allocated_size()
+            + self.child.size()
+    }
+
+    fn build(self: Box<Self>) -> ArrayRef {
+        let Self {
+            field,
+            offsets,
+            child,
+            mut outer_nulls,
+            outer_len: _,
+        } = *self;
+        let outer_nulls =
+            std::mem::replace(&mut outer_nulls, MaybeNullBufferBuilder::new()).build();
+        let child_array = child.build();
+        // SAFETY: offsets are constructed monotonically by `push_offset` /
+        // initial `[0]`, and child_array length matches the final offset.
+        let offset_buffer = OffsetBuffer::<O>::new(ScalarBuffer::<O>::from(offsets));
+        Arc::new(GenericListArray::<O>::new(
+            field,
+            offset_buffer,
+            child_array,
+            outer_nulls,
+        ))
+    }
+
+    fn take_n(&mut self, n: usize) -> ArrayRef {
+        // Number of child elements consumed by the first n outer rows.
+        let cut_offset = self.offsets[n];
+        let cut = cut_offset.as_usize();
+
+        // First-n offsets: 0, off[1], ..., off[n].
+        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
+
+        // Remaining offsets shifted so that what was offsets[n] becomes 0.
+        // Overwrite the array in place.
+        // SAFETY: the write range is at most as large as offsets.len().
+        // Values in the possible overlap are read before being overwritten.
+        unsafe {
+            let dst = self.offsets.as_mut_ptr();
+            for (i, &off) in self.offsets[n..].iter().enumerate() {
+                *dst.add(i) = off - cut_offset;
+            }
+        }

Review Comment:
   I'm sure this can be solved without the use of `unsafe`. Doesn't `bytes.rs` already implement something similar?
   
   https://github.com/apache/datafusion/blob/7ca6e543ec30ab0413b75171747a6d39ac0b0537/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs#L381-L388



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506961977

   Benchmark for [this request](https://github.com/apache/datafusion/pull/23648#issuecomment-5506924659) failed before finishing (Kubernetes reason: `BackoffLimitExceeded`).
   
   Benchmarks requested: `multi_group_by`
   
   <details><summary>Kubernetes message</summary>
   
   ```
   Job has reached the specified backoff limit
   ```
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5498095821

   Benchmark for [this request](https://github.com/apache/datafusion/pull/23648#issuecomment-5498065629) failed before finishing (Kubernetes reason: `BackoffLimitExceeded`).
   
   Benchmarks requested: `multi_group_by`
   
   <details><summary>Kubernetes message</summary>
   
   ```
   Job has reached the specified backoff limit
   ```
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506924659

   run benchmark multi_group_by


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5496142052

   🤖 Benchmark running (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5496098645)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5496098645-2059-5rtjx 6.12.94+ #1 SMP Fri Jul 17 09:42:57 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing nested-group-column-for-lists (559e7747fab754848ba4e6b49f608e449592eb43) to 80ae9e5 (merge-base) [diff](https://github.com/apache/datafusion/compare/80ae9e51c289ef3b9470a5ff989118a391f390df..559e7747fab754848ba4e6b49f608e449592eb43)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3602155013


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(
+        &self,
+        lhs_row: usize,
+        array: &GenericListArray<O>,
+        rhs_row: usize,
+    ) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }
+        true
+    }
+
+    fn append_val_typed(
+        &mut self,
+        array: &GenericListArray<O>,
+        row: usize,
+    ) -> Result<()> {
+        if array.is_null(row) {
+            self.outer_nulls.append(true);
+            // Zero-length range for null outer rows: do not push any child
+            // elements, and the offset for the next row stays the same.
+            let end = self.current_end();
+            self.offsets.push(end);
+        } else {
+            self.outer_nulls.append(false);
+            let sublist: ArrayRef = array.value(row);
+            let n = sublist.len();
+            for j in 0..n {
+                self.child.append_val(&sublist, j)?;
+            }
+            self.push_offset(n)?;
+        }
+        self.outer_len += 1;
+        Ok(())
+    }
+}
+
+impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
+    fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
+        self.equal_to_typed(lhs_row, Self::list_array(array), rhs_row)
+    }
+
+    fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()> {
+        self.append_val_typed(Self::list_array(array), row)
+    }
+
+    fn vectorized_equal_to(
+        &self,
+        lhs_rows: &[usize],
+        array: &ArrayRef,
+        rhs_rows: &[usize],
+        equal_to_results: &mut BooleanBufferBuilder,
+    ) {
+        let l = Self::list_array(array);
+        for (idx, (&lhs_row, &rhs_row)) in
+            lhs_rows.iter().zip(rhs_rows.iter()).enumerate()
+        {
+            if !equal_to_results.get_bit(idx) {
+                continue;
+            }
+            if !self.equal_to_typed(lhs_row, l, rhs_row) {
+                equal_to_results.set_bit(idx, false);
+            }
+        }
+    }
+
+    fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()> {
+        let l = Self::list_array(array);
+        for &row in rows {
+            self.append_val_typed(l, row)?;
+        }
+        Ok(())
+    }
+
+    fn len(&self) -> usize {
+        self.outer_len
+    }
+
+    fn size(&self) -> usize {
+        self.offsets.allocated_size()
+            + self.outer_nulls.allocated_size()
+            + self.child.size()
+    }
+
+    fn build(self: Box<Self>) -> ArrayRef {
+        let Self {
+            field,
+            offsets,
+            child,
+            mut outer_nulls,
+            outer_len: _,
+        } = *self;
+        let outer_nulls =
+            std::mem::replace(&mut outer_nulls, MaybeNullBufferBuilder::new()).build();
+        let child_array = child.build();
+        // SAFETY: offsets are constructed monotonically by `push_offset` /
+        // initial `[0]`, and child_array length matches the final offset.
+        let offset_buffer = OffsetBuffer::<O>::new(ScalarBuffer::<O>::from(offsets));
+        Arc::new(GenericListArray::<O>::new(
+            field,
+            offset_buffer,
+            child_array,
+            outer_nulls,
+        ))
+    }
+
+    fn take_n(&mut self, n: usize) -> ArrayRef {
+        // Number of child elements consumed by the first n outer rows.
+        let cut_offset = self.offsets[n];
+        let cut = cut_offset.as_usize();
+
+        // First-n offsets: 0, off[1], ..., off[n].
+        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
+
+        // Remaining offsets shifted so that what was offsets[n] becomes 0.
+        // Overwrite the array in place.
+        // SAFETY: the write range is at most as large as offsets.len().
+        // Values in the possible overlap are read before being overwritten.
+        unsafe {
+            let dst = self.offsets.as_mut_ptr();
+            for (i, &off) in self.offsets[n..].iter().enumerate() {
+                *dst.add(i) = off - cut_offset;
+            }
+        }

Review Comment:
   Thanks, applied!



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5240952097

   > We can create a benchmark PR target this PR first, so we can compare it in CI benchmark.
   
   Sure, go ahead.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5484689391

   > We can create a benchmark PR target this PR first, so we can compare it in CI benchmark.
   
   The micro-benchmark I have added in #24824 shows 19-35% improvement on minimalistic cases.
   Tested on a Google Cloud C4 instance (x86_64, Intel Xeon Emerald Rapids).


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5496145314

   Benchmark for [this request](https://github.com/apache/datafusion/pull/23648#issuecomment-5496098645) failed before finishing (Kubernetes reason: `BackoffLimitExceeded`).
   
   Benchmarks requested: `multi_group_by`
   
   <details><summary>Kubernetes message</summary>
   
   ```
   Job has reached the specified backoff limit
   ```
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5496098645

   run benchmark multi_group_by


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5496467147

   <!-- semver-check-comment -->
   Thank you for opening this pull request!
   
   Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks) reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).
   
   <details>
   <summary>Details</summary>
   
   ```
        Cloning apache/main
       Building datafusion-physical-plan v55.0.0 (current)
          Built [  42.037s] (current)
        Parsing datafusion-physical-plan v55.0.0 (current)
         Parsed [   0.159s] (current)
       Building datafusion-physical-plan v55.0.0 (baseline)
          Built [  42.506s] (baseline)
        Parsing datafusion-physical-plan v55.0.0 (baseline)
         Parsed [   0.155s] (baseline)
       Checking datafusion-physical-plan v55.0.0 -> v55.0.0 (no change; assume patch)
        Checked [   0.732s] 223 checks: 222 pass, 1 fail, 0 warn, 31 skip
   
   --- failure trait_method_missing: pub trait method removed or renamed ---
   
   Description:
   A trait method is no longer callable, and may have been renamed or removed entirely.
           ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
          impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/trait_method_missing.ron
   
   Failed in:
     method values_preserving of trait GroupValues, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/758c72efa4d0b008ece9c91b5b6f9a92caacc7c9/datafusion/physical-plan/src/aggregates/group_values/mod.rs:127
     method supports_values_preserving of trait GroupValues, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/758c72efa4d0b008ece9c91b5b6f9a92caacc7c9/datafusion/physical-plan/src/aggregates/group_values/mod.rs:135
     method values_preserving of trait GroupColumn, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/758c72efa4d0b008ece9c91b5b6f9a92caacc7c9/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:114
   
        Summary semver requires new major version: 1 major and 0 minor checks failed
       Finished [  87.205s] datafusion-physical-plan
   ```
   
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "zhuqi-lucas (via GitHub)" <gi...@apache.org>.
zhuqi-lucas commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5240740087

   We can create a benchmark PR target this PR first, so we can compare it in CI benchmark.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5517071459

   > @adriangb Do you have any idea why it is unable to run the benchmarks? there is no explaination and it works localy for
   
   let's see if https://github.com/adriangb/datafusion-benchmarking/pull/29 fixes it


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5498093215

   🤖 Benchmark running (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5498065629)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5498065629-2061-5sc7r 6.12.94+ #1 SMP Fri Jul 17 09:42:57 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing nested-group-column-for-lists (c701d0449b953f4fe3756eac85472bc86db669fd) to da89c7c (merge-base) [diff](https://github.com/apache/datafusion/compare/da89c7c85b1c888ba4038317eacbdcfe03ab9b1a..c701d0449b953f4fe3756eac85472bc86db669fd)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5498065629

   
   run benchmark multi_group_by
   
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-4995360174

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/23648?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `98.21429%` with `11 lines` in your changes missing coverage. Please review.
   :warning: Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`main@95de385`). [Learn more](https://docs.codecov.io/docs/error-reference?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#section-missing-base-commit) about missing BASE report.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/datafusion/pull/23648?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...src/aggregates/group\_values/multi\_group\_by/list.rs](https://app.codecov.io/gh/apache/datafusion/pull/23648?src=pr&el=tree&filepath=datafusion%2Fphysical-plan%2Fsrc%2Faggregates%2Fgroup_values%2Fmulti_group_by%2Flist.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1wbGFuL3NyYy9hZ2dyZWdhdGVzL2dyb3VwX3ZhbHVlcy9tdWx0aV9ncm91cF9ieS9saXN0LnJz) | 98.10% | [4 Missing and 7 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/23648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@           Coverage Diff           @@
   ##             main   #23648   +/-   ##
   =======================================
     Coverage        ?   80.67%           
   =======================================
     Files           ?     1087           
     Lines           ?   366711           
     Branches        ?   366711           
   =======================================
     Hits            ?   295859           
     Misses          ?    53250           
     Partials        ?    17602           
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/23648?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "KonaeAkira (via GitHub)" <gi...@apache.org>.
KonaeAkira commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3601232493


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(
+        &self,
+        lhs_row: usize,
+        array: &GenericListArray<O>,
+        rhs_row: usize,
+    ) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }
+        true
+    }
+
+    fn append_val_typed(
+        &mut self,
+        array: &GenericListArray<O>,
+        row: usize,
+    ) -> Result<()> {
+        if array.is_null(row) {
+            self.outer_nulls.append(true);
+            // Zero-length range for null outer rows: do not push any child
+            // elements, and the offset for the next row stays the same.
+            let end = self.current_end();
+            self.offsets.push(end);
+        } else {
+            self.outer_nulls.append(false);
+            let sublist: ArrayRef = array.value(row);
+            let n = sublist.len();
+            for j in 0..n {
+                self.child.append_val(&sublist, j)?;
+            }
+            self.push_offset(n)?;
+        }
+        self.outer_len += 1;
+        Ok(())
+    }
+}
+
+impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
+    fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
+        self.equal_to_typed(lhs_row, Self::list_array(array), rhs_row)
+    }
+
+    fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()> {
+        self.append_val_typed(Self::list_array(array), row)
+    }
+
+    fn vectorized_equal_to(
+        &self,
+        lhs_rows: &[usize],
+        array: &ArrayRef,
+        rhs_rows: &[usize],
+        equal_to_results: &mut BooleanBufferBuilder,
+    ) {
+        let l = Self::list_array(array);
+        for (idx, (&lhs_row, &rhs_row)) in
+            lhs_rows.iter().zip(rhs_rows.iter()).enumerate()
+        {
+            if !equal_to_results.get_bit(idx) {
+                continue;
+            }
+            if !self.equal_to_typed(lhs_row, l, rhs_row) {
+                equal_to_results.set_bit(idx, false);
+            }
+        }
+    }
+
+    fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()> {
+        let l = Self::list_array(array);
+        for &row in rows {
+            self.append_val_typed(l, row)?;
+        }
+        Ok(())
+    }
+
+    fn len(&self) -> usize {
+        self.outer_len
+    }
+
+    fn size(&self) -> usize {
+        self.offsets.allocated_size()
+            + self.outer_nulls.allocated_size()
+            + self.child.size()
+    }
+
+    fn build(self: Box<Self>) -> ArrayRef {
+        let Self {
+            field,
+            offsets,
+            child,
+            mut outer_nulls,
+            outer_len: _,
+        } = *self;
+        let outer_nulls =
+            std::mem::replace(&mut outer_nulls, MaybeNullBufferBuilder::new()).build();
+        let child_array = child.build();
+        // SAFETY: offsets are constructed monotonically by `push_offset` /
+        // initial `[0]`, and child_array length matches the final offset.
+        let offset_buffer = OffsetBuffer::<O>::new(ScalarBuffer::<O>::from(offsets));
+        Arc::new(GenericListArray::<O>::new(
+            field,
+            offset_buffer,
+            child_array,
+            outer_nulls,
+        ))
+    }
+
+    fn take_n(&mut self, n: usize) -> ArrayRef {
+        // Number of child elements consumed by the first n outer rows.
+        let cut_offset = self.offsets[n];
+        let cut = cut_offset.as_usize();
+
+        // First-n offsets: 0, off[1], ..., off[n].
+        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
+
+        // Remaining offsets shifted so that what was offsets[n] becomes 0.
+        // Overwrite the array in place.
+        // SAFETY: the write range is at most as large as offsets.len().
+        // Values in the possible overlap are read before being overwritten.
+        unsafe {
+            let dst = self.offsets.as_mut_ptr();
+            for (i, &off) in self.offsets[n..].iter().enumerate() {
+                *dst.add(i) = off - cut_offset;
+            }
+        }

Review Comment:
   `dst` holds a mutable reference into `self` while `self.offsets[n..]` holds a shared reference into `self`. It looks to me like it's violating the memory aliasing rule, which means UB.
   
   I'm sure this can be solved without the use of `unsafe`. Doesn't `bytes.rs` already implement something similar?
   
   https://github.com/apache/datafusion/blob/7ca6e543ec30ab0413b75171747a6d39ac0b0537/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs#L381-L388



##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(
+        &self,
+        lhs_row: usize,
+        array: &GenericListArray<O>,
+        rhs_row: usize,
+    ) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }
+        true
+    }
+
+    fn append_val_typed(
+        &mut self,
+        array: &GenericListArray<O>,
+        row: usize,
+    ) -> Result<()> {
+        if array.is_null(row) {
+            self.outer_nulls.append(true);
+            // Zero-length range for null outer rows: do not push any child
+            // elements, and the offset for the next row stays the same.
+            let end = self.current_end();
+            self.offsets.push(end);
+        } else {
+            self.outer_nulls.append(false);
+            let sublist: ArrayRef = array.value(row);
+            let n = sublist.len();
+            for j in 0..n {
+                self.child.append_val(&sublist, j)?;
+            }
+            self.push_offset(n)?;
+        }
+        self.outer_len += 1;
+        Ok(())
+    }
+}
+
+impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
+    fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
+        self.equal_to_typed(lhs_row, Self::list_array(array), rhs_row)
+    }
+
+    fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()> {
+        self.append_val_typed(Self::list_array(array), row)
+    }
+
+    fn vectorized_equal_to(
+        &self,
+        lhs_rows: &[usize],
+        array: &ArrayRef,
+        rhs_rows: &[usize],
+        equal_to_results: &mut BooleanBufferBuilder,
+    ) {
+        let l = Self::list_array(array);
+        for (idx, (&lhs_row, &rhs_row)) in
+            lhs_rows.iter().zip(rhs_rows.iter()).enumerate()
+        {
+            if !equal_to_results.get_bit(idx) {
+                continue;
+            }
+            if !self.equal_to_typed(lhs_row, l, rhs_row) {
+                equal_to_results.set_bit(idx, false);
+            }
+        }
+    }
+
+    fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()> {
+        let l = Self::list_array(array);
+        for &row in rows {
+            self.append_val_typed(l, row)?;
+        }
+        Ok(())
+    }
+
+    fn len(&self) -> usize {
+        self.outer_len
+    }
+
+    fn size(&self) -> usize {
+        self.offsets.allocated_size()
+            + self.outer_nulls.allocated_size()
+            + self.child.size()
+    }
+
+    fn build(self: Box<Self>) -> ArrayRef {
+        let Self {
+            field,
+            offsets,
+            child,
+            mut outer_nulls,
+            outer_len: _,
+        } = *self;
+        let outer_nulls =
+            std::mem::replace(&mut outer_nulls, MaybeNullBufferBuilder::new()).build();
+        let child_array = child.build();
+        // SAFETY: offsets are constructed monotonically by `push_offset` /
+        // initial `[0]`, and child_array length matches the final offset.
+        let offset_buffer = OffsetBuffer::<O>::new(ScalarBuffer::<O>::from(offsets));
+        Arc::new(GenericListArray::<O>::new(
+            field,
+            offset_buffer,
+            child_array,
+            outer_nulls,
+        ))
+    }
+
+    fn take_n(&mut self, n: usize) -> ArrayRef {
+        // Number of child elements consumed by the first n outer rows.
+        let cut_offset = self.offsets[n];
+        let cut = cut_offset.as_usize();
+
+        // First-n offsets: 0, off[1], ..., off[n].
+        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();

Review Comment:
   ```suggestion
           let first_n_offsets = split_vec_min_alloc(&mut self.offsets, n);
   ```



##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);

Review Comment:
   Nit: why convert `self.current_end()` to `usize` and then convert back to `O` when you can do just one conversion by converting `additional` to `O` and doing the `checked_add` on `O`?
   
   Makes the logic a bit easier to follow.
   
   ```suggestion
           let additional = O::from_usize(additional).ok_or_else(|| {
               internal_datafusion_err!(
                   "List sublist length {additional} overflows the offset type"
               )
           })?;
           let next = self.current_end().checked_add(&additional).ok_or_else(|| {
               internal_datafusion_err!(
                   "List offset overflow: current={} additional={}",
                   self.current_end().as_usize(),
                   additional.as_usize()
               )
           })?;
           self.offsets.push(next);
   ```



##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -0,0 +1,866 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! [`GroupColumn`] implementation for `List<T>` and `LargeList<T>` group keys.
+//!
+//! Storage:
+//! - `offsets: Vec<O>` of length `outer_len + 1`, with `offsets[0] = 0`. The
+//!   children of outer row `i` live at child positions
+//!   `[offsets[i] .. offsets[i+1])`.
+//! - `child: Box<dyn GroupColumn>` for the element type.
+//! - `outer_nulls`: outer-row null bitmap.
+//!
+//! Null outer rows are stored with a zero-length range (i.e.
+//! `offsets[i+1] == offsets[i]`). No child slots are pushed for null rows.
+
+use crate::aggregates::group_values::multi_group_by::{GroupColumn, nulls_equal_to};
+use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+
+use arrow::array::{
+    Array, ArrayRef, BooleanBufferBuilder, GenericListArray, OffsetSizeTrait,
+};
+use arrow::buffer::{OffsetBuffer, ScalarBuffer};
+use arrow::datatypes::FieldRef;
+use datafusion_common::{Result, internal_datafusion_err};
+use datafusion_execution::memory_pool::proxy::VecAllocExt;
+use std::sync::Arc;
+
+/// A [`GroupColumn`] for `List<T>` (`O = i32`) and `LargeList<T>` (`O = i64`).
+pub struct ListGroupValueBuilder<O: OffsetSizeTrait> {
+    field: FieldRef,
+    offsets: Vec<O>,
+    child: Box<dyn GroupColumn>,
+    outer_nulls: MaybeNullBufferBuilder,
+    outer_len: usize,
+}
+
+impl<O: OffsetSizeTrait> ListGroupValueBuilder<O> {
+    pub fn new(field: FieldRef, child: Box<dyn GroupColumn>) -> Self {
+        Self {
+            field,
+            offsets: vec![O::usize_as(0)],
+            child,
+            outer_nulls: MaybeNullBufferBuilder::new(),
+            outer_len: 0,
+        }
+    }
+
+    fn list_array(array: &ArrayRef) -> &GenericListArray<O> {
+        array
+            .as_any()
+            .downcast_ref::<GenericListArray<O>>()
+            .expect("ListGroupValueBuilder called with non-List/LargeList array")
+    }
+
+    fn current_end(&self) -> O {
+        *self.offsets.last().expect("offsets is never empty")
+    }
+
+    fn push_offset(&mut self, additional: usize) -> Result<()> {
+        // Guard against usize overflow first (cheap, defense in depth: a
+        // List<i32> with cumulative length close to i32::MAX could wrap
+        // before the `O::from_usize` range check below would fire).
+        let next = self
+            .current_end()
+            .as_usize()
+            .checked_add(additional)
+            .ok_or_else(|| {
+                internal_datafusion_err!(
+                    "List offset usize overflow: current={} additional={}",
+                    self.current_end().as_usize(),
+                    additional
+                )
+            })?;
+        let next_o = O::from_usize(next)
+            .ok_or_else(|| internal_datafusion_err!("List offset overflows {}", next))?;
+        self.offsets.push(next_o);
+        Ok(())
+    }
+
+    fn equal_to_typed(
+        &self,
+        lhs_row: usize,
+        array: &GenericListArray<O>,
+        rhs_row: usize,
+    ) -> bool {
+        let lhs_null = self.outer_nulls.is_null(lhs_row);
+        let rhs_null = array.is_null(rhs_row);
+        if let Some(result) = nulls_equal_to(lhs_null, rhs_null) {
+            return result;
+        }
+
+        // sliced child covering exactly the rhs row's elements
+        let rhs_sublist: ArrayRef = array.value(rhs_row);
+        let lhs_start = self.offsets[lhs_row].as_usize();
+        let lhs_end = self.offsets[lhs_row + 1].as_usize();
+        let lhs_len = lhs_end - lhs_start;
+        if lhs_len != rhs_sublist.len() {
+            return false;
+        }
+        for j in 0..lhs_len {
+            if !self.child.equal_to(lhs_start + j, &rhs_sublist, j) {
+                return false;
+            }
+        }
+        true
+    }
+
+    fn append_val_typed(
+        &mut self,
+        array: &GenericListArray<O>,
+        row: usize,
+    ) -> Result<()> {
+        if array.is_null(row) {
+            self.outer_nulls.append(true);
+            // Zero-length range for null outer rows: do not push any child
+            // elements, and the offset for the next row stays the same.
+            let end = self.current_end();
+            self.offsets.push(end);
+        } else {
+            self.outer_nulls.append(false);
+            let sublist: ArrayRef = array.value(row);
+            let n = sublist.len();
+            for j in 0..n {
+                self.child.append_val(&sublist, j)?;
+            }
+            self.push_offset(n)?;
+        }
+        self.outer_len += 1;
+        Ok(())
+    }
+}
+
+impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
+    fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
+        self.equal_to_typed(lhs_row, Self::list_array(array), rhs_row)
+    }
+
+    fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()> {
+        self.append_val_typed(Self::list_array(array), row)
+    }
+
+    fn vectorized_equal_to(
+        &self,
+        lhs_rows: &[usize],
+        array: &ArrayRef,
+        rhs_rows: &[usize],
+        equal_to_results: &mut BooleanBufferBuilder,
+    ) {
+        let l = Self::list_array(array);
+        for (idx, (&lhs_row, &rhs_row)) in
+            lhs_rows.iter().zip(rhs_rows.iter()).enumerate()
+        {
+            if !equal_to_results.get_bit(idx) {
+                continue;
+            }
+            if !self.equal_to_typed(lhs_row, l, rhs_row) {
+                equal_to_results.set_bit(idx, false);
+            }
+        }
+    }
+
+    fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()> {
+        let l = Self::list_array(array);
+        for &row in rows {
+            self.append_val_typed(l, row)?;
+        }
+        Ok(())
+    }
+
+    fn len(&self) -> usize {
+        self.outer_len
+    }
+
+    fn size(&self) -> usize {
+        self.offsets.allocated_size()
+            + self.outer_nulls.allocated_size()
+            + self.child.size()
+    }
+
+    fn build(self: Box<Self>) -> ArrayRef {
+        let Self {
+            field,
+            offsets,
+            child,
+            mut outer_nulls,
+            outer_len: _,
+        } = *self;
+        let outer_nulls =
+            std::mem::replace(&mut outer_nulls, MaybeNullBufferBuilder::new()).build();

Review Comment:
   ```suggestion
           let outer_nulls = outer_nulls.build();
   ```



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton merged PR #23648:
URL: https://github.com/apache/datafusion/pull/23648


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5558396112

   
   run benchmark multi_group_by
   
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "mzabaluev (via GitHub)" <gi...@apache.org>.
mzabaluev commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3618097573


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -218,20 +214,11 @@ impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
         let cut_offset = self.offsets[n];
         let cut = cut_offset.as_usize();
 
-        // First-n offsets: 0, off[1], ..., off[n].
-        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
-
-        // Remaining offsets shifted so that what was offsets[n] becomes 0.
-        // Overwrite the array in place.
-        // SAFETY: the write range is at most as large as offsets.len().
-        // Values in the possible overlap are read before being overwritten.
-        unsafe {
-            let dst = self.offsets.as_mut_ptr();
-            for (i, &off) in self.offsets[n..].iter().enumerate() {
-                *dst.add(i) = off - cut_offset;
-            }
-        }
-        self.offsets.truncate(self.offsets.len() - n);

Review Comment:
   Followed up with #23730.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5497538136

   🤖 Benchmark running (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5497506950)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5497506950-2060-vpf5n 6.12.94+ #1 SMP Fri Jul 17 09:42:57 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing nested-group-column-for-lists (c701d0449b953f4fe3756eac85472bc86db669fd) to da89c7c (merge-base) [diff](https://github.com/apache/datafusion/compare/da89c7c85b1c888ba4038317eacbdcfe03ab9b1a..c701d0449b953f4fe3756eac85472bc86db669fd)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5506338260

   Benchmark for [this request](https://github.com/apache/datafusion/pull/23648#issuecomment-5506298560) failed before finishing (Kubernetes reason: `BackoffLimitExceeded`).
   
   Benchmarks requested: `multi_group_by`
   
   <details><summary>Kubernetes message</summary>
   
   ```
   Job has reached the specified backoff limit
   ```
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#issuecomment-5558661513

   🤖 Benchmark completed (GKE) | [trigger](https://github.com/apache/datafusion/pull/23648#issuecomment-5558396112)
   
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
   
   Comparing nested-group-column-for-lists (6f73226c277e9b36b070c77da99678eed904a5f6) to 3a4c310 (merge-base) [diff](https://github.com/apache/datafusion/compare/3a4c310da72ea419e777bf56bbedaf1fb83e087e..6f73226c277e9b36b070c77da99678eed904a5f6)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark multi_group_by
   ```
   
   </details>
   
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   <details><summary>Details</summary>
   <p>
   
   ```
   group                                                 HEAD                                   nested-group-column-for-lists
   -----                                                 ----                                   -----------------------------
   batch_size_sensitivity/row_based/batch_1024           1.00     10.7±0.01ms        ? ?/sec    1.00     10.7±0.03ms        ? ?/sec
   batch_size_sensitivity/row_based/batch_16384          1.01     10.6±0.00ms        ? ?/sec    1.00     10.5±0.01ms        ? ?/sec
   batch_size_sensitivity/row_based/batch_32768          1.00     10.8±0.00ms        ? ?/sec    1.00     10.8±0.02ms        ? ?/sec
   batch_size_sensitivity/row_based/batch_4096           1.00     10.6±0.00ms        ? ?/sec    1.00     10.6±0.00ms        ? ?/sec
   batch_size_sensitivity/row_based/batch_8192           1.01     10.7±0.01ms        ? ?/sec    1.00     10.5±0.01ms        ? ?/sec
   batch_size_sensitivity/vectorized/batch_1024          1.00      9.6±0.01ms        ? ?/sec    1.00      9.6±0.01ms        ? ?/sec
   batch_size_sensitivity/vectorized/batch_16384         1.00      9.5±0.01ms        ? ?/sec    1.02      9.7±0.01ms        ? ?/sec
   batch_size_sensitivity/vectorized/batch_32768         1.06     10.1±0.10ms        ? ?/sec    1.00      9.6±0.00ms        ? ?/sec
   batch_size_sensitivity/vectorized/batch_4096          1.03      9.8±0.32ms        ? ?/sec    1.00      9.6±0.00ms        ? ?/sec
   batch_size_sensitivity/vectorized/batch_8192          1.01      9.7±0.01ms        ? ?/sec    1.00      9.6±0.01ms        ? ?/sec
   column_scaling/row_based/cols_10_grp_1024             1.00     25.1±0.06ms        ? ?/sec    1.00     25.1±0.10ms        ? ?/sec
   column_scaling/row_based/cols_2_grp_100               1.03      9.4±0.06ms        ? ?/sec    1.00      9.1±0.01ms        ? ?/sec
   column_scaling/row_based/cols_3_grp_125               1.01     11.0±0.03ms        ? ?/sec    1.00     10.9±0.22ms        ? ?/sec
   column_scaling/row_based/cols_4_grp_81                1.02     13.6±0.15ms        ? ?/sec    1.00     13.3±0.01ms        ? ?/sec
   column_scaling/row_based/cols_6_grp_729               1.00     17.6±0.01ms        ? ?/sec    1.01     17.7±0.01ms        ? ?/sec
   column_scaling/row_based/cols_8_grp_256               1.00     22.0±0.03ms        ? ?/sec    1.02     22.3±0.02ms        ? ?/sec
   column_scaling/vectorized/cols_10_grp_1024            1.16     26.7±0.13ms        ? ?/sec    1.00     23.1±0.10ms        ? ?/sec
   column_scaling/vectorized/cols_2_grp_100              1.01      7.8±0.01ms        ? ?/sec    1.00      7.7±0.01ms        ? ?/sec
   column_scaling/vectorized/cols_3_grp_125              1.01      9.7±0.01ms        ? ?/sec    1.00      9.7±0.01ms        ? ?/sec
   column_scaling/vectorized/cols_4_grp_81               1.02     11.8±0.15ms        ? ?/sec    1.00     11.6±0.01ms        ? ?/sec
   column_scaling/vectorized/cols_6_grp_729              1.11     17.1±0.39ms        ? ?/sec    1.00     15.3±0.04ms        ? ?/sec
   column_scaling/vectorized/cols_8_grp_256              1.17     22.9±0.69ms        ? ?/sec    1.00     19.5±0.03ms        ? ?/sec
   decimal256/row_based/grp_1000                         1.01     14.0±0.03ms        ? ?/sec    1.00     13.9±0.04ms        ? ?/sec
   decimal256/row_based/grp_1000000                      1.01     43.5±0.07ms        ? ?/sec    1.00     42.8±0.05ms        ? ?/sec
   decimal256/vectorized/grp_1000                        1.00      9.6±0.02ms        ? ?/sec    1.02      9.8±0.18ms        ? ?/sec
   decimal256/vectorized/grp_1000000                     1.00     38.2±0.05ms        ? ?/sec    1.00     38.1±0.04ms        ? ?/sec
   duration/row_based/grp_1000                           1.03      9.8±0.01ms        ? ?/sec    1.00      9.5±0.03ms        ? ?/sec
   duration/row_based/grp_1000000                        1.00     37.9±0.17ms        ? ?/sec    1.00     37.8±0.10ms        ? ?/sec
   duration/vectorized/grp_1000                          1.01      7.9±0.01ms        ? ?/sec    1.00      7.9±0.01ms        ? ?/sec
   duration/vectorized/grp_1000000                       1.00     34.3±0.07ms        ? ?/sec    1.02     35.0±0.03ms        ? ?/sec
   fixed_size_binary/row_based/grp_1000                  1.00     12.7±0.05ms        ? ?/sec    1.00     12.8±0.01ms        ? ?/sec
   fixed_size_binary/row_based/grp_1000000               1.02     41.3±0.19ms        ? ?/sec    1.00     40.6±0.10ms        ? ?/sec
   fixed_size_binary/vectorized/grp_1000                 1.03     11.5±0.36ms        ? ?/sec    1.00     11.2±0.37ms        ? ?/sec
   fixed_size_binary/vectorized/grp_1000000              1.01     37.3±0.07ms        ? ?/sec    1.00     36.8±0.02ms        ? ?/sec
   float16/row_based/grp_1000                            1.02     10.2±0.09ms        ? ?/sec    1.00     10.0±0.12ms        ? ?/sec
   float16/row_based/grp_60000                           1.00     17.3±0.03ms        ? ?/sec    1.03     17.9±0.05ms        ? ?/sec
   float16/vectorized/grp_1000                           1.00      8.1±0.00ms        ? ?/sec    1.02      8.3±0.19ms        ? ?/sec
   float16/vectorized/grp_60000                          1.00     13.0±0.03ms        ? ?/sec    1.00     13.0±0.06ms        ? ?/sec
   group_count_sweep/row_based/grp_1000                  1.02     13.7±0.05ms        ? ?/sec    1.00     13.5±0.01ms        ? ?/sec
   group_count_sweep/row_based/grp_10000                 1.00     14.6±0.02ms        ? ?/sec    1.00     14.6±0.14ms        ? ?/sec
   group_count_sweep/row_based/grp_100000                1.00     23.3±0.03ms        ? ?/sec    1.01     23.7±0.06ms        ? ?/sec
   group_count_sweep/row_based/grp_1000000               1.00     41.1±0.05ms        ? ?/sec    1.02     41.8±0.06ms        ? ?/sec
   group_count_sweep/row_based/grp_16                    1.00     13.1±0.01ms        ? ?/sec    1.01     13.2±0.01ms        ? ?/sec
   group_count_sweep/row_based/grp_256                   1.03     13.6±0.04ms        ? ?/sec    1.00     13.2±0.01ms        ? ?/sec
   group_count_sweep/row_based/grp_5000                  1.00     14.1±0.07ms        ? ?/sec    1.00     14.1±0.13ms        ? ?/sec
   group_count_sweep/row_based/grp_50000                 1.00     19.9±0.02ms        ? ?/sec    1.00     19.8±0.02ms        ? ?/sec
   group_count_sweep/row_based/grp_500000                1.00     35.9±0.25ms        ? ?/sec    1.01     36.4±0.22ms        ? ?/sec
   group_count_sweep/row_based/grp_64                    1.01     13.8±0.05ms        ? ?/sec    1.00     13.8±0.01ms        ? ?/sec
   group_count_sweep/vectorized/grp_1000                 1.01     11.6±0.01ms        ? ?/sec    1.00     11.5±0.01ms        ? ?/sec
   group_count_sweep/vectorized/grp_10000                1.02     12.4±0.18ms        ? ?/sec    1.00     12.1±0.05ms        ? ?/sec
   group_count_sweep/vectorized/grp_100000               1.00     17.9±0.15ms        ? ?/sec    1.01     18.1±0.11ms        ? ?/sec
   group_count_sweep/vectorized/grp_1000000              1.00     40.2±0.03ms        ? ?/sec    1.01     40.4±0.05ms        ? ?/sec
   group_count_sweep/vectorized/grp_16                   1.00     11.4±0.01ms        ? ?/sec    1.00     11.4±0.01ms        ? ?/sec
   group_count_sweep/vectorized/grp_256                  1.00     11.5±0.01ms        ? ?/sec    1.19     13.6±0.38ms        ? ?/sec
   group_count_sweep/vectorized/grp_5000                 1.00     12.1±0.39ms        ? ?/sec    1.01     12.2±0.04ms        ? ?/sec
   group_count_sweep/vectorized/grp_50000                1.00     15.2±0.13ms        ? ?/sec    1.02     15.5±0.07ms        ? ?/sec
   group_count_sweep/vectorized/grp_500000               1.00     30.1±0.14ms        ? ?/sec    1.01     30.2±0.20ms        ? ?/sec
   group_count_sweep/vectorized/grp_64                   1.00     11.5±0.01ms        ? ?/sec    1.03     11.8±0.00ms        ? ?/sec
   high_cardinality_scaling/row_based/cols_10_grp_1M     1.00     55.8±0.12ms        ? ?/sec    1.03     57.4±0.14ms        ? ?/sec
   high_cardinality_scaling/row_based/cols_2_grp_1M      1.01     38.5±0.04ms        ? ?/sec    1.00     38.0±0.07ms        ? ?/sec
   high_cardinality_scaling/row_based/cols_3_grp_1M      1.00     38.7±0.05ms        ? ?/sec    1.01     39.2±0.02ms        ? ?/sec
   high_cardinality_scaling/row_based/cols_4_grp_1M      1.02     41.8±0.08ms        ? ?/sec    1.00     41.2±0.10ms        ? ?/sec
   high_cardinality_scaling/row_based/cols_6_grp_1M      1.00     46.4±0.04ms        ? ?/sec    1.03     48.0±0.10ms        ? ?/sec
   high_cardinality_scaling/row_based/cols_8_grp_1M      1.00     50.9±0.05ms        ? ?/sec    1.02     52.0±0.06ms        ? ?/sec
   high_cardinality_scaling/vectorized/cols_10_grp_1M    1.01     59.4±0.29ms        ? ?/sec    1.00     59.0±0.09ms        ? ?/sec
   high_cardinality_scaling/vectorized/cols_2_grp_1M     1.00     34.1±0.02ms        ? ?/sec    1.00     33.9±0.03ms        ? ?/sec
   high_cardinality_scaling/vectorized/cols_3_grp_1M     1.00     37.0±0.03ms        ? ?/sec    1.01     37.3±0.15ms        ? ?/sec
   high_cardinality_scaling/vectorized/cols_4_grp_1M     1.00     40.2±0.05ms        ? ?/sec    1.00     40.4±0.04ms        ? ?/sec
   high_cardinality_scaling/vectorized/cols_6_grp_1M     1.00     46.3±0.09ms        ? ?/sec    1.03     47.8±0.06ms        ? ?/sec
   high_cardinality_scaling/vectorized/cols_8_grp_1M     1.00     52.6±0.15ms        ? ?/sec    1.02     53.7±0.09ms        ? ?/sec
   interval/row_based/grp_1000                           1.00     11.5±0.01ms        ? ?/sec    1.00     11.5±0.01ms        ? ?/sec
   interval/row_based/grp_1000000                        1.00     40.0±0.07ms        ? ?/sec    1.01     40.2±0.03ms        ? ?/sec
   interval/vectorized/grp_1000                          1.00      8.7±0.02ms        ? ?/sec    1.00      8.7±0.03ms        ? ?/sec
   interval/vectorized/grp_1000000                       1.00     35.7±0.09ms        ? ?/sec    1.03     36.6±0.06ms        ? ?/sec
   issue_17850_regression/row_based/10000000_rows        1.00    108.2±0.09ms        ? ?/sec    1.00    107.7±0.08ms        ? ?/sec
   issue_17850_regression/row_based/1000000_rows         1.00     10.5±0.01ms        ? ?/sec    1.00     10.5±0.00ms        ? ?/sec
   issue_17850_regression/row_based/20000000_rows        1.01    216.9±0.16ms        ? ?/sec    1.00    215.8±0.80ms        ? ?/sec
   issue_17850_regression/row_based/50000000_rows        1.00    544.1±3.64ms        ? ?/sec    1.03    561.1±5.56ms        ? ?/sec
   issue_17850_regression/row_based/5000000_rows         1.01     53.9±0.17ms        ? ?/sec    1.00     53.2±0.04ms        ? ?/sec
   issue_17850_regression/vectorized/10000000_rows       1.00     98.8±0.08ms        ? ?/sec    1.04    102.3±0.48ms        ? ?/sec
   issue_17850_regression/vectorized/1000000_rows        1.01      9.6±0.01ms        ? ?/sec    1.00      9.5±0.01ms        ? ?/sec
   issue_17850_regression/vectorized/20000000_rows       1.00    198.4±0.13ms        ? ?/sec    1.00    198.2±0.10ms        ? ?/sec
   issue_17850_regression/vectorized/50000000_rows       1.00    489.6±0.51ms        ? ?/sec    1.09   531.8±24.98ms        ? ?/sec
   issue_17850_regression/vectorized/5000000_rows        1.00     48.5±0.05ms        ? ?/sec    1.00     48.7±0.09ms        ? ?/sec
   list_int/row_based/grp_1000                           1.02     32.3±0.50ms        ? ?/sec    1.00     31.7±0.02ms        ? ?/sec
   list_int/row_based/grp_1000000                        1.00     61.0±0.09ms        ? ?/sec    1.01     61.7±0.10ms        ? ?/sec
   list_int/vectorized/grp_1000                          1.56     34.2±0.11ms        ? ?/sec    1.00     21.9±0.62ms        ? ?/sec
   list_int/vectorized/grp_1000000                       1.24     61.6±0.07ms        ? ?/sec    1.00     49.6±0.07ms        ? ?/sec
   list_utf8/row_based/grp_1000                          1.00     46.1±0.13ms        ? ?/sec    1.01     46.5±0.19ms        ? ?/sec
   list_utf8/row_based/grp_1000000                       1.00     78.5±0.23ms        ? ?/sec    1.00     78.4±0.38ms        ? ?/sec
   list_utf8/vectorized/grp_1000                         1.71     48.9±0.76ms        ? ?/sec    1.00     28.7±0.42ms        ? ?/sec
   list_utf8/vectorized/grp_1000000                      1.32     81.7±0.30ms        ? ?/sec    1.00     61.8±0.13ms        ? ?/sec
   low_cardinality/row_based/cols_3_card_2_grp_8         1.05     11.0±0.02ms        ? ?/sec    1.00     10.5±0.01ms        ? ?/sec
   low_cardinality/row_based/cols_3_card_4_grp_64        1.01     10.6±0.01ms        ? ?/sec    1.00     10.5±0.01ms        ? ?/sec
   low_cardinality/row_based/cols_3_card_8_grp_512       1.00     10.6±0.01ms        ? ?/sec    1.03     10.9±0.11ms        ? ?/sec
   low_cardinality/row_based/cols_4_card_2_grp_16        1.00     13.2±0.00ms        ? ?/sec    1.00     13.2±0.01ms        ? ?/sec
   low_cardinality/row_based/cols_4_card_4_grp_256       1.00     13.5±0.06ms        ? ?/sec    1.00     13.5±0.12ms        ? ?/sec
   low_cardinality/row_based/cols_4_card_8_grp_4096      1.00     14.1±0.01ms        ? ?/sec    1.00     14.1±0.04ms        ? ?/sec
   low_cardinality/vectorized/cols_3_card_2_grp_8        1.16     11.1±0.23ms        ? ?/sec    1.00      9.5±0.01ms        ? ?/sec
   low_cardinality/vectorized/cols_3_card_4_grp_64       1.00      9.6±0.01ms        ? ?/sec    1.00      9.6±0.00ms        ? ?/sec
   low_cardinality/vectorized/cols_3_card_8_grp_512      1.00      9.6±0.01ms        ? ?/sec    1.00      9.7±0.01ms        ? ?/sec
   low_cardinality/vectorized/cols_4_card_2_grp_16       1.13     12.9±1.24ms        ? ?/sec    1.00     11.4±0.01ms        ? ?/sec
   low_cardinality/vectorized/cols_4_card_4_grp_256      1.00     11.6±0.01ms        ? ?/sec    1.00     11.5±0.01ms        ? ?/sec
   low_cardinality/vectorized/cols_4_card_8_grp_4096     1.04     12.5±0.38ms        ? ?/sec    1.00     11.9±0.17ms        ? ?/sec
   ```
   
   </p>
   </details>
   
   <details><summary>Resource Usage</summary>
   
   **multi_group_by — base (merge-base)**
   | Metric | Value |
   |--------|-------|
   | Wall time | 1570.3s |
   | Peak memory | 610.6 MiB |
   | Avg memory | 441.3 MiB |
   | CPU user | 1434.8s |
   | CPU sys | 1.4s |
   | Peak spill | 0 B |
   
   **multi_group_by — branch**
   | Metric | Value |
   |--------|-------|
   | Wall time | 1545.3s |
   | Peak memory | 610.4 MiB |
   | Avg memory | 440.8 MiB |
   | CPU user | 1414.0s |
   | CPU sys | 1.4s |
   | Peak spill | 0 B |
   
   </details>
   
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat(physical-plan): `GroupColumn` support for `List` / `LargeList` [datafusion]

Posted by "KonaeAkira (via GitHub)" <gi...@apache.org>.
KonaeAkira commented on code in PR #23648:
URL: https://github.com/apache/datafusion/pull/23648#discussion_r3602428224


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:
##########
@@ -218,20 +214,11 @@ impl<O: OffsetSizeTrait> GroupColumn for ListGroupValueBuilder<O> {
         let cut_offset = self.offsets[n];
         let cut = cut_offset.as_usize();
 
-        // First-n offsets: 0, off[1], ..., off[n].
-        let first_n_offsets: Vec<O> = self.offsets[..=n].to_vec();
-
-        // Remaining offsets shifted so that what was offsets[n] becomes 0.
-        // Overwrite the array in place.
-        // SAFETY: the write range is at most as large as offsets.len().
-        // Values in the possible overlap are read before being overwritten.
-        unsafe {
-            let dst = self.offsets.as_mut_ptr();
-            for (i, &off) in self.offsets[n..].iter().enumerate() {
-                *dst.add(i) = off - cut_offset;
-            }
-        }
-        self.offsets.truncate(self.offsets.len() - n);

Review Comment:
   One more thing that just occurred to me: `split_vec_min_alloc(&mut self.offsets, n)` returns a vector with exact capacity in case `n * 2 <= self.offsets.len()`:
   
   https://github.com/apache/datafusion/blob/fb8fe7ae61efc12c6c09a00d025e35c750e2ee86/datafusion/common/src/utils/mod.rs#L405-L412
   
   in which case `first_n_offsets.push(cut_offset);` will always reallocate, which is bad.
   
   This affects `bytes.rs` as well.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org