Skip to content

Commit 2e928bb

Browse files
authored
chore(new-cubestore): InlineAggregate (#197)
1 parent 7c9a7a6 commit 2e928bb

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

datafusion/physical-plan/src/aggregates/group_values/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use datafusion_common::Result;
2828

2929
use datafusion_expr::EmitTo;
3030

31-
pub(crate) mod multi_group_by;
31+
pub mod multi_group_by;
3232

3333
mod row;
3434
mod single_group_by;
@@ -84,7 +84,7 @@ mod null_builder;
8484
/// Each distinct group in a hash aggregation is identified by a unique group id
8585
/// (usize) which is assigned by instances of this trait. Group ids are
8686
/// continuous without gaps, starting from 0.
87-
pub(crate) trait GroupValues: Send {
87+
pub trait GroupValues: Send {
8888
/// Calculates the group id for each input row of `cols`, assigning new
8989
/// group ids as necessary.
9090
///

datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod primitive;
2323

2424
use std::mem::{self, size_of};
2525

26-
use crate::aggregates::group_values::multi_group_by::{
26+
pub use crate::aggregates::group_values::multi_group_by::{
2727
bytes::ByteGroupValueBuilder, bytes_view::ByteViewGroupValueBuilder,
2828
primitive::PrimitiveGroupValueBuilder,
2929
};

datafusion/physical-plan/src/aggregates/mod.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use datafusion_physical_expr::{
5151
use itertools::Itertools;
5252
use tracing_futures::Instrument;
5353

54-
pub(crate) mod group_values;
54+
pub mod group_values;
5555
mod no_grouping;
5656
pub mod order;
5757
mod row_hash;
@@ -213,7 +213,7 @@ impl PhysicalGroupBy {
213213
}
214214

215215
/// The number of expressions in the output schema.
216-
fn num_output_exprs(&self) -> usize {
216+
pub fn num_output_exprs(&self) -> usize {
217217
let mut num_exprs = self.expr.len();
218218
if !self.is_single() {
219219
num_exprs += 1
@@ -242,7 +242,7 @@ impl PhysicalGroupBy {
242242
}
243243

244244
/// Returns the number expression as grouping keys.
245-
fn num_group_exprs(&self) -> usize {
245+
pub fn num_group_exprs(&self) -> usize {
246246
if self.is_single() {
247247
self.expr.len()
248248
} else {
@@ -285,7 +285,7 @@ impl PhysicalGroupBy {
285285
///
286286
/// This might be different from the `group_fields` that might contain internal expressions that
287287
/// should not be part of the output schema.
288-
fn output_fields(&self, input_schema: &Schema) -> Result<Vec<Field>> {
288+
pub fn output_fields(&self, input_schema: &Schema) -> Result<Vec<Field>> {
289289
let mut fields = self.group_fields(input_schema)?;
290290
fields.truncate(self.num_output_exprs());
291291
Ok(fields)
@@ -339,9 +339,15 @@ enum StreamType {
339339
impl From<StreamType> for SendableRecordBatchStream {
340340
fn from(stream: StreamType) -> Self {
341341
match stream {
342-
StreamType::AggregateStream(stream) => Box::pin(stream.instrument(tracing::trace_span!("AggregateStream"))),
343-
StreamType::GroupedHash(stream) => Box::pin(stream.instrument(tracing::trace_span!("GroupedHashAggregateStream"))),
344-
StreamType::GroupedPriorityQueue(stream) => Box::pin(stream.instrument(tracing::trace_span!("GroupedTopKAggregateStream"))),
342+
StreamType::AggregateStream(stream) => {
343+
Box::pin(stream.instrument(tracing::trace_span!("AggregateStream")))
344+
}
345+
StreamType::GroupedHash(stream) => Box::pin(
346+
stream.instrument(tracing::trace_span!("GroupedHashAggregateStream")),
347+
),
348+
StreamType::GroupedPriorityQueue(stream) => Box::pin(
349+
stream.instrument(tracing::trace_span!("GroupedTopKAggregateStream")),
350+
),
345351
}
346352
}
347353
}

0 commit comments

Comments
 (0)