From a1c8f14e818f88f60edf9737db966124cc372036 Mon Sep 17 00:00:00 2001 From: Sarthak Aggarwal Date: Fri, 5 Jul 2024 10:32:35 +0530 Subject: [PATCH] nits Signed-off-by: Sarthak Aggarwal --- .../java/org/apache/lucene/index/BaseStarTreeBuilder.java | 8 ++++---- .../datacube/startree/builder/OnHeapStarTreeBuilder.java | 3 +-- .../startree/builder/BaseStarTreeBuilderTests.java | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/server/src/main/java/org/apache/lucene/index/BaseStarTreeBuilder.java b/server/src/main/java/org/apache/lucene/index/BaseStarTreeBuilder.java index 95fbd40066a7d..f2248ee52b299 100644 --- a/server/src/main/java/org/apache/lucene/index/BaseStarTreeBuilder.java +++ b/server/src/main/java/org/apache/lucene/index/BaseStarTreeBuilder.java @@ -199,7 +199,7 @@ public List generateMetricAggregatorInfos(MapperService ma * @param dimensionId dimension id * @return dimension value */ - public abstract long getDimensionValue(int docId, int dimensionId) throws IOException; + public abstract Long getDimensionValue(int docId, int dimensionId) throws IOException; /** * Sorts and aggregates the star-tree document in the segment, and returns a star-tree document iterator for all the @@ -522,10 +522,10 @@ private Map constructNonStarNodes(int start throws IOException { Map nodes = new HashMap<>(); int nodeStartDocId = startDocId; - long nodeDimensionValue = getDimensionValue(startDocId, dimensionId); + Long nodeDimensionValue = getDimensionValue(startDocId, dimensionId); for (int i = startDocId + 1; i < endDocId; i++) { - long dimensionValue = getDimensionValue(i, dimensionId); - if (dimensionValue != nodeDimensionValue) { + Long dimensionValue = getDimensionValue(i, dimensionId); + if (!dimensionValue.equals(nodeDimensionValue)) { StarTreeBuilderUtils.TreeNode child = getNewNode(); child.dimensionId = dimensionId; child.dimensionValue = nodeDimensionValue; 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 8eda381d03082..40242171b7f84 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 @@ -64,9 +64,8 @@ public List getStarTreeDocuments() { return starTreeDocuments; } - // TODO: should this be just long? @Override - public long getDimensionValue(int docId, int dimensionId) throws IOException { + public Long getDimensionValue(int docId, int dimensionId) throws IOException { return starTreeDocuments.get(docId).dimensions[dimensionId]; } diff --git a/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilderTests.java b/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilderTests.java index 10f4f41b27f6f..a042cefea879f 100644 --- a/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilderTests.java @@ -171,8 +171,8 @@ public List getStarTreeDocuments() { } @Override - public long getDimensionValue(int docId, int dimensionId) throws IOException { - return 0; + public Long getDimensionValue(int docId, int dimensionId) throws IOException { + return 0L; } @Override