-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Star Tree unsigned-long indexing changes (#17156)
Signed-off-by: Shailesh Singh <shaileshkumarsingh260@gmail.com>
- Loading branch information
1 parent
5e12737
commit 8ec93ae
Showing
30 changed files
with
1,226 additions
and
251 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
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
52 changes: 52 additions & 0 deletions
52
server/src/main/java/org/opensearch/index/compositeindex/datacube/DimensionDataType.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,52 @@ | ||
/* | ||
* 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.common.annotation.ExperimentalApi; | ||
|
||
/** | ||
* Represents the data type of the dimension value. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
@ExperimentalApi | ||
public enum DimensionDataType { | ||
LONG { | ||
@Override | ||
int compare(Long a, Long b) { | ||
if (a == null && b == null) { | ||
return 0; | ||
} | ||
if (b == null) { | ||
return -1; | ||
} | ||
if (a == null) { | ||
return 1; | ||
} | ||
return Long.compare(a, b); | ||
} | ||
}, | ||
UNSIGNED_LONG { | ||
@Override | ||
int compare(Long a, Long b) { | ||
if (a == null && b == null) { | ||
return 0; | ||
} | ||
if (b == null) { | ||
return -1; | ||
} | ||
if (a == null) { | ||
return 1; | ||
} | ||
return Long.compareUnsigned(a, b); | ||
} | ||
}; | ||
|
||
abstract int compare(Long a, Long b); | ||
} |
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
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
43 changes: 43 additions & 0 deletions
43
server/src/main/java/org/opensearch/index/compositeindex/datacube/UnsignedLongDimension.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,43 @@ | ||
/* | ||
* 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; | ||
|
||
/** | ||
* Unsigned Long dimension class | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class UnsignedLongDimension extends NumericDimension { | ||
|
||
public static final String UNSIGNED_LONG = "unsigned_long"; | ||
|
||
public UnsignedLongDimension(String field) { | ||
super(field); | ||
} | ||
|
||
@Override | ||
public DimensionDataType getDimensionDataType() { | ||
return DimensionDataType.UNSIGNED_LONG; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject(); | ||
builder.field(CompositeDataCubeFieldType.NAME, getField()); | ||
builder.field(CompositeDataCubeFieldType.TYPE, UNSIGNED_LONG); | ||
builder.endObject(); | ||
return builder; | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.