forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Star Tree Meta and Data Writers (opensearch-project#15295)
--------- Signed-off-by: Sarthak Aggarwal <[email protected]>
- Loading branch information
1 parent
2d2c58a
commit ab4fad5
Showing
30 changed files
with
2,418 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
server/src/main/java/org/opensearch/index/compositeindex/CompositeIndexConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
/** | ||
* 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"; | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
server/src/main/java/org/opensearch/index/compositeindex/CompositeIndexMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
server/src/main/java/org/opensearch/index/compositeindex/datacube/ReadDimension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
@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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.