-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
ESQL: Dependency check for binary plans #118326
Conversation
Documentation preview: |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
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.
Unrelated, but the regenerated docs for this were not committed, yet.
var exclude = Expressions.references(agg.ordinalAttributes()); | ||
DEPENDENCY_CHECK.checkPlan(p, exclude, depFailures); |
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.
Simplified by excluding the ordinal attributes already in AggregateExec.references()
, which should be more correct, as these attributes are not required for the AggregateExec
to be executed.
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.
Nice!
return mode.isInputPartial() ? new AttributeSet(intermediateAttributes) : Aggregate.computeReferences(aggregates, groupings); | ||
return mode.isInputPartial() | ||
? new AttributeSet(intermediateAttributes) | ||
: Aggregate.computeReferences(aggregates, groupings).subtract(new AttributeSet(ordinalAttributes())); |
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.
👍
if (p instanceof BinaryPlan binaryPlan) { | ||
checkMissing(p, binaryPlan.leftReferences(), binaryPlan.left().outputSet(), "missing references from left hand side", failures); | ||
checkMissing( | ||
p, | ||
binaryPlan.rightReferences(), | ||
binaryPlan.right().outputSet(), | ||
"missing references from right hand side", | ||
failures | ||
); | ||
} else if (p instanceof BinaryExec binaryExec) { | ||
checkMissing(p, binaryExec.leftReferences(), binaryExec.left().outputSet(), "missing references from left hand side", failures); | ||
checkMissing( | ||
p, | ||
binaryExec.rightReferences(), | ||
binaryExec.right().outputSet(), | ||
"missing references from right hand side", | ||
failures | ||
); | ||
} else { |
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: it'd be nice if we could deduplicate a bit here, maybe with a checkBinary(P, AttributeSet, AttributeSet, String, Failures)
? But can stay as is too.
Make the dependency checker for query plans take into account binary plans and make sure that fields required from the left hand side are actually obtained from there (and analogously for the right).
💚 Backport successful
|
The dependency checker for query plans should take into account binary plans and make sure that fields required from the left hand side are actually obtained from there (and analogously for the right).