dongjoon-hyun commented on PR #60643: URL: https://github.com/apache/spark/pull/60643#issuecomment-6967243589
Thank you for the review, @viirya. 1. You're right. `FilterExec` generates an `IsNotNull` check just before the first conjunct that reads its column, so the inferred `isnotnull(q)` never computes `q` earlier than the condition does. I changed the example in the description to `q > 0` and `cast(id as double) <=> q`. 2. Agreed. I suggested the same on #60516 in https://github.com/apache/spark/pull/60516#discussion_r4591709846. With this PR, reusing `PredicateHelper.failableOutput` there also gives `ConstantPropagation` the limit, join and aggregate cases. 3. I couldn't find a stated reason. The order comes from SPARK-13871, which generalized `NullFiltering`, and that rule already put the `IsNotNull` filters first. I agree that putting them after the condition would guard them in the `Filter` case whatever the child is, since an inferred filter already has to pass `cannotFail`. Still, I'd like to keep this PR as a fix in the current form and try the reorder separately, for two reasons. It changes the conjunct order of almost every `Filter` that gets an inferred filter: 258 of the 314 approved TPC-DS plans have a `Filter` whose inferred `isnotnull(x)` precedes a written conjunct on `x`, so their golden files would change. And `failableOutput` would stay needed anyway, e.g. by `CombineFilters` in #60631. If you agree, I'll file a JIRA for the reorder. -- 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]
