Skip to content

Commit c355368

Browse files
committed
just make GroupIdx an internal concept first.
1 parent 7f5ccd2 commit c355368

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::aggregates::group_values::{GroupIdx, GroupValues};
18+
use crate::aggregates::group_values::GroupValues;
1919
use arrow_array::{Array, ArrayRef, OffsetSizeTrait, RecordBatch};
2020
use datafusion_expr::EmitTo;
2121
use datafusion_physical_expr_common::binary_map::{ArrowBytesMap, OutputType};
@@ -44,7 +44,7 @@ impl<O: OffsetSizeTrait> GroupValues for GroupValuesByes<O> {
4444
fn intern(
4545
&mut self,
4646
cols: &[ArrayRef],
47-
groups: &mut Vec<GroupIdx>,
47+
groups: &mut Vec<usize>,
4848
) -> datafusion_common::Result<()> {
4949
assert_eq!(cols.len(), 1);
5050

@@ -63,7 +63,7 @@ impl<O: OffsetSizeTrait> GroupValues for GroupValuesByes<O> {
6363
},
6464
// called for each group
6565
|group_idx| {
66-
groups.push(GroupIdx::new(0, group_idx as u64));
66+
groups.push(group_idx);
6767
},
6868
);
6969

@@ -111,7 +111,7 @@ impl<O: OffsetSizeTrait> GroupValues for GroupValuesByes<O> {
111111
self.intern(&[remaining_group_values], &mut group_indexes)?;
112112

113113
// Verify that the group indexes were assigned in the correct order
114-
assert_eq!(0, group_indexes[0].block_offset());
114+
assert_eq!(0, group_indexes[0]);
115115

116116
emit_group_values
117117
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::aggregates::group_values::{GroupIdx, GroupValues};
18+
use crate::aggregates::group_values::GroupValues;
1919
use arrow_array::{Array, ArrayRef, RecordBatch};
2020
use datafusion_expr::EmitTo;
2121
use datafusion_physical_expr::binary_map::OutputType;
@@ -45,7 +45,7 @@ impl GroupValues for GroupValuesBytesView {
4545
fn intern(
4646
&mut self,
4747
cols: &[ArrayRef],
48-
groups: &mut Vec<GroupIdx>,
48+
groups: &mut Vec<usize>,
4949
) -> datafusion_common::Result<()> {
5050
assert_eq!(cols.len(), 1);
5151

@@ -64,7 +64,7 @@ impl GroupValues for GroupValuesBytesView {
6464
},
6565
// called for each group
6666
|group_idx| {
67-
groups.push(GroupIdx::new(0, group_idx as u64));
67+
groups.push(group_idx);
6868
},
6969
);
7070

@@ -85,7 +85,7 @@ impl GroupValues for GroupValuesBytesView {
8585
self.num_groups
8686
}
8787

88-
fn emit(&mut self, emit_to: EmitTo) -> datafusion_common::Result<Vec<Vec<ArrayRef>>> {
88+
fn emit(&mut self, emit_to: EmitTo) -> datafusion_common::Result<Vec<ArrayRef>> {
8989
// Reset the map to default, and convert it into a single array
9090
let map_contents = self.map.take().into_state();
9191

@@ -112,7 +112,7 @@ impl GroupValues for GroupValuesBytesView {
112112
self.intern(&[remaining_group_values], &mut group_indexes)?;
113113

114114
// Verify that the group indexes were assigned in the correct order
115-
assert_eq!(0, group_indexes[0].block_offset());
115+
assert_eq!(0, group_indexes[0]);
116116

117117
emit_group_values
118118
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl GroupIdx {
6161
/// An interning store for group keys
6262
pub trait GroupValues: Send {
6363
/// Calculates the `groups` for each input row of `cols`
64-
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<GroupIdx>) -> Result<()>;
64+
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<usize>) -> Result<()>;
6565

6666
/// Returns the number of bytes used by this [`GroupValues`]
6767
fn size(&self) -> usize;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::aggregates::group_values::{GroupIdx, GroupValues};
18+
use crate::aggregates::group_values::GroupValues;
1919
use ahash::RandomState;
2020
use arrow::array::BooleanBufferBuilder;
2121
use arrow::buffer::NullBuffer;
@@ -111,7 +111,7 @@ impl<T: ArrowPrimitiveType> GroupValues for GroupValuesPrimitive<T>
111111
where
112112
T::Native: HashValue,
113113
{
114-
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<GroupIdx>) -> Result<()> {
114+
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<usize>) -> Result<()> {
115115
assert_eq!(cols.len(), 1);
116116
groups.clear();
117117

@@ -145,7 +145,7 @@ where
145145
}
146146
}
147147
};
148-
groups.push(GroupIdx::new(0, group_id as u64))
148+
groups.push(group_id)
149149
}
150150
Ok(())
151151
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl GroupValuesRows {
108108
}
109109

110110
impl GroupValues for GroupValuesRows {
111-
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<GroupIdx>) -> Result<()> {
111+
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<usize>) -> Result<()> {
112112
// Convert the group keys into the row format
113113
let group_rows = &mut self.rows_buffer;
114114
group_rows.clear();
@@ -121,7 +121,7 @@ impl GroupValues for GroupValuesRows {
121121
self.group_values_blocks.push_back(block);
122122
};
123123

124-
let mut group_values_blocks = mem::take(&mut self.group_values_blocks);
124+
let group_values_blocks = mem::take(&mut self.group_values_blocks);
125125

126126
// tracks to which group each of the input rows belongs
127127
groups.clear();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::sync::Arc;
2121
use std::task::{Context, Poll};
2222
use std::vec;
2323

24-
use crate::aggregates::group_values::{new_group_values, GroupValues};
24+
use crate::aggregates::group_values::{new_group_values, GroupIdx, GroupValues};
2525
use crate::aggregates::order::GroupOrderingFull;
2626
use crate::aggregates::{
2727
evaluate_group_by, evaluate_many, evaluate_optional, group_schema, AggregateMode,
@@ -353,7 +353,7 @@ pub(crate) struct GroupedHashAggregateStream {
353353

354354
/// scratch space for the current input [`RecordBatch`] being
355355
/// processed. Reused across batches here to avoid reallocations
356-
current_group_indices: Vec<usize>,
356+
current_group_indices: Vec<GroupIdx>,
357357

358358
/// Tracks if this stream is generating input or output
359359
exec_state: ExecutionState,

0 commit comments

Comments
 (0)