zhuqi-lucas commented on code in PR #24638:
URL: https://github.com/apache/datafusion/pull/24638#discussion_r3848922786


##########
datafusion/core/tests/parquet/filter_pushdown.rs:
##########
@@ -746,3 +752,51 @@ impl PredicateCacheTest {
         Ok(())
     }
 }
+
+/// A predicate that is pushed into the parquet decoder and then fails while it
+/// is being evaluated must report the original error, so that callers can 
still
+/// tell a user error apart from an internal one.
+#[tokio::test]
+async fn pushed_down_predicate_reports_the_original_error() {
+    let tempdir = TempDir::new_in(Path::new(".")).unwrap();
+    let path = tempdir.path().join("cast_error.parquet");
+
+    let batch = RecordBatch::try_from_iter(vec![(
+        "s",
+        Arc::new(StringArray::from(vec!["not_an_int"])) as ArrayRef,

Review Comment:
   Forward-looking nit on test robustness: the file has a single column `s` and 
the predicate is also on `s`, so the projection contains **zero** non-filter 
columns. That's exactly the shape the narrow-projection pushdown gate being 
prototyped in #24426 declines.
   
   No such gate exists on `main` today (only unsupported nested types make 
`build()` return `None`), so this passes now. But reading that branch's gate, 
this test would not survive it:
   
   ```rust
   // datasource-parquet/src/source.rs
   const PUSHDOWN_MIN_NON_FILTER_COLS: usize = 3;
   ...
   if pushdown_filters && !has_dynamic_filter && mode != Always {
       // non_filter_projected = |projected cols| - |filter cols|
       if non_filter_projected < PUSHDOWN_MIN_NON_FILTER_COLS {
           pushdown_filters = false;   // filter goes back to a FilterExec
       }
   }
   ```
   
   With no `ORDER BY`/`LIMIT` there is no dynamic filter, so the 
`!has_dynamic_filter` guard doesn't exempt this scan; `non_filter_projected` is 
0, pushdown is declined, and `assert!(!plan.contains("FilterExec"))` fails.
   
   Note the threshold is 3, so adding one unfiltered column isn't enough — that 
still leaves `non_filter_projected = 1`. Surviving that gate would take three 
non-filter projected columns (four total). Not blocking, just something to know 
if that gate lands.



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


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

Reply via email to