-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Ensure partial aggregation outputs match layout #135813
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,7 @@ | |
| import org.elasticsearch.compute.operator.topn.TopNEncoder; | ||
| import org.elasticsearch.compute.operator.topn.TopNOperator; | ||
| import org.elasticsearch.compute.operator.topn.TopNOperator.TopNOperatorFactory; | ||
| import org.elasticsearch.core.Assertions; | ||
| import org.elasticsearch.core.Releasables; | ||
| import org.elasticsearch.core.TimeValue; | ||
| import org.elasticsearch.index.IndexMode; | ||
|
|
@@ -443,6 +444,13 @@ private PhysicalOperation planExchangeSink(ExchangeSinkExec exchangeSink, LocalE | |
| Objects.requireNonNull(exchangeSinkSupplier, "ExchangeSinkHandler wasn't provided"); | ||
| var child = exchangeSink.child(); | ||
| PhysicalOperation source = plan(child, context); | ||
| if (Assertions.ENABLED) { | ||
| List<Attribute> inputAttributes = exchangeSink.child().output(); | ||
| for (Attribute attr : inputAttributes) { | ||
| assert source.layout.get(attr.id()) != null | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe throw ISE instead, so that messing up an agg will not kill the node during a full run of the test suite. That makes for easier-to-triage CI issues opened by the CI bot. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be an assertion to verify the invariant. I opened #135862 to handle the spec tests when the test cluster is broken. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The added check is very reasonable. Maybe it makes sense to add it to the general plan method, as it's an invariant that's not only required for planning exchanges, but for every plan node? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ++ I tried to add this, but this invariant doesn't hold for ExchangeSinkExec and ExchangeSourceExec. I will address this in a follow-up. |
||
| : "input attribute [" + attr + "] does not exist in the source layout [" + source.layout + "]"; | ||
| } | ||
| } | ||
| return source.withSink(new ExchangeSinkOperatorFactory(exchangeSinkSupplier), source.layout); | ||
| } | ||
|
|
||
|
|
||
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.
Hm, AggregateExec#output has its own
isOutputPartialcheck. I think it is probably correct to remove this if-else and always calllayout.append(aggregateExec.output()); the only thingAggregateExec#outputdoes differently in the non-partial case is de-duplicating based on name, but we shouldn't have duplicates to begin with. And if we have, we shouldn't be adding them to the output layout if they're not in the agg's output to begin with.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.
Yes, we can use
aggregateExec.output()- I pushed c5ab8d8