This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 67d66faa82 Remove unused Results (#8189)
67d66faa82 is described below

commit 67d66faa829ea2fe102384a7534f86e66a3027b7
Author: Mustafa Akur <[email protected]>
AuthorDate: Wed Nov 15 18:02:00 2023 +0300

    Remove unused Results (#8189)
---
 datafusion/physical-plan/src/aggregates/mod.rs | 10 +++++-----
 datafusion/physical-plan/src/windows/mod.rs    | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/datafusion/physical-plan/src/aggregates/mod.rs 
b/datafusion/physical-plan/src/aggregates/mod.rs
index 3ac8129297..7d7fba6ef6 100644
--- a/datafusion/physical-plan/src/aggregates/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/mod.rs
@@ -405,7 +405,7 @@ fn get_aggregate_search_mode(
     aggr_expr: &mut [Arc<dyn AggregateExpr>],
     order_by_expr: &mut [Option<LexOrdering>],
     ordering_req: &mut Vec<PhysicalSortExpr>,
-) -> Result<PartitionSearchMode> {
+) -> PartitionSearchMode {
     let groupby_exprs = group_by
         .expr
         .iter()
@@ -413,11 +413,11 @@ fn get_aggregate_search_mode(
         .collect::<Vec<_>>();
     let mut partition_search_mode = PartitionSearchMode::Linear;
     if !group_by.is_single() || groupby_exprs.is_empty() {
-        return Ok(partition_search_mode);
+        return partition_search_mode;
     }
 
     if let Some((should_reverse, mode)) =
-        get_window_mode(&groupby_exprs, ordering_req, input)?
+        get_window_mode(&groupby_exprs, ordering_req, input)
     {
         let all_reversible = aggr_expr
             .iter()
@@ -437,7 +437,7 @@ fn get_aggregate_search_mode(
         }
         partition_search_mode = mode;
     }
-    Ok(partition_search_mode)
+    partition_search_mode
 }
 
 /// Check whether group by expression contains all of the expression inside 
`requirement`
@@ -513,7 +513,7 @@ impl AggregateExec {
             &mut aggr_expr,
             &mut order_by_expr,
             &mut ordering_req,
-        )?;
+        );
 
         // Get GROUP BY expressions:
         let groupby_exprs = group_by.input_exprs();
diff --git a/datafusion/physical-plan/src/windows/mod.rs 
b/datafusion/physical-plan/src/windows/mod.rs
index 541192c00d..d97e3c93a1 100644
--- a/datafusion/physical-plan/src/windows/mod.rs
+++ b/datafusion/physical-plan/src/windows/mod.rs
@@ -405,7 +405,7 @@ pub fn get_best_fitting_window(
     let orderby_keys = window_exprs[0].order_by();
     let (should_reverse, partition_search_mode) =
         if let Some((should_reverse, partition_search_mode)) =
-            get_window_mode(partitionby_exprs, orderby_keys, input)?
+            get_window_mode(partitionby_exprs, orderby_keys, input)
         {
             (should_reverse, partition_search_mode)
         } else {
@@ -467,12 +467,12 @@ pub fn get_best_fitting_window(
 ///   can run with existing input ordering, so we can remove `SortExec` before 
it.
 /// The `bool` field in the return value represents whether we should reverse 
window
 /// operator to remove `SortExec` before it. The `PartitionSearchMode` field 
represents
-/// the mode this window operator should work in to accomodate the existing 
ordering.
+/// the mode this window operator should work in to accommodate the existing 
ordering.
 pub fn get_window_mode(
     partitionby_exprs: &[Arc<dyn PhysicalExpr>],
     orderby_keys: &[PhysicalSortExpr],
     input: &Arc<dyn ExecutionPlan>,
-) -> Result<Option<(bool, PartitionSearchMode)>> {
+) -> Option<(bool, PartitionSearchMode)> {
     let input_eqs = input.equivalence_properties();
     let mut partition_by_reqs: Vec<PhysicalSortRequirement> = vec![];
     let (_, indices) = input_eqs.find_longest_permutation(partitionby_exprs);
@@ -499,10 +499,10 @@ pub fn get_window_mode(
             } else {
                 PartitionSearchMode::PartiallySorted(indices)
             };
-            return Ok(Some((should_swap, mode)));
+            return Some((should_swap, mode));
         }
     }
-    Ok(None)
+    None
 }
 
 #[cfg(test)]
@@ -869,7 +869,7 @@ mod tests {
                 order_by_exprs.push(PhysicalSortExpr { expr, options });
             }
             let res =
-                get_window_mode(&partition_by_exprs, &order_by_exprs, 
&exec_unbounded)?;
+                get_window_mode(&partition_by_exprs, &order_by_exprs, 
&exec_unbounded);
             // Since reversibility is not important in this test. Convert 
Option<(bool, PartitionSearchMode)> to Option<PartitionSearchMode>
             let res = res.map(|(_, mode)| mode);
             assert_eq!(
@@ -1033,7 +1033,7 @@ mod tests {
             }
 
             assert_eq!(
-                get_window_mode(&partition_by_exprs, &order_by_exprs, 
&exec_unbounded)?,
+                get_window_mode(&partition_by_exprs, &order_by_exprs, 
&exec_unbounded),
                 *expected,
                 "Unexpected result for in unbounded test case#: {case_idx:?}, 
case: {test_case:?}"
             );

Reply via email to