alamb commented on code in PR #12469:
URL: https://github.com/apache/arrow-rs/pull/12469#discussion_r4758547755


##########
parquet/src/arrow/arrow_reader/filter.rs:
##########
@@ -35,6 +36,63 @@ pub trait ArrowPredicate: Send + 'static {
     /// * `true`:the row should be returned
     /// * `false` or `null`: the row should not be returned
     fn evaluate(&mut self, batch: RecordBatch) -> Result<BooleanArray, 
ArrowError>;
+
+    /// Describes this predicate as a comparison of its only projected column

Review Comment:
   This would effectively move the
   
   parquet/tests/arrow_reader/comparison_pushdown.rs
   
   INto datafusion I think



##########
parquet/src/arrow/arrow_reader/filter.rs:
##########
@@ -35,6 +36,63 @@ pub trait ArrowPredicate: Send + 'static {
     /// * `true`:the row should be returned
     /// * `false` or `null`: the row should not be returned
     fn evaluate(&mut self, batch: RecordBatch) -> Result<BooleanArray, 
ArrowError>;
+
+    /// Describes this predicate as a comparison of its only projected column

Review Comment:
   Yeah, this is the key API change -- basically we have to change the 
Predicate API to allow processing on (parquet) encoded data. I think in general 
this is a promising idea. 
   
   There are other types this could help with too (like dictionary encoded 
arrays, or potentially evaluating directly on string bytes, etc)
   
   I actually think trying to evaluate predicates directly in the `parquet` 
crate may get complicated quickly because:
   1.  there are semantics that are engine dependent (e.g. is `0.0` == `+0.0`?)
   2. There may be functions (like string match, etc) that have engine specific 
meanings
   
   What would you think about implementing an API that kept that out of the 
parquet crate (and we would define it in datafusion or other engines?
   
   Something like this maybe
   
   ```rust
   trait ArrowPredicate {
   ...
     /// Evaluate this predicate directly on ALP encoded data if possible
     /// the default returns None in which case the parqute reader will convert 
to arrow
     /// and then call `evaluate`
     fn evalute_alp(&mut self, header: &..., data: ...) -> 
Result<Option<BooleanArray>>> {
       return None; // default implementation 
     }
    
     /// Evaluate this predicate directly on byte stream split data
     fn evalute_bss(&mut self, header: &..., data: ...) -> 
Result<Option<BooleanArray>>> {
       return None; // default implementation 
     }
   
   }
   ```
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to