Skip to content

Commit 2053d23

Browse files
committed
feat: optimize FIRST_VALUE/LAST_VALUE for bytes types with FlattenBytesValueState
1 parent 330a6e1 commit 2053d23

2 files changed

Lines changed: 442 additions & 1 deletion

File tree

‎datafusion/functions-aggregate/src/first_last.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ use datafusion_functions_aggregate_common::utils::get_sort_options;
5252
use datafusion_macros::user_doc;
5353
use datafusion_physical_expr_common::sort_expr::LexOrdering;
5454

55+
mod flatten_state;
5556
mod state;
5657

5758
use state::{BytesValueState, PrimitiveValueState, ValueState};
59+
use flatten_state::FlattenBytesValueState;
5860

5961
create_func!(FirstValue, first_value_udaf);
6062
create_func!(LastValue, last_value_udaf);
@@ -115,7 +117,7 @@ fn create_groups_bytes_accumulator(
115117
.collect::<Result<Vec<_>>>()?;
116118

117119
Ok(Box::new(FirstLastGroupsAccumulator::try_new(
118-
BytesValueState::try_new(args.return_field.data_type().clone())?,
120+
FlattenBytesValueState::try_new(args.return_field.data_type().clone())?,
119121
ordering,
120122
args.ignore_nulls,
121123
&ordering_dtypes,

0 commit comments

Comments
 (0)