Skip to content

Commit 06faef5

Browse files
committed
Introduce grouping in TopN operator
1 parent cff81d9 commit 06faef5

File tree

1 file changed

+6
-0
lines changed
  • x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data

1 file changed

+6
-0
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.io.IOException;
1717
import java.util.Arrays;
1818
import java.util.Objects;
19+
import java.util.stream.IntStream;
1920

2021
/**
2122
* A page is a column-oriented data abstraction that allows data to be passed between operators in
@@ -311,4 +312,9 @@ public Page filter(int... positions) {
311312
}
312313
return new Page(filteredBlocks);
313314
}
315+
316+
public Page subPage(int fromIndex, int toIndex) {
317+
// TODO: optimize!
318+
return filter(IntStream.range(fromIndex, toIndex).toArray());
319+
}
314320
}

0 commit comments

Comments
 (0)