-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
--------- Signed-off-by: Sarthak Aggarwal <[email protected]> (cherry picked from commit 8629279) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.compositeindex; | ||
|
||
/** | ||
* This class contains constants used in the Composite Index implementation. | ||
*/ | ||
public class CompositeIndexConstants { | ||
Check warning on line 14 in server/src/main/java/org/opensearch/index/compositeindex/CompositeIndexConstants.java Codecov / codecov/patchserver/src/main/java/org/opensearch/index/compositeindex/CompositeIndexConstants.java#L14
|
||
|
||
/** | ||
* The magic marker value used for sanity checks in the Composite Index implementation. | ||
*/ | ||
public static final long COMPOSITE_FIELD_MARKER = 0xC0950513F1E1DL; // Composite Field | ||
|
||
/** | ||
* Represents the key to fetch number of non-star aggregated segment documents. | ||
*/ | ||
public static final String SEGMENT_DOCS_COUNT = "segmentDocsCount"; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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.compositeindex; | ||
|
||
import org.opensearch.index.mapper.CompositeMappedFieldType; | ||
|
||
/** | ||
* This class represents the metadata of a Composite Index, which includes information about | ||
* the composite field name, type, and the specific metadata for the type of composite field | ||
* (e.g., Star Tree metadata). | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class CompositeIndexMetadata { | ||
|
||
private final String compositeFieldName; | ||
private final CompositeMappedFieldType.CompositeFieldType compositeFieldType; | ||
|
||
/** | ||
* Constructs a CompositeIndexMetadata object with the provided composite field name and type. | ||
* | ||
* @param compositeFieldName the name of the composite field | ||
* @param compositeFieldType the type of the composite field | ||
*/ | ||
public CompositeIndexMetadata(String compositeFieldName, CompositeMappedFieldType.CompositeFieldType compositeFieldType) { | ||
this.compositeFieldName = compositeFieldName; | ||
this.compositeFieldType = compositeFieldType; | ||
} | ||
|
||
/** | ||
* Returns the name of the composite field. | ||
* | ||
* @return the composite field name | ||
*/ | ||
public String getCompositeFieldName() { | ||
return compositeFieldName; | ||
} | ||
|
||
/** | ||
* Returns the type of the composite field. | ||
* | ||
* @return the composite field type | ||
*/ | ||
public CompositeMappedFieldType.CompositeFieldType getCompositeFieldType() { | ||
return compositeFieldType; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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.compositeindex.datacube; | ||
|
||
import org.opensearch.core.xcontent.XContentBuilder; | ||
import org.opensearch.index.mapper.CompositeDataCubeFieldType; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Represents a dimension for reconstructing StarTreeField from file formats during searches and merges. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class ReadDimension implements Dimension { | ||
public static final String READ = "read"; | ||
private final String field; | ||
|
||
public ReadDimension(String field) { | ||
this.field = field; | ||
} | ||
|
||
public String getField() { | ||
return field; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject(); | ||
builder.field(CompositeDataCubeFieldType.NAME, field); | ||
builder.field(CompositeDataCubeFieldType.TYPE, READ); | ||
builder.endObject(); | ||
return builder; | ||
Check warning on line 40 in server/src/main/java/org/opensearch/index/compositeindex/datacube/ReadDimension.java Codecov / codecov/patchserver/src/main/java/org/opensearch/index/compositeindex/datacube/ReadDimension.java#L36-L40
|
||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ReadDimension dimension = (ReadDimension) o; | ||
return Objects.equals(field, dimension.getField()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(field); | ||
Check warning on line 53 in server/src/main/java/org/opensearch/index/compositeindex/datacube/ReadDimension.java Codecov / codecov/patchserver/src/main/java/org/opensearch/index/compositeindex/datacube/ReadDimension.java#L53
|
||
} | ||
} |