Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,6 @@ tests:
- class: org.elasticsearch.xpack.esql.action.CrossClusterQueryWithPartialResultsIT
method: testOneRemoteClusterPartial
issue: https://github.com/elastic/elasticsearch/issues/124055
- class: org.elasticsearch.compute.aggregation.SampleDoubleAggregatorFunctionTests
method: testSimpleWithCranky
issue: https://github.com/elastic/elasticsearch/issues/128024
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
method: test {lookup-join.MvJoinKeyOnTheLookupIndex ASYNC}
issue: https://github.com/elastic/elasticsearch/issues/128030
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ class Sample$Type$Aggregator {
return block;
}
BytesRefBlock bytesRefBlock = (BytesRefBlock) block;
try ($Type$Block.Builder $type$Block = driverContext.blockFactory().new$Type$BlockBuilder(bytesRefBlock.getPositionCount())) {
try (
block;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: What about moving the cast inside the try? So we avoid this extra block;. Not much of an improvement, but I think it makes the intent a bit clearer ("Now we'll consume this block, which is a BytesRefBlock"), and we use both variables from here on

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Maybe it's slightly obscure that handles closing the original block.

Anyway, it also conveniently solves my spotless/autogen issue (see the autocommit). Depending the the strlen of the type (Int or BytesRef), this block should go on 1 or 2 lines right now.

$Type$Block.Builder $type$Block = driverContext.blockFactory().new$Type$BlockBuilder(bytesRefBlock.getPositionCount())
) {
BytesRef scratch = new BytesRef();
for (int position = 0; position < block.getPositionCount(); position++) {
if (bytesRefBlock.isNull(position)) {
Expand All @@ -119,7 +122,6 @@ class Sample$Type$Aggregator {
}
}
}
block.close();
return $type$Block.build();
}
}
Expand Down