Skip to content

Commit fed49c9

Browse files
fixes
Signed-off-by: Bharathwaj G <[email protected]>
1 parent 0b214f7 commit fed49c9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/OffHeapStarTreeBuilder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class OffHeapStarTreeBuilder extends BaseStarTreeBuilder {
7373
private static final String SEGMENT_DOC_FILE_NAME = "segment.documents";
7474
private static final String STAR_TREE_DOC_FILE_NAME = "star-tree.documents";
7575
// TODO : Should this be via settings ?
76-
private static final int FILE_COUNT_THRESHOLD = 10;
76+
private static final int FILE_COUNT_THRESHOLD = 5;
7777
private final List<Integer> starTreeDocumentOffsets;
7878
private int numReadableStarTreeDocuments;
7979
final IndexOutput segmentDocsFileOutput;
@@ -319,7 +319,7 @@ public StarTreeDocument getSegmentStarTreeDocument(int docID, long documentBytes
319319

320320
@Override
321321
public StarTreeDocument getStarTreeDocument(int docId) throws IOException {
322-
ensureBufferReadable(docId);
322+
ensureDocReadable(docId);
323323
return readStarTreeDocument(starTreeDocsFileRandomInput, starTreeDocumentOffsets.get(docId));
324324
}
325325

@@ -336,7 +336,7 @@ public List<StarTreeDocument> getStarTreeDocuments() throws IOException {
336336
// TODO: should this be just long?
337337
@Override
338338
public Long getDimensionValue(int docId, int dimensionId) throws IOException {
339-
ensureBufferReadable(docId);
339+
ensureDocReadable(docId);
340340
return starTreeDocsFileRandomInput.readLong((starTreeDocumentOffsets.get(docId) + ((long) dimensionId * Long.BYTES)));
341341
}
342342

@@ -387,7 +387,7 @@ public Iterator<StarTreeDocument> generateStarTreeDocumentsForStarNode(int start
387387
throws IOException {
388388
// End doc id is not inclusive but start doc is inclusive
389389
// Hence we need to check if buffer is readable till endDocId - 1
390-
ensureBufferReadable(endDocId - 1);
390+
ensureDocReadable(endDocId - 1);
391391

392392
// Sort all documents using an int array
393393
int numDocs = endDocId - startDocId;
@@ -650,11 +650,11 @@ private StarTreeDocument readStarTreeDocument(RandomAccessInput input, long offs
650650
return new StarTreeDocument(dimensions, metrics);
651651
}
652652

653-
private void ensureBufferReadable(int docId) throws IOException {
654-
ensureBufferReadable(docId, true);
653+
private void ensureDocReadable(int docId) throws IOException {
654+
ensureDocReadable(docId, true);
655655
}
656656

657-
private void ensureBufferReadable(int docId, boolean shouldCreateFileOutput) throws IOException {
657+
private void ensureDocReadable(int docId, boolean shouldCreateFileOutput) throws IOException {
658658
if (docId >= prevStartDocId && docId < numReadableStarTreeDocuments) {
659659
return;
660660
}

server/src/test/java/org/opensearch/index/codec/composite/datacube/startree/StarTreeDocValuesFormatTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected Codec getCodec() {
6868
final Logger testLogger = LogManager.getLogger(StarTreeDocValuesFormatTests.class);
6969

7070
try {
71-
createMapperService(getExpandedMapping("status", "size"));
71+
createMapperService(getExpandedMapping());
7272
} catch (IOException e) {
7373
throw new RuntimeException(e);
7474
}
@@ -106,7 +106,7 @@ public void testStarTreeDocValues() throws IOException {
106106
directory.close();
107107
}
108108

109-
private XContentBuilder getExpandedMapping(String dim, String metric) throws IOException {
109+
private XContentBuilder getExpandedMapping() throws IOException {
110110
return topMapping(b -> {
111111
b.startObject("composite");
112112
b.startObject("startree");

0 commit comments

Comments
 (0)