-
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.
Extend MultiValueMode with dedicated support of unsigned_long doc values
Signed-off-by: Andriy Redko <[email protected]>
- Loading branch information
Showing
8 changed files
with
741 additions
and
678 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
78 changes: 78 additions & 0 deletions
78
...rc/main/java/org/opensearch/index/fielddata/SingletonSortedNumericUnsignedLongValues.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,78 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.index.fielddata; | ||
|
||
import org.apache.lucene.index.SortedNumericDocValues; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Clone of {@link SortedNumericDocValues} for double values. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public final class SingletonSortedNumericUnsignedLongValues extends SortedNumericUnsignedLongValues { | ||
private final SortedNumericDocValues values; | ||
|
||
public SingletonSortedNumericUnsignedLongValues(SortedNumericDocValues values) { | ||
this.values = values; | ||
} | ||
|
||
@Override | ||
public boolean advanceExact(int target) throws IOException { | ||
return values.advanceExact(target); | ||
} | ||
|
||
@Override | ||
public long nextValue() throws IOException { | ||
return values.nextValue(); | ||
} | ||
|
||
@Override | ||
public int docValueCount() { | ||
return values.docValueCount(); | ||
} | ||
|
||
public int advance(int target) throws IOException { | ||
return values.advance(target); | ||
} | ||
|
||
public int docID() { | ||
return values.docID(); | ||
} | ||
|
||
/** Return the wrapped values. */ | ||
public SortedNumericDocValues getNumericUnsignedLongValues() { | ||
return values; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
server/src/main/java/org/opensearch/index/fielddata/SortedNumericUnsignedLongValues.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,86 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.index.fielddata; | ||
|
||
import org.apache.lucene.index.SortedNumericDocValues; | ||
import org.opensearch.common.annotation.PublicApi; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Clone of {@link SortedNumericDocValues} for unsigned long values. | ||
* | ||
* @opensearch.api | ||
*/ | ||
@PublicApi(since = "1.0.0") | ||
public abstract class SortedNumericUnsignedLongValues { | ||
|
||
/** Sole constructor. (For invocation by subclass | ||
* constructors, typically implicit.) */ | ||
protected SortedNumericUnsignedLongValues() {} | ||
|
||
/** Advance the iterator to exactly {@code target} and return whether | ||
* {@code target} has a value. | ||
* {@code target} must be greater than or equal to the current | ||
* doc ID and must be a valid doc ID, ie. ≥ 0 and | ||
* < {@code maxDoc}.*/ | ||
public abstract boolean advanceExact(int target) throws IOException; | ||
|
||
/** | ||
* Iterates to the next value in the current document. Do not call this more than | ||
* {@link #docValueCount} times for the document. | ||
*/ | ||
public abstract long nextValue() throws IOException; | ||
|
||
/** | ||
* Retrieves the number of values for the current document. This must always | ||
* be greater than zero. | ||
* It is illegal to call this method after {@link #advanceExact(int)} | ||
* returned {@code false}. | ||
*/ | ||
public abstract int docValueCount(); | ||
|
||
/** | ||
* Advances to the first beyond the current whose document number is greater than or equal to | ||
* <i>target</i>, and returns the document number itself. Exhausts the iterator and returns {@link | ||
* org.apache.lucene.search.DocIdSetIterator#NO_MORE_DOCS} if <i>target</i> is greater than the highest document number in the set. | ||
* | ||
* This method is being used by {@link org.apache.lucene.search.comparators.NumericComparator.NumericLeafComparator} when point values optimization kicks | ||
* in and is implemented by most numeric types. | ||
*/ | ||
public int advance(int target) throws IOException { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
public abstract int docID(); | ||
} |
Oops, something went wrong.