-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore: enforce clippy::needless_pass_by_value to datafusion-physical-plan
#18864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -445,7 +445,7 @@ impl GroupedHashAggregateStream { | |
| /// Create a new GroupedHashAggregateStream | ||
| pub fn new( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a |
||
| agg: &AggregateExec, | ||
| context: Arc<TaskContext>, | ||
| context: &Arc<TaskContext>, | ||
| partition: usize, | ||
| ) -> Result<Self> { | ||
| debug!("Creating GroupedHashAggregateStream"); | ||
|
|
@@ -454,7 +454,7 @@ impl GroupedHashAggregateStream { | |
| let agg_filter_expr = agg.filter_expr.clone(); | ||
|
|
||
| let batch_size = context.session_config().batch_size(); | ||
| let input = agg.input.execute(partition, Arc::clone(&context))?; | ||
| let input = agg.input.execute(partition, Arc::clone(context))?; | ||
| let baseline_metrics = BaselineMetrics::new(&agg.metrics, partition); | ||
| let group_by_metrics = GroupByMetrics::new(&agg.metrics, partition); | ||
|
|
||
|
|
@@ -685,7 +685,7 @@ impl Stream for GroupedHashAggregateStream { | |
| } | ||
|
|
||
| // Do the grouping | ||
| self.group_aggregate_batch(batch)?; | ||
| self.group_aggregate_batch(&batch)?; | ||
|
|
||
| self.update_skip_aggregation_probe(input_rows); | ||
|
|
||
|
|
@@ -728,7 +728,7 @@ impl Stream for GroupedHashAggregateStream { | |
| self.spill_previous_if_necessary(&batch)?; | ||
|
|
||
| // Do the grouping | ||
| self.group_aggregate_batch(batch)?; | ||
| self.group_aggregate_batch(&batch)?; | ||
|
|
||
| // If we can begin emitting rows, do so, | ||
| // otherwise keep consuming input | ||
|
|
@@ -777,7 +777,7 @@ impl Stream for GroupedHashAggregateStream { | |
| if let Some(probe) = self.skip_aggregation_probe.as_mut() { | ||
| probe.record_skipped(&batch); | ||
| } | ||
| let states = self.transform_to_states(batch)?; | ||
| let states = self.transform_to_states(&batch)?; | ||
| return Poll::Ready(Some(Ok( | ||
| states.record_output(&self.baseline_metrics) | ||
| ))); | ||
|
|
@@ -854,12 +854,12 @@ impl RecordBatchStream for GroupedHashAggregateStream { | |
|
|
||
| impl GroupedHashAggregateStream { | ||
| /// Perform group-by aggregation for the given [`RecordBatch`]. | ||
| fn group_aggregate_batch(&mut self, batch: RecordBatch) -> Result<()> { | ||
| fn group_aggregate_batch(&mut self, batch: &RecordBatch) -> Result<()> { | ||
| // Evaluate the grouping expressions | ||
| let group_by_values = if self.spill_state.is_stream_merging { | ||
| evaluate_group_by(&self.spill_state.merging_group_by, &batch)? | ||
| evaluate_group_by(&self.spill_state.merging_group_by, batch)? | ||
| } else { | ||
| evaluate_group_by(&self.group_by, &batch)? | ||
| evaluate_group_by(&self.group_by, batch)? | ||
| }; | ||
|
|
||
| // Only create the timer if there are actual aggregate arguments to evaluate | ||
|
|
@@ -876,18 +876,18 @@ impl GroupedHashAggregateStream { | |
|
|
||
| // Evaluate the aggregation expressions. | ||
| let input_values = if self.spill_state.is_stream_merging { | ||
| evaluate_many(&self.spill_state.merging_aggregate_arguments, &batch)? | ||
| evaluate_many(&self.spill_state.merging_aggregate_arguments, batch)? | ||
| } else { | ||
| evaluate_many(&self.aggregate_arguments, &batch)? | ||
| evaluate_many(&self.aggregate_arguments, batch)? | ||
| }; | ||
| drop(timer); | ||
|
|
||
| // Evaluate the filter expressions, if any, against the inputs | ||
| let filter_values = if self.spill_state.is_stream_merging { | ||
| let filter_expressions = vec![None; self.accumulators.len()]; | ||
| evaluate_optional(&filter_expressions, &batch)? | ||
| evaluate_optional(&filter_expressions, batch)? | ||
| } else { | ||
| evaluate_optional(&self.filter_expressions, &batch)? | ||
| evaluate_optional(&self.filter_expressions, batch)? | ||
| }; | ||
|
|
||
| for group_values in &group_by_values { | ||
|
|
@@ -1217,10 +1217,10 @@ impl GroupedHashAggregateStream { | |
| } | ||
|
|
||
| /// Transforms input batch to intermediate aggregate state, without grouping it | ||
| fn transform_to_states(&self, batch: RecordBatch) -> Result<RecordBatch> { | ||
| let mut group_values = evaluate_group_by(&self.group_by, &batch)?; | ||
| let input_values = evaluate_many(&self.aggregate_arguments, &batch)?; | ||
| let filter_values = evaluate_optional(&self.filter_expressions, &batch)?; | ||
| fn transform_to_states(&self, batch: &RecordBatch) -> Result<RecordBatch> { | ||
| let mut group_values = evaluate_group_by(&self.group_by, batch)?; | ||
| let input_values = evaluate_many(&self.aggregate_arguments, batch)?; | ||
| let filter_values = evaluate_optional(&self.filter_expressions, batch)?; | ||
|
|
||
| assert_eq_or_internal_err!( | ||
| group_values.len(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,13 +54,13 @@ pub struct GroupedTopKAggregateStream { | |
| impl GroupedTopKAggregateStream { | ||
| pub fn new( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This API is private inside |
||
| aggr: &AggregateExec, | ||
| context: Arc<TaskContext>, | ||
| context: &Arc<TaskContext>, | ||
| partition: usize, | ||
| limit: usize, | ||
| ) -> Result<Self> { | ||
| let agg_schema = Arc::clone(&aggr.schema); | ||
| let group_by = aggr.group_by.clone(); | ||
| let input = aggr.input.execute(partition, Arc::clone(&context))?; | ||
| let input = aggr.input.execute(partition, Arc::clone(context))?; | ||
| let baseline_metrics = BaselineMetrics::new(&aggr.metrics, partition); | ||
| let group_by_metrics = GroupByMetrics::new(&aggr.metrics, partition); | ||
| let aggregate_arguments = | ||
|
|
@@ -97,11 +97,12 @@ impl RecordBatchStream for GroupedTopKAggregateStream { | |
| } | ||
|
|
||
| impl GroupedTopKAggregateStream { | ||
| fn intern(&mut self, ids: ArrayRef, vals: ArrayRef) -> Result<()> { | ||
| fn intern(&mut self, ids: &ArrayRef, vals: &ArrayRef) -> Result<()> { | ||
| let _timer = self.group_by_metrics.time_calculating_group_ids.timer(); | ||
|
|
||
| let len = ids.len(); | ||
| self.priority_map.set_batch(ids, Arc::clone(&vals)); | ||
| self.priority_map | ||
| .set_batch(Arc::clone(ids), Arc::clone(vals)); | ||
|
|
||
| let has_nulls = vals.null_count() > 0; | ||
| for row_idx in 0..len { | ||
|
|
@@ -167,7 +168,7 @@ impl Stream for GroupedTopKAggregateStream { | |
| let input_values = Arc::clone(&input_values[0][0]); | ||
|
|
||
| // iterate over each column of group_by values | ||
| (*self).intern(group_by_values, input_values)?; | ||
| (*self).intern(&group_by_values, &input_values)?; | ||
| } | ||
| // inner is done, emit all rows and switch to producing output | ||
| None => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a
pub(crate)