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/08/15 15:54:31 UTC

[GitHub] [arrow-rs] tustvold opened a new pull request, #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

tustvold opened a new pull request, #2452:
URL: https://github.com/apache/arrow-rs/pull/2452

   # 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 #2431
   
   # 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.
   -->
   
   Supports RowFilter within the sync interface and uses this to hook into the fuzz tests for better coverage
   
   # 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 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 `breaking 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-rs] ursabot commented on pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

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

   Benchmark runs are scheduled for baseline = 0a1f71c8061f8c895fbe8c97b0c3d81cec182541 and contender = 569c781290dc12a8e2d86069df3827225a53d563. 569c781290dc12a8e2d86069df3827225a53d563 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-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/7d8f510681bc415c966d783116988492...827ad019c08640c69a2a80ec6e2c1fdd/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/7489fb142175485d94f57413cd2e76ee...1b189736e9d345a0ba8a93a1e2a427aa/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/5c6bc6a4d66e4e378417cb5c4cef0e9a...c676ddaafe6f47839f71e54f38033463/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/7169ae4572c44a72ad220cd5f95f36df...10c2a04658254741ac12d5e75ea0834e/)
   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-rs] tustvold commented on a diff in pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2452:
URL: https://github.com/apache/arrow-rs/pull/2452#discussion_r945898208


##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -1047,8 +1076,29 @@ mod tests {
         enabled_statistics: EnabledStatistics,
         /// Encoding
         encoding: Encoding,
-        //row selections and total selected row count
+        /// row selections and total selected row count
         row_selections: Option<(RowSelection, usize)>,
+        /// row filter
+        row_filter: Option<Vec<bool>>,
+    }
+
+    impl std::fmt::Debug for TestOptions {

Review Comment:
   Manually implement this, to avoid printing entire contents of row_selections and row_filter



-- 
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-rs] tustvold commented on a diff in pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2452:
URL: https://github.com/apache/arrow-rs/pull/2452#discussion_r945899298


##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -1121,6 +1174,19 @@ mod tests {
             }
         }
 
+        fn with_row_filter(self) -> Self {

Review Comment:
   I am pretty chuffed with this fuzz test harness, in particular how easy it is to add new test cases. It has definitely been worth the investment



-- 
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-rs] alamb commented on a diff in pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

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


##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -400,22 +400,46 @@ impl<T: ChunkReader + 'static> ArrowReaderBuilder<SyncReader<T>> {
         Self::new_builder(SyncReader(reader), metadata, options)
     }
 
+    /// Build a [`ParquetRecordBatchReader`]
+    ///
+    /// Note: this will eagerly evaluate any [`RowFilter`] before returning
     pub fn build(self) -> Result<ParquetRecordBatchReader> {
         let reader =
             FileReaderRowGroupCollection::new(Arc::new(self.input.0), self.row_groups);
+
+        let mut filter = self.filter;
+        let mut selection = self.selection;
+
+        if let Some(filter) = filter.as_mut() {

Review Comment:
   I don't understand the `mut` here -- it seems off to me because I wouldn't expect that the filter / predicate contains state that could be modified. Maybe I misunderstand something



##########
parquet/src/arrow/async_reader.rs:
##########
@@ -283,9 +283,6 @@ where
         batch_size: usize,
     ) -> ReadResult<T> {
         // TODO: calling build_array multiple times is wasteful

Review Comment:
   is this TODO still valid?



##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -1047,8 +1076,29 @@ mod tests {
         enabled_statistics: EnabledStatistics,
         /// Encoding
         encoding: Encoding,
-        //row selections and total selected row count
+        /// row selections and total selected row count
         row_selections: Option<(RowSelection, usize)>,
+        /// row filter
+        row_filter: Option<Vec<bool>>,
+    }
+
+    impl std::fmt::Debug for TestOptions {

Review Comment:
   ```suggestion
       // Manually implement this, to avoid printing entire contents of row_selections and row_filter
       impl std::fmt::Debug for TestOptions {
   ```



##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -1121,6 +1174,19 @@ mod tests {
             }
         }
 
+        fn with_row_filter(self) -> Self {

Review Comment:
   TIL "chuffed": https://www.merriam-webster.com/dictionary/chuffed (not common in American usage 😆 )



-- 
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-rs] tustvold commented on a diff in pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2452:
URL: https://github.com/apache/arrow-rs/pull/2452#discussion_r945913530


##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -400,22 +400,46 @@ impl<T: ChunkReader + 'static> ArrowReaderBuilder<SyncReader<T>> {
         Self::new_builder(SyncReader(reader), metadata, options)
     }
 
+    /// Build a [`ParquetRecordBatchReader`]
+    ///
+    /// Note: this will eagerly evaluate any [`RowFilter`] before returning
     pub fn build(self) -> Result<ParquetRecordBatchReader> {
         let reader =
             FileReaderRowGroupCollection::new(Arc::new(self.input.0), self.row_groups);
+
+        let mut filter = self.filter;
+        let mut selection = self.selection;
+
+        if let Some(filter) = filter.as_mut() {

Review Comment:
   I purposefully opted to make ArrowPredicate take `&mut self`, this can be exploited to allow for tracking of the current position - something this PR in fact makes use of.



-- 
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-rs] tustvold commented on a diff in pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2452:
URL: https://github.com/apache/arrow-rs/pull/2452#discussion_r945913740


##########
parquet/src/arrow/async_reader.rs:
##########
@@ -283,9 +283,6 @@ where
         batch_size: usize,
     ) -> ReadResult<T> {
         // TODO: calling build_array multiple times is wasteful

Review Comment:
   Yes, I intend to fix in a follow up



-- 
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-rs] tustvold merged pull request #2452: Support RowFilter within ParquetRecordBatchReader (#2431)

Posted by GitBox <gi...@apache.org>.
tustvold merged PR #2452:
URL: https://github.com/apache/arrow-rs/pull/2452


-- 
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