diff --git a/server/src/main/java/org/opensearch/index/codec/composite/DocValuesProvider.java b/server/src/main/java/org/opensearch/index/codec/composite/DocValuesProvider.java deleted file mode 100644 index b92bce21b9f8e..0000000000000 --- a/server/src/main/java/org/opensearch/index/codec/composite/DocValuesProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.index.codec.composite; - -import org.apache.lucene.codecs.DocValuesProducer; - -/** - * An interface that provides access to document values for a specific field. - * - * @opensearch.experimental - */ -public interface DocValuesProvider { - - // /** - // * Returns the sorted numeric document values for the specified field. - // * - // * @param fieldName The name of the field for which to retrieve the sorted numeric document values. - // * @return The sorted numeric document values for the specified field. - // * @throws IOException If an error occurs while retrieving the sorted numeric document values. - // */ - // SortedNumericDocValues getSortedNumeric(String fieldName) throws IOException; - - /** - * Returns the DocValuesProducer instance. - * - * @return The DocValuesProducer instance. - */ - DocValuesProducer getDocValuesProducer(); -} diff --git a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/aggregators/SumValueAggregator.java b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/aggregators/SumValueAggregator.java index cba002bcdb4c7..30309d629a765 100644 --- a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/aggregators/SumValueAggregator.java +++ b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/aggregators/SumValueAggregator.java @@ -16,9 +16,8 @@ *

This implementation follows the Kahan summation algorithm to improve the accuracy * of the sum by tracking and compensating for the accumulated error in each iteration. * - * @see Kahan Summation Algorithm - * * @opensearch.experimental + * @see Kahan Summation Algorithm */ class SumValueAggregator implements ValueAggregator { @@ -67,11 +66,7 @@ public Double mergeAggregatedValues(Double value, Double aggregatedValue) { assert aggregatedValue == null || kahanSummation.value() == aggregatedValue; // add takes care of the sum and compensation internally if (value != null) { - if (value != null) { - kahanSummation.add(value); - } else { - kahanSummation.add(getIdentityMetricValue()); - } + kahanSummation.add(value); } else { kahanSummation.add(getIdentityMetricValue()); } diff --git a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java index 1d41ceb189ed2..dcecab15ef945 100644 --- a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java +++ b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java @@ -279,10 +279,11 @@ void appendDocumentsToStarTree(Iterator starTreeDocumentIterat private void serializeStarTree(int numSegmentStarTreeDocument, int numStarTreeDocs) throws IOException { // serialize the star tree data long dataFilePointer = dataOut.getFilePointer(); - long totalStarTreeDataLength = StarTreeWriter.writeStarTree(dataOut, rootNode, numStarTreeNodes, starTreeField.getName()); + StarTreeWriter starTreeWriter = new StarTreeWriter(); + long totalStarTreeDataLength = starTreeWriter.writeStarTree(dataOut, rootNode, numStarTreeNodes, starTreeField.getName()); // serialize the star tree meta - StarTreeWriter.writeStarTreeMetadata( + starTreeWriter.writeStarTreeMetadata( metaOut, starTreeField, metricAggregatorInfos, diff --git a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/OnHeapStarTreeBuilder.java b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/OnHeapStarTreeBuilder.java index c18c55e0bb1a5..5200ebdfb1cbe 100644 --- a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/OnHeapStarTreeBuilder.java +++ b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/OnHeapStarTreeBuilder.java @@ -125,7 +125,7 @@ Iterator mergeStarTrees(List starTreeValuesSub * Returns an array of all the starTreeDocuments from all the segments * We only take the non-star documents from all the segments. * - * @param starTreeValuesSubs StarTreeValues from multiple segmentsx + * @param starTreeValuesSubs StarTreeValues from multiple segments * @return array of star tree documents */ StarTreeDocument[] getSegmentsStarTreeDocuments(List starTreeValuesSubs) throws IOException { diff --git a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/fileformats/StarTreeWriter.java b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/fileformats/StarTreeWriter.java index 779977d9878c5..b244820219fe7 100644 --- a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/fileformats/StarTreeWriter.java +++ b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/fileformats/StarTreeWriter.java @@ -42,7 +42,7 @@ public StarTreeWriter() {} * @return total size of the three * @throws IOException when star-tree data serialization fails */ - public static long writeStarTree(IndexOutput dataOut, InMemoryTreeNode rootNode, int numNodes, String name) throws IOException { + public long writeStarTree(IndexOutput dataOut, InMemoryTreeNode rootNode, int numNodes, String name) throws IOException { return StarTreeDataWriter.writeStarTree(dataOut, rootNode, numNodes, name); } @@ -58,7 +58,7 @@ public static long writeStarTree(IndexOutput dataOut, InMemoryTreeNode rootNode, * @param dataFileLength data file length * @throws IOException when star-tree data serialization fails */ - public static void writeStarTreeMetadata( + public void writeStarTreeMetadata( IndexOutput metaOut, StarTreeField starTreeField, List metricAggregatorInfos,