ahshahid commented on PR #54112: URL: https://github.com/apache/spark/pull/54112#issuecomment-3840601116
I am not sure there will be any change in terms of number of nodes being traversed , in new and current code.. my understanding is that the moment while traversing down, the Not operation is subsumed, the traversal will stop as the transform down is with pruning.. so if Not pattern is absent from the subtree it will stop, the way recursion will stop . Isn't it? On Tue, Feb 3, 2026, 2:16 AM Wenchen Fan ***@***.***> wrote: > ***@***.**** commented on this pull request. > ------------------------------ > > In > sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala > <https://github.com/apache/spark/pull/54112#discussion_r2758306319>: > > > > case Not(Not(e)) => e > > case Not(IsNull(e)) => IsNotNull(e) > case Not(IsNotNull(e)) => IsNull(e) > + > + case _ => not > } > } > > > Previously it was O(n^2): actualExprTransformer is called in > transformExpressionsUpWithPruning, and itself also calls > transformDownWithPruning. We repeatedly transform the sub-expression tree. > > I don't think recursion is a concern, as these transform APIs are all > recursive under the hood. > > — > Reply to this email directly, view it on GitHub > <https://github.com/apache/spark/pull/54112#discussion_r2758306319>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AC6XG2BQ654FG23MLRMINIL4KBYQVAVCNFSM6AAAAACTZIEGL6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONBUGM3TANBXGQ> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> > -- 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]
