tustvold commented on issue #3463:
URL: https://github.com/apache/datafusion/issues/3463#issuecomment-3708398274
> Any chance you could link to that test? Would be sweet if it’s doable with
the current API!
I can't find it with a quick scan, but you can definitely do it using some
sort of shared state that you increment in the predicate closure.
For example
```
struct State {
filtered: AtomicUsize,
passed: AtomicUsize,
}
let state = Arc::new(State::default());
let s_captured = Arc::clone(&state);
let filter = Box::new(ArrowPredicateFn::new(projection, move |batch|{
let filtered = filter(batch);
state.filtered.fetch_add(Ordering::Relaxed, batch.len());
state.passed.fetch_add(Ordering::Relaxed, filtered.len());
return Ok(batch)
}))
```
You could even wrap this up in a custom `impl ArrowPredicate` instead of
relying on `ArrowPredicateFn`.
--
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]