Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fielddata: Switch to Lucene DV APIs.
This commits removes BytesValues/LongValues/DoubleValues/... and tries to use Lucene's APIs such as NumericDocValues or RandomAccessOrds instead whenever possible. The next step would be to take advantage of the fact that APIs are the same in Lucene and Elasticsearch in order to remove our custom comparators and use Lucene's. There are a few side-effects to this change: - GeoDistanceComparator has been removed, DoubleValuesComparator is used instead on top of dynamically computed values (was easier than migrating GeoDistanceComparator). - SortedNumericDocValues doesn't guarantee uniqueness so long/double terms aggregators have been updated to make sure a document cannot fall twice in the same bucket. - Sorting by maximum value of a field or running a `max` aggregation is potentially significantly faster thanks to the random-access API. Our aggs and p/c aggregations benchmarks don't report differences with this change on uninverted field data. However the fact that doc values don't need to be wrapped anymore seems to help a lot. For example TermsAggregationSearchBenchmark reports ~30% faster terms aggregations on doc values on string fields with this change, which are now only ~18% slower than uninverted field data although stored on disk.
- Loading branch information
Showing
204 changed files
with
4,991 additions
and
6,174 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
90 changes: 0 additions & 90 deletions
90
src/main/java/org/elasticsearch/index/fielddata/AbstractAtomicNumericFieldData.java
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -16,35 +16,30 @@ | |
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.index.fielddata; | ||
|
||
import org.apache.lucene.index.RandomAccessOrds; | ||
|
||
/** | ||
* <code>FilterDoubleValues</code> contains another {@link DoubleValues}, which it | ||
* uses as its basic source of data, possibly transforming the data along the | ||
* way or providing additional functionality. | ||
* Base implementation of a {@link RandomAccessOrds} instance. | ||
*/ | ||
public abstract class FilterDoubleValues extends DoubleValues { | ||
|
||
protected final DoubleValues delegate; | ||
// TODO: should it be merged into Lucene's RandomAccessOrds? | ||
public abstract class AbstractRandomAccessOrds extends RandomAccessOrds { | ||
|
||
protected FilterDoubleValues(DoubleValues delegate) { | ||
super(delegate.isMultiValued()); | ||
this.delegate = delegate; | ||
} | ||
int i = 0; | ||
|
||
@Override | ||
public int setDocument(int docId) { | ||
return delegate.setDocument(docId); | ||
} | ||
protected abstract void doSetDocument(int docID); | ||
|
||
@Override | ||
public double nextValue() { | ||
return delegate.nextValue(); | ||
public final void setDocument(int docID) { | ||
doSetDocument(docID); | ||
i = 0; | ||
} | ||
|
||
@Override | ||
public AtomicFieldData.Order getOrder() { | ||
return delegate.getOrder(); | ||
public long nextOrd() { | ||
return ordAt(i++); | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jpountz
Author
Contributor
|
||
|
||
|
||
} |
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.
This class doesnt make a lot of sense to me. RandomAccessOrds already extends SortedDocValues, which itself has a nextOrd method. why the code duplication?