diff --git a/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/BaseSingleTreeBuilder.java b/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/BaseSingleTreeBuilder.java index e77b30336104c..4faa60d4d7929 100644 --- a/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/BaseSingleTreeBuilder.java +++ b/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/BaseSingleTreeBuilder.java @@ -147,7 +147,7 @@ public abstract class BaseSingleTreeBuilder { } // TODO : Removing hardcoding - _maxLeafRecords = 100; // builderConfig.getMaxLeafRecords(); + _maxLeafRecords = 1; // builderConfig.getMaxLeafRecords(); } private void constructStarTree(StarTreeBuilderUtils.TreeNode node, int startDocId, int endDocId) throws IOException { @@ -317,6 +317,7 @@ private void createDocValuesIndices(DocValuesConsumer docValuesConsumer) throws for (int docId = 0; docId < _numDocs; docId++) { Record record = getStarTreeRecord(docId); + //logger.info("Record during doc values indices : {} ", record.toString()); for (int i = 0; i < record._dimensions.length; i++) { long val = record._dimensions[i]; pendingDimArr[i].add(val); @@ -381,6 +382,7 @@ private void appendToStarTree(Record record) throws IOException { // if(star) { // System.out.println("======Overall sum =====" + (long) record._metrics[0]); // } + //logger.info("Record : {}", record.toString()); appendRecord(record); _numDocs++; } diff --git a/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/StarTreeBuilderUtils.java b/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/StarTreeBuilderUtils.java index f86468299d02f..ecb907db2d0cf 100644 --- a/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/StarTreeBuilderUtils.java +++ b/server/src/main/java/org/opensearch/index/codec/freshstartree/builder/StarTreeBuilderUtils.java @@ -116,6 +116,7 @@ private static void writeNodes(IndexOutput output, TreeNode rootNode) throws IOE } private static void writeNode(IndexOutput output, TreeNode node, int firstChildId, int lastChildId) throws IOException { + //logger.info("Builder util : dim id : {} , dim value : {}", node._dimensionId, node._dimensionValue); output.writeInt(node._dimensionId); output.writeLong(node._dimensionValue); output.writeInt(node._startDocId); diff --git a/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/Lucene90DocValuesProducerCopy.java b/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/Lucene90DocValuesProducerCopy.java index 11b43c9c06916..56ef82f0cb78f 100644 --- a/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/Lucene90DocValuesProducerCopy.java +++ b/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/Lucene90DocValuesProducerCopy.java @@ -16,6 +16,8 @@ */ package org.opensearch.index.codec.freshstartree.codec; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.codecs.DocValuesProducer; import org.apache.lucene.codecs.lucene90.IndexedDISI; @@ -47,6 +49,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.opensearch.index.codec.freshstartree.query.StarTreeFilter; + /** * Created a copy to initialize producer without field info stored in state which is the case for @@ -55,6 +59,9 @@ * We don't create aggregated doc value fields in traditional add/update doc workflow where fieldInfo gets populated */ public class Lucene90DocValuesProducerCopy extends DocValuesProducer { + + private static final Logger logger = LogManager.getLogger(Lucene90DocValuesProducerCopy.class); + private final Map numerics; private final Map sortedNumerics; private final IndexInput data; @@ -211,6 +218,7 @@ public FieldInfo[] getFieldInfoArr() { private void readFields(IndexInput meta, FieldInfo[] infos) throws IOException { for (int fieldNumber = meta.readInt(); fieldNumber != -1; fieldNumber = meta.readInt()) { + logger.info("fieldNumber : {}" ,fieldNumber); FieldInfo info = infos[fieldNumber]; if (info == null) { throw new CorruptIndexException("Invalid field number: " + fieldNumber, meta); diff --git a/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/StarTreeDocValuesReader.java b/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/StarTreeDocValuesReader.java index adc43aef29335..9ae082b03e05b 100644 --- a/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/StarTreeDocValuesReader.java +++ b/server/src/main/java/org/opensearch/index/codec/freshstartree/codec/StarTreeDocValuesReader.java @@ -16,6 +16,8 @@ */ package org.opensearch.index.codec.freshstartree.codec; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.codecs.DocValuesProducer; import org.apache.lucene.index.BinaryDocValues; @@ -34,9 +36,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.opensearch.index.codec.freshstartree.query.StarTreeFilter; + /** Custom star tree doc values reader */ public class StarTreeDocValuesReader extends DocValuesProducer { + private static final Logger logger = LogManager.getLogger(StarTreeDocValuesReader.class); + private DocValuesProducer delegate; private IndexInput data; @@ -71,6 +77,7 @@ public NumericDocValues getNumeric(FieldInfo field) throws IOException { public StarTreeAggregatedValues getAggregatedDocValues() throws IOException { // starTree.printTree(new HashMap<>()); List dimensionsSplitOrder = starTree.getDimensionNames(); + //logger.info("Dimension order {}", dimensionsSplitOrder); for (int i = 0; i < dimensionsSplitOrder.size(); i++) { dimensionValues.put(dimensionsSplitOrder.get(i), valuesProducer.getNumeric(dimensionsSplitOrder.get(i) + "_dim")); } diff --git a/server/src/main/java/org/opensearch/index/codec/freshstartree/node/OffHeapStarTree.java b/server/src/main/java/org/opensearch/index/codec/freshstartree/node/OffHeapStarTree.java index 62d3c9c0342b5..a82e536d2f4c9 100644 --- a/server/src/main/java/org/opensearch/index/codec/freshstartree/node/OffHeapStarTree.java +++ b/server/src/main/java/org/opensearch/index/codec/freshstartree/node/OffHeapStarTree.java @@ -16,6 +16,8 @@ */ package org.opensearch.index.codec.freshstartree.node; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.RandomAccessInput; @@ -26,9 +28,12 @@ import java.util.List; import java.util.Map; import java.util.StringJoiner; +import org.opensearch.index.codec.freshstartree.builder.OffHeapBufferedSingleTreeBuilder; + /** Off heap implementation of star tree. */ public class OffHeapStarTree implements StarTree { + private static final Logger logger = LogManager.getLogger(OffHeapStarTree.class); public static final long MAGIC_MARKER = 0xBADDA55B00DAD00DL; public static final int VERSION = 1; private final OffHeapStarTreeNode _root; @@ -108,6 +113,7 @@ private void printTreeHelper(Map> dictionaryMap, Off .toString(); stringBuilder.append(formattedOutput); + logger.info(stringBuilder.toString()); if (!node.isLeaf()) { Iterator childrenIterator = node.getChildrenIterator(); diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/startree/StarTreeAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/startree/StarTreeAggregator.java index 015ab02495bf0..941c75580dd42 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/startree/StarTreeAggregator.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/startree/StarTreeAggregator.java @@ -178,7 +178,6 @@ public void collect(int doc, long bucket) throws IOException { for (String field : fieldCols) { fieldColToDocValuesMap.put(field, aggrVals.dimensionValues.get(field)); } - NumericDocValues dv = aggrVals.metricValues.get("status_sum"); if (dv.advanceExact(doc)) {