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 30, 2024
1 parent ab9ae10 commit 7a67510
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void build(
String dimension = dimensionsSplitOrder.get(i).getField();
FieldInfo dimensionFieldInfo = writeState.fieldInfos.fieldInfo(dimension);
if (dimensionFieldInfo == null) {
dimensionFieldInfo = getFieldInfo(dimension, 0);
dimensionFieldInfo = getFieldInfo(dimension, DocValuesType.SORTED_NUMERIC, 0);
}
dimensionReaders[i] = new SequentialDocValuesIterator(
fieldProducerMap.get(dimensionFieldInfo.name).getSortedNumeric(dimensionFieldInfo)
Expand Down Expand Up @@ -320,6 +320,7 @@ private void createSortedDocValuesIndices(DocValuesConsumer docValuesConsumer, A
starTreeField.getName(),
starTreeField.getDimensionsOrder().get(i).getField()
),
DocValuesType.SORTED_NUMERIC,
fieldNumberAcrossStarTrees.getAndIncrement()
);
dimensionFieldInfoList[i] = fi;
Expand All @@ -333,6 +334,7 @@ private void createSortedDocValuesIndices(DocValuesConsumer docValuesConsumer, A
metricAggregatorInfos.get(i).getField(),
metricAggregatorInfos.get(i).getMetricStat().getTypeName()
),
DocValuesType.SORTED_NUMERIC,
fieldNumberAcrossStarTrees.getAndIncrement()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.opensearch.index.compositeindex.datacube.startree.StarTreeField;
import org.opensearch.index.compositeindex.datacube.startree.aggregators.MetricAggregatorInfo;
import org.opensearch.index.compositeindex.datacube.startree.fileformats.data.StarTreeDataWriter;
import org.opensearch.index.compositeindex.datacube.startree.fileformats.meta.StarTreeMetaWriter;
import org.opensearch.index.compositeindex.datacube.startree.fileformats.meta.StarTreeMetadataWriter;
import org.opensearch.index.compositeindex.datacube.startree.node.InMemoryTreeNode;

import java.io.IOException;
Expand Down Expand Up @@ -69,7 +69,7 @@ public void writeStarTreeMetadata(
long dataFilePointer,
long dataFileLength
) throws IOException {
StarTreeMetaWriter.writeStarTreeMetadata(
StarTreeMetadataWriter.writeStarTreeMetadata(
metaOut,
starTreeField,
metricAggregatorInfos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
*
* @opensearch.experimental
*/
public class StarTreeMetaWriter {
public class StarTreeMetadataWriter {

private static final Logger logger = LogManager.getLogger(StarTreeMetaWriter.class);
private static final Logger logger = LogManager.getLogger(StarTreeMetadataWriter.class);

/**
* Writes the star-tree metadata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.opensearch.index.compositeindex.datacube.startree.utils;

import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.opensearch.common.annotation.ExperimentalApi;
Expand Down Expand Up @@ -48,32 +47,6 @@ public SequentialDocValuesIterator(DocIdSetIterator docIdSetIterator) {
this.docIdSetIterator = docIdSetIterator;
}

/**
* Constructs a new SequentialDocValuesIterator instance with an empty sorted numeric.
*
*/
public SequentialDocValuesIterator() {
this.docIdSetIterator = DocValues.emptySortedNumeric();
}

/**
* Returns the value associated with the latest document.
*
* @return the value associated with the latest document
*/
public Long getDocValue() {
return docValue;
}

/**
* Sets the value associated with the latest document.
*
* @param docValue the value to be associated with the latest document
*/
public void setDocValue(Long docValue) {
this.docValue = docValue;
}

/**
* Returns the id of the latest document.
*
Expand All @@ -88,7 +61,7 @@ public int getDocId() {
*
* @param docId the ID of the latest document
*/
public void setDocId(int docId) {
private void setDocId(int docId) {
this.docId = docId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,12 @@ public static FieldInfo[] getFieldInfoList(List<String> fields) {
int fieldNumber = 0;

for (String fieldName : fields) {
fieldInfoList[fieldNumber] = getFieldInfo(fieldName, fieldNumber);
fieldInfoList[fieldNumber] = getFieldInfo(fieldName, DocValuesType.SORTED_NUMERIC, fieldNumber);
fieldNumber++;
}
return fieldInfoList;
}

/**
* Get new field info instance for a given field name and field number
* @param fieldName name of the field
* @param fieldNumber number of the field
* @return new field info instance
*/
public static FieldInfo getFieldInfo(String fieldName, int fieldNumber) {
return getFieldInfo(fieldName, DocValuesType.SORTED_NUMERIC, fieldNumber);
}

/**
* Get new field info instance for a given field name and field number
* @param fieldName name of the field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public class SegmentsStats implements Writeable, ToXContentFragment {
Map.entry("tvd", "Term Vector Documents"),
Map.entry("tvf", "Term Vector Fields"),
Map.entry("liv", "Live Documents"),
Map.entry(Composite99DocValuesFormat.DATA_EXTENSION, "Term Vector Index"),
Map.entry(Composite99DocValuesFormat.META_EXTENSION, "Term Vector Documents"),
Map.entry(Composite99DocValuesFormat.DATA_DOC_VALUES_EXTENSION, "Term Vector Fields"),
Map.entry(Composite99DocValuesFormat.META_DOC_VALUES_EXTENSION, "Live Documents"),
Map.entry(Composite99DocValuesFormat.DATA_EXTENSION, "Composite Index"),
Map.entry(Composite99DocValuesFormat.META_EXTENSION, "Composite Index"),
Map.entry(Composite99DocValuesFormat.DATA_DOC_VALUES_EXTENSION, "Composite Index DocValues"),
Map.entry(Composite99DocValuesFormat.META_DOC_VALUES_EXTENSION, "Composite Index DocValues"),
Map.entry(FuzzyFilterPostingsFormat.FUZZY_FILTER_FILE_EXTENSION, "Fuzzy Filter")
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testGetFieldInfoList() {
public void testGetFieldInfo() {
String fieldName = UUID.randomUUID().toString();
int fieldNumber = randomInt();
assertFieldInfos(StarTreeUtils.getFieldInfo(fieldName, fieldNumber), fieldName, fieldNumber);
assertFieldInfos(StarTreeUtils.getFieldInfo(fieldName, DocValuesType.SORTED_NUMERIC, fieldNumber), fieldName, fieldNumber);

}

Expand Down

0 comments on commit 7a67510

Please sign in to comment.