From dad79c0010232b0db1026a839159556f6e247893 Mon Sep 17 00:00:00 2001 From: kamille Date: Tue, 22 Oct 2024 23:28:58 +0800 Subject: [PATCH] fix compile. --- .../src/aggregates/group_values/column.rs | 21 ++++++++----------- .../aggregates/group_values/group_column.rs | 16 ++++++++++---- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/datafusion/physical-plan/src/aggregates/group_values/column.rs b/datafusion/physical-plan/src/aggregates/group_values/column.rs index d7d3196e8c95..87bcd8e10ff5 100644 --- a/datafusion/physical-plan/src/aggregates/group_values/column.rs +++ b/datafusion/physical-plan/src/aggregates/group_values/column.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +use std::mem; + use crate::aggregates::group_values::group_column::{ ByteGroupValueBuilder, ByteViewGroupValueBuilder, GroupColumn, PrimitiveGroupValueBuilder, @@ -246,14 +248,6 @@ impl GroupValuesColumn { ) } - #[inline] - fn get_group_indices_from_list( - &self, - start_group_index: usize, - ) -> GroupIndicesIterator { - GroupIndicesIterator::new(start_group_index, &self.group_index_lists) - } - /// Collect vectorized context by checking hash values of `cols` in `map` /// /// 1. If bucket not found @@ -328,7 +322,7 @@ impl GroupValuesColumn { } fn vectorized_compare(&mut self) { - + } } @@ -412,10 +406,10 @@ impl GroupValues for GroupValuesColumn { // tracks to which group each of the input rows belongs groups.clear(); - let batch_hashes = &mut self.hashes_buffer; + let mut batch_hashes = mem::take(&mut self.hashes_buffer); batch_hashes.clear(); batch_hashes.resize(n_rows, 0); - create_hashes(cols, &self.random_state, batch_hashes)?; + create_hashes(cols, &self.random_state, &mut batch_hashes)?; // General steps for one round `vectorized compare & append`: // 1. Collect vectorized context by checking hash values of `cols` in `map` @@ -433,10 +427,13 @@ impl GroupValues for GroupValuesColumn { self.vectorized_compare_results.clear(); // 1. Collect vectorized context by checking hash values of `cols` in `map` - self.collect_vectorized_process_context(batch_hashes); + self.collect_vectorized_process_context(&batch_hashes); // 2. Perform `vectorized compare` } + + self.hashes_buffer = batch_hashes; + Ok(()) } diff --git a/datafusion/physical-plan/src/aggregates/group_values/group_column.rs b/datafusion/physical-plan/src/aggregates/group_values/group_column.rs index 83ec39c6d8f8..89cfea3b4de6 100644 --- a/datafusion/physical-plan/src/aggregates/group_values/group_column.rs +++ b/datafusion/physical-plan/src/aggregates/group_values/group_column.rs @@ -617,14 +617,14 @@ impl ByteViewGroupValueBuilder { if all_non_null { self.nulls.append_n(rows.len(), false); for &row in rows { - self.append_value(arr, row); + self.do_append_val_inner(arr, row); } } else { for &row in rows { // Null row case, set and return if arr.is_valid(row) { self.nulls.append(false); - self.append_value(arr, row); + self.do_append_val_inner(arr, row); } else { self.nulls.append(true); self.views.push(0); @@ -645,10 +645,10 @@ impl ByteViewGroupValueBuilder { // Not null row case self.nulls.append(false); - self.append_value(arr, row); + self.do_append_val_inner(arr, row); } - fn append_value(&mut self, array: &GenericByteViewArray, row: usize) + fn do_append_val_inner(&mut self, array: &GenericByteViewArray, row: usize) where B: ByteViewType, { @@ -690,7 +690,15 @@ impl ByteViewGroupValueBuilder { fn equal_to_inner(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool { let array = array.as_byte_view::(); + self.do_equal_to_inner(lhs_row, array, rhs_row) + } + fn do_equal_to_inner( + &self, + lhs_row: usize, + array: &GenericByteViewArray, + rhs_row: usize, + ) -> bool { // Check if nulls equal firstly let exist_null = self.nulls.is_null(lhs_row); let input_null = array.is_null(rhs_row);