Conversation
…wExpression.hasWindowExpression
uros-b
commented
Sep 21, 2026
uros-b
left a comment
Member
Author
There was a problem hiding this comment.
This should be good to go, I don't think there are any additional occurrences in sql catalyst / core
dongjoon-hyun
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Several places in
catalystand SQL core test for a matching node/element withfind(pred)followed by anOptionpresence check. OnTreeNode(and Scala collections)exists(pred)is the equivalent, returning theBooleandirectly. This replaces the pattern in four spots:WindowExpression.hasWindowExpression:e.find(_.isInstanceOf[WindowExpression]).isDefined->e.exists(...)AliasHelper.getAliasMap:a.child.find(_.isInstanceOf[AggregateExpression]).isEmpty->!a.child.exists(...)Analyzer.ResolveSQLFunctions.hasSQLFunctionExpression:_.find(_.isInstanceOf[SQLFunctionExpression]).nonEmpty->_.exists(...)V2TableRefreshUtil.containsCommand:plan.find(_.isInstanceOf[Command]).isDefined->plan.exists(...)Why are the changes needed?
find(pred).isDefined/find(pred).nonEmptyare equivalent toexists(pred), andfind(pred).isEmptyto!exists(pred)-- the same short-circuiting traversal, butfindallocates anOptionfor the first match only for it to be discarded by the presence check.existsreturns theBooleandirectly and reads more clearly. Behavior is unchanged.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing tests. This is a behavior-preserving refactor; the
catalystandsql(core) modules compile cleanly.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)