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

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


The following commit(s) were added to refs/heads/main by this push:
     new 0bbce5dce2 [Minor]: Refactor to use Result.transpose() (#11882)
0bbce5dce2 is described below

commit 0bbce5dce29df1123b0ab87a8907482c72d284c1
Author: Douglas Anderson <[email protected]>
AuthorDate: Wed Aug 7 20:32:57 2024 -0600

    [Minor]: Refactor to use Result.transpose() (#11882)
    
    `Result.transpose()` converts `Result<Option<T>>` to `Option<Result<T>>`.
    
    > Ok(None) will be mapped to None. Ok(Some(_)) and Err(_) will be mapped to 
Some(Ok(_)) and Some(Err(_)).
    - https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose
---
 datafusion/core/src/datasource/physical_plan/arrow_file.rs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/datafusion/core/src/datasource/physical_plan/arrow_file.rs 
b/datafusion/core/src/datasource/physical_plan/arrow_file.rs
index e720b4efff..a1ee6fbe13 100644
--- a/datafusion/core/src/datasource/physical_plan/arrow_file.rs
+++ b/datafusion/core/src/datasource/physical_plan/arrow_file.rs
@@ -331,11 +331,9 @@ impl FileOpener for ArrowOpener {
                             .into_iter()
                             .zip(recordbatch_results)
                             .filter_map(move |(block, data)| {
-                                match decoder.read_record_batch(&block, 
&data.into()) {
-                                    Ok(Some(record_batch)) => 
Some(Ok(record_batch)),
-                                    Ok(None) => None,
-                                    Err(err) => Some(Err(err)),
-                                }
+                                decoder
+                                    .read_record_batch(&block, &data.into())
+                                    .transpose()
                             }),
                     )
                     .boxed())


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to