adriangb commented on code in PR #19619:
URL: https://github.com/apache/datafusion/pull/19619#discussion_r2670281773
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -619,7 +686,23 @@ impl ExecutionPlan for FilterExec {
impl EmbeddedProjection for FilterExec {
fn with_projection(&self, projection: Option<Vec<usize>>) -> Result<Self> {
- self.with_projection(projection)
+ // Check if the projection is valid
+ can_project(&self.schema(), projection.as_ref())?;
+
+ let projection = match projection {
+ Some(projection) => match &self.projection {
+ Some(p) => Some(projection.iter().map(|i| p[*i]).collect()),
+ None => Some(projection),
+ },
+ None => None,
+ };
+
+ FilterExecBuilder::new(Arc::clone(&self.predicate),
Arc::clone(&self.input))
+ .with_projection(projection)
+ .with_default_selectivity(self.default_selectivity)
+ .with_batch_size(self.batch_size)
+ .with_fetch(self.fetch)
+ .build()
Review Comment:
I guess `FilterExecBuilder` could do the same thing? I can see why that
would be the correct behavior.
--
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]