You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/27 09:20:26 UTC

[GitHub] [arrow-datafusion] Ted-Jiang opened a new pull request, #4387: Fix page index pruning fail on complex_expr

Ted-Jiang opened a new pull request, #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387

   Signed-off-by: yangjiang <ya...@ebay.com>
   
   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #4317.
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ursabot commented on pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#issuecomment-1329271015

   Benchmark runs are scheduled for baseline = da55f93b215d30b10064c140ac192acaf4c810e1 and contender = 9139183b19ca29e0557bc32085396e25f046feb1. 9139183b19ca29e0557bc32085396e25f046feb1 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/45b7802cc218438dbed399f0914381ae...954f35c5f06c4e6480f62f57ddd032fd/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/ef5e96cafe2d437586dbd48cf914ea09...165a8ec4e15b42219a0e873ac695f478/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/e5b04a99577344dba7a427172c65362c...fda71d1559b5423582dff895e1095882/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/b3d70235c3a04031a08d3eab0d6eb2ab...a2eb8fb37fcd45a9b7c027449fcba03d/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Ted-Jiang commented on a diff in pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on code in PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#discussion_r1032896021


##########
datafusion/core/src/physical_plan/file_format/parquet/page_filter.rs:
##########
@@ -126,46 +126,50 @@ pub(crate) fn build_page_filter(
         let mut row_selections = VecDeque::with_capacity(page_index_predicates.len());
         for predicate in page_index_predicates {
             // `extract_page_index_push_down_predicates` only return predicate with one col.
-            let col_id = *predicate.need_input_columns_ids().iter().next().unwrap();
-            let mut selectors = Vec::with_capacity(row_groups.len());
-            for r in row_groups.iter() {
-                let rg_offset_indexes = file_offset_indexes.get(*r);
-                let rg_page_indexes = file_page_indexes.get(*r);
-                if let (Some(rg_page_indexes), Some(rg_offset_indexes)) =
-                    (rg_page_indexes, rg_offset_indexes)
-                {
-                    selectors.extend(
-                        prune_pages_in_one_row_group(
-                            &groups[*r],
-                            &predicate,
-                            rg_offset_indexes.get(col_id),
-                            rg_page_indexes.get(col_id),
-                            groups[*r].column(col_id).column_descr(),
-                            file_metrics,
-                        )
-                        .map_err(|e| {
-                            ArrowError::ParquetError(format!(
-                                "Fail in prune_pages_in_one_row_group: {}",
-                                e
-                            ))
-                        }),
-                    );
-                } else {
-                    trace!(
+            //  when building `PruningPredicate`, some single column filter like `abs(i) = 1`

Review Comment:
   I think we can support rewrite `abs(i) = 1` to `i = 1 or i = -1`🤔 further. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#discussion_r1032923875


##########
datafusion/core/src/physical_plan/file_format/parquet/page_filter.rs:
##########
@@ -126,46 +126,50 @@ pub(crate) fn build_page_filter(
         let mut row_selections = VecDeque::with_capacity(page_index_predicates.len());
         for predicate in page_index_predicates {
             // `extract_page_index_push_down_predicates` only return predicate with one col.
-            let col_id = *predicate.need_input_columns_ids().iter().next().unwrap();
-            let mut selectors = Vec::with_capacity(row_groups.len());
-            for r in row_groups.iter() {
-                let rg_offset_indexes = file_offset_indexes.get(*r);
-                let rg_page_indexes = file_page_indexes.get(*r);
-                if let (Some(rg_page_indexes), Some(rg_offset_indexes)) =
-                    (rg_page_indexes, rg_offset_indexes)
-                {
-                    selectors.extend(
-                        prune_pages_in_one_row_group(
-                            &groups[*r],
-                            &predicate,
-                            rg_offset_indexes.get(col_id),
-                            rg_page_indexes.get(col_id),
-                            groups[*r].column(col_id).column_descr(),
-                            file_metrics,
-                        )
-                        .map_err(|e| {
-                            ArrowError::ParquetError(format!(
-                                "Fail in prune_pages_in_one_row_group: {}",
-                                e
-                            ))
-                        }),
-                    );
-                } else {
-                    trace!(
+            //  when building `PruningPredicate`, some single column filter like `abs(i) = 1`
+            //  will be rewrite to `lit(true)`, so may have an empty required_columns.

Review Comment:
   Thank you for these comments, BTW -- they help both to review the code as well as read it in the future 👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb merged pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
alamb merged PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Ted-Jiang commented on a diff in pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on code in PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#discussion_r1032896312


##########
datafusion/core/src/physical_plan/file_format/parquet/page_filter.rs:
##########
@@ -126,46 +126,50 @@ pub(crate) fn build_page_filter(
         let mut row_selections = VecDeque::with_capacity(page_index_predicates.len());
         for predicate in page_index_predicates {
             // `extract_page_index_push_down_predicates` only return predicate with one col.
-            let col_id = *predicate.need_input_columns_ids().iter().next().unwrap();
-            let mut selectors = Vec::with_capacity(row_groups.len());
-            for r in row_groups.iter() {
-                let rg_offset_indexes = file_offset_indexes.get(*r);
-                let rg_page_indexes = file_page_indexes.get(*r);
-                if let (Some(rg_page_indexes), Some(rg_offset_indexes)) =
-                    (rg_page_indexes, rg_offset_indexes)
-                {
-                    selectors.extend(
-                        prune_pages_in_one_row_group(
-                            &groups[*r],
-                            &predicate,
-                            rg_offset_indexes.get(col_id),
-                            rg_page_indexes.get(col_id),
-                            groups[*r].column(col_id).column_descr(),
-                            file_metrics,
-                        )
-                        .map_err(|e| {
-                            ArrowError::ParquetError(format!(
-                                "Fail in prune_pages_in_one_row_group: {}",
-                                e
-                            ))
-                        }),
-                    );
-                } else {
-                    trace!(
+            //  when building `PruningPredicate`, some single column filter like `abs(i) = 1`

Review Comment:
   File #4388 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Ted-Jiang commented on pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#issuecomment-1328205600

   @alamb I think now page pruning has the same amount of test case as row group pruning, do we need any more test case so that we can enable Page Filtering by default 🤔


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Ted-Jiang commented on a diff in pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on code in PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#discussion_r1032896863


##########
datafusion/core/src/physical_plan/file_format/parquet/page_filter.rs:
##########
@@ -126,46 +126,50 @@ pub(crate) fn build_page_filter(
         let mut row_selections = VecDeque::with_capacity(page_index_predicates.len());
         for predicate in page_index_predicates {
             // `extract_page_index_push_down_predicates` only return predicate with one col.
-            let col_id = *predicate.need_input_columns_ids().iter().next().unwrap();
-            let mut selectors = Vec::with_capacity(row_groups.len());
-            for r in row_groups.iter() {
-                let rg_offset_indexes = file_offset_indexes.get(*r);
-                let rg_page_indexes = file_page_indexes.get(*r);
-                if let (Some(rg_page_indexes), Some(rg_offset_indexes)) =
-                    (rg_page_indexes, rg_offset_indexes)
-                {
-                    selectors.extend(
-                        prune_pages_in_one_row_group(
-                            &groups[*r],
-                            &predicate,
-                            rg_offset_indexes.get(col_id),
-                            rg_page_indexes.get(col_id),
-                            groups[*r].column(col_id).column_descr(),
-                            file_metrics,
-                        )
-                        .map_err(|e| {
-                            ArrowError::ParquetError(format!(
-                                "Fail in prune_pages_in_one_row_group: {}",
-                                e
-                            ))
-                        }),
-                    );
-                } else {
-                    trace!(
+            //  when building `PruningPredicate`, some single column filter like `abs(i) = 1`
+            //  will be rewrite to `lit(true)`, so may have an empty required_columns.

Review Comment:
   this is the why it fails.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Ted-Jiang commented on a diff in pull request #4387: Fix page index pruning fail on complex_expr

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on code in PR #4387:
URL: https://github.com/apache/arrow-datafusion/pull/4387#discussion_r1032895799


##########
datafusion/core/tests/parquet/page_pruning.rs:
##########
@@ -495,22 +491,20 @@ async fn prune_f64_lt() {
 }
 
 #[tokio::test]
-#[ignore]
 async fn prune_f64_scalar_fun_and_gt() {
     // result of sql "SELECT * FROM t where abs(f - 1) <= 0.000001  and f >= 0.1"
     // only use "f >= 0" to prune
     test_prune(
         Scenario::Float64,
         "SELECT * FROM t where abs(f - 1) <= 0.000001  and f >= 0.1",
         Some(0),
-        Some(2),
+        Some(10),

Review Comment:
    only use "f >= 0" to prune it will prune two pages (each 5 rows), so make it 10 make sense



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org