Skip to content

Commit

Permalink
Rename aggregation modules, GroupColumn (#12619)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored Sep 25, 2024
1 parent dbfde67 commit 26c8004
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
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

0 comments on commit 26c8004

Please sign in to comment.