Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <[email protected]>
  • Loading branch information
sarthakaggarwal97 committed Aug 26, 2024
1 parent ffda55b commit 37f7804
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 47 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
* <p>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 <a href="http://en.wikipedia.org/wiki/Kahan_summation_algorithm">Kahan Summation Algorithm</a>
*
* @opensearch.experimental
* @see <a href="http://en.wikipedia.org/wiki/Kahan_summation_algorithm">Kahan Summation Algorithm</a>
*/
class SumValueAggregator implements ValueAggregator<Double> {

Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,11 @@ void appendDocumentsToStarTree(Iterator<StarTreeDocument> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Iterator<StarTreeDocument> mergeStarTrees(List<StarTreeValues> 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<StarTreeValues> starTreeValuesSubs) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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<MetricAggregatorInfo> metricAggregatorInfos,
Expand Down

0 comments on commit 37f7804

Please sign in to comment.