-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache parsed expressions and binding analysis in more places. #14124
Conversation
Main changes: 1) Cache parsed and analyzed expressions within PlannerContext for a single SQL query. 2) Cache parsed expressions together with input binding analysis using a new class AnalyzeExpr. This speeds up SQL planning, because SQL planning involves parsing analyzing the same expression strings over and over again.
In talking offline with @clintropolis, I learned he's planning on doing some work to make it faster to get required bindings in the future, minimizing the need to introduce |
Pushed a simplifying commit and marked ready for review. |
@@ -303,7 +303,7 @@ public static PostAggregator toPostAggregator( | |||
postAggregatorVisitor.getOutputNamePrefix() + postAggregatorVisitor.getAndIncrementCounter(), | |||
druidExpression.getExpression(), | |||
null, | |||
plannerContext.getExprMacroTable() | |||
plannerContext.parse(druidExpression.getExpression()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: am conflicted, this reads funny like it isn't obvious at a glance it is parsing native expressions since like why would that be built-in to the plannerContext, otoh it would be hella tedious to always be plannerContext.getExpressionParser().parse(...)
all the time..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the idea is to avoid doing plannerContext.getExpressionParser().parse(...)
all the time.
What do you think about naming it plannerContext.parseExpression(...)
?
OTOH, we could also go with plannerContext.getExpressionParser().parse(...)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about naming it plannerContext.parseExpression(...)?
that does seem nicer 👍
…#14124) * Cache parsed expressions and binding analysis in more places. Main changes: 1) Cache parsed and analyzed expressions within PlannerContext for a single SQL query. 2) Cache parsed expressions together with input binding analysis using a new class AnalyzeExpr. This speeds up SQL planning, because SQL planning involves parsing analyzing the same expression strings over and over again. * Fixes. * Fix style. * Fix test. * Simplify: get rid of AnalyzedExpr, focus on caching. * Rename parse -> parseExpression.
Main changes:
and analyzedexpressions within PlannerContext for a single SQL query.Cache parsed expressions together with input binding analysis using a new class AnalyzeExpr.Edit: Scope reduced to only do (part of) the first item.
This speeds up SQL planning, because SQL planning involves parsing analyzing the same expression strings over and over again.