From 29e9af27ff8ca68714b27b1d195f9de3898983a5 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 8 Oct 2024 22:45:44 -0400 Subject: [PATCH] Minor: add documentation note about `NullState` (#12791) * Minor: add documentation note about `NullState` * Remove unecessary copy/paste license * Update datafusion/expr-common/src/groups_accumulator.rs --- datafusion/expr-common/src/groups_accumulator.rs | 10 ++++++++++ datafusion/functions-aggregate/src/min_max.rs | 15 --------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/datafusion/expr-common/src/groups_accumulator.rs b/datafusion/expr-common/src/groups_accumulator.rs index 8e81c51d8460..d19d8e469688 100644 --- a/datafusion/expr-common/src/groups_accumulator.rs +++ b/datafusion/expr-common/src/groups_accumulator.rs @@ -90,6 +90,11 @@ impl EmitTo { /// faster for queries with many group values. See the [Aggregating Millions of /// Groups Fast blog] for more background. /// +/// [`NullState`] can help keep the state for groups that have not seen any +/// values and produce the correct output for those groups. +/// +/// [`NullState`]: https://docs.rs/datafusion/latest/datafusion/physical_expr/struct.NullState.html +/// /// # Details /// Each group is assigned a `group_index` by the hash table and each /// accumulator manages the specific state, one per `group_index`. @@ -117,6 +122,11 @@ pub trait GroupsAccumulator: Send { /// /// Note that subsequent calls to update_batch may have larger /// total_num_groups as new groups are seen. + /// + /// See [`NullState`] to help keep the state for groups that have not seen any + /// values and produce the correct output for those groups. + /// + /// [`NullState`]: https://docs.rs/datafusion/latest/datafusion/physical_expr/struct.NullState.html fn update_batch( &mut self, values: &[ArrayRef], diff --git a/datafusion/functions-aggregate/src/min_max.rs b/datafusion/functions-aggregate/src/min_max.rs index e0b029f0909d..7d2e8e66e2cd 100644 --- a/datafusion/functions-aggregate/src/min_max.rs +++ b/datafusion/functions-aggregate/src/min_max.rs @@ -17,21 +17,6 @@ //! [`Max`] and [`MaxAccumulator`] accumulator for the `max` function //! [`Min`] and [`MinAccumulator`] accumulator for the `min` function -// 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. - use arrow::array::{ ArrayRef, BinaryArray, BinaryViewArray, BooleanArray, Date32Array, Date64Array, Decimal128Array, Decimal256Array, Float16Array, Float32Array, Float64Array,