Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename aggregation modules, GroupColumn #12619

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

use crate::aggregates::group_values::group_value_row::{
ArrayRowEq, ByteGroupValueBuilder, PrimitiveGroupValueBuilder,
use crate::aggregates::group_values::group_column::{
ByteGroupValueBuilder, GroupColumn, PrimitiveGroupValueBuilder,
};
use crate::aggregates::group_values::GroupValues;
use ahash::RandomState;
Expand Down Expand Up @@ -57,7 +57,7 @@ pub struct GroupValuesColumn {
/// The actual group by values, stored column-wise. Compare from
/// the left to right, each column is stored as `ArrayRowEq`.
/// This is shown faster than the row format
group_values: Vec<Box<dyn ArrayRowEq>>,
group_values: Vec<Box<dyn GroupColumn>>,

/// reused buffer to store hashes
hashes_buffer: Vec<u64>,
Expand Down Expand Up @@ -180,7 +180,7 @@ impl GroupValues for GroupValuesColumn {
}

fn check_row_equal(
array_row: &dyn ArrayRowEq,
array_row: &dyn GroupColumn,
lhs_row: usize,
array: &ArrayRef,
rhs_row: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ use datafusion_physical_expr_common::binary_map::{OutputType, INITIAL_BUFFER_CAP
/// (similar to various builders in Arrow-rs) that allow for quick comparison to
/// incoming rows.
///
pub trait ArrayRowEq: Send + Sync {
pub trait GroupColumn: Send + Sync {
/// Returns equal if the row stored in this builder at `lhs_row` is equal to
/// the row in `array` at `rhs_row`
fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool;
/// Appends the row at `row` in `array` to this builder
fn append_val(&mut self, array: &ArrayRef, row: usize);
/// Returns the number of rows stored in this builder
fn len(&self) -> usize;
/// Returns the number of bytes used by this [`ArrayRowEq`]
/// Returns the number of bytes used by this [`GroupColumn`]
fn size(&self) -> usize;
/// Builds a new array from all of the stored rows
fn build(self: Box<Self>) -> ArrayRef;
Expand Down Expand Up @@ -82,7 +82,7 @@ where
}
}

impl<T: ArrowPrimitiveType> ArrayRowEq for PrimitiveGroupValueBuilder<T> {
impl<T: ArrowPrimitiveType> GroupColumn for PrimitiveGroupValueBuilder<T> {
fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
// non-null fast path
// both non-null
Expand Down Expand Up @@ -225,7 +225,7 @@ where
}
}

impl<O> ArrayRowEq for ByteGroupValueBuilder<O>
impl<O> GroupColumn for ByteGroupValueBuilder<O>
where
O: OffsetSizeTrait,
{
Expand Down Expand Up @@ -407,7 +407,7 @@ mod tests {
use arrow_array::{ArrayRef, StringArray};
use datafusion_physical_expr::binary_map::OutputType;

use super::{ArrayRowEq, ByteGroupValueBuilder};
use super::{ByteGroupValueBuilder, GroupColumn};

#[test]
fn test_take_n() {
Expand Down
6 changes: 3 additions & 3 deletions datafusion/physical-plan/src/aggregates/group_values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ pub(crate) mod primitive;
use datafusion_expr::EmitTo;
use primitive::GroupValuesPrimitive;

mod column_wise;
mod column;
mod row;
use column_wise::GroupValuesColumn;
use column::GroupValuesColumn;
use row::GroupValuesRows;

mod bytes;
mod bytes_view;
use bytes::GroupValuesByes;
use datafusion_physical_expr::binary_map::OutputType;

mod group_value_row;
mod group_column;

/// An interning store for group keys
pub trait GroupValues: Send {
Expand Down