Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -585,9 +585,6 @@ tests:
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
method: testManyConcat
issue: https://github.com/elastic/elasticsearch/issues/136728
- class: org.elasticsearch.compute.data.BasicPageTests
method: testEqualityAndHashCode
issue: https://github.com/elastic/elasticsearch/issues/136753

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,31 @@ public void testEqualityAndHashCode() throws IOException {
};

final EqualsHashCodeTestUtils.MutateFunction<Page> mutatePageFunction = page -> {
assert page.getPositionCount() > 0;
Block[] blocks = new Block[page.getBlockCount()];
int positions = randomInt(page.getPositionCount() - 1);
for (int blockIndex = 0; blockIndex < blocks.length; blockIndex++) {
Block block = page.getBlock(blockIndex);
blocks[blockIndex] = block.elementType()
.newBlockBuilder(positions, TestBlockFactory.getNonBreakingInstance())
.copyFrom(block, 0, positions)
.build();
if (page.getPositionCount() > 0) {
Block[] blocks = new Block[page.getBlockCount()];
int positions = randomInt(page.getPositionCount() - 1);
for (int blockIndex = 0; blockIndex < blocks.length; blockIndex++) {
Block block = page.getBlock(blockIndex);
blocks[blockIndex] = block.elementType()
.newBlockBuilder(positions, TestBlockFactory.getNonBreakingInstance())
.copyFrom(block, 0, positions)
.build();
}
return new Page(positions, blocks);
} else {
Block[] blocks = new Block[page.getBlockCount() + 1];
for (int blockIndex = 0; blockIndex < page.getBlockCount(); blockIndex++) {
blocks[blockIndex] = page.getBlock(blockIndex);
}

ElementType newBlockType = randomValueOtherThanMany(
x -> x == ElementType.DOC || x == ElementType.COMPOSITE || x == ElementType.UNKNOWN,
() -> randomFrom(ElementType.values())
);

blocks[blocks.length - 1] = newBlockType.newBlockBuilder(0, TestBlockFactory.getNonBreakingInstance()).build();
return new Page(0, blocks);
}
return new Page(positions, blocks);
};

int positions = randomIntBetween(0, 512);
Expand Down