Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query;
Expand All @@ -29,6 +28,7 @@
import org.elasticsearch.index.fielddata.FieldDataContext;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
import org.elasticsearch.index.fielddata.SortedNumericLongValues;
import org.elasticsearch.index.mapper.IndexType;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MappingLookup;
Expand Down Expand Up @@ -179,14 +179,14 @@ private ScoreScript.Factory bareMetalScript() {
return new ScoreScript.LeafFactory() {
@Override
public ScoreScript newInstance(DocReader docReader) throws IOException {
SortedNumericDocValues values = ifd.load(((DocValuesDocReader) docReader).getLeafReaderContext()).getLongValues();
SortedNumericLongValues values = ifd.load(((DocValuesDocReader) docReader).getLeafReaderContext()).getLongValues();
return new ScoreScript(params, null, docReader) {
private int docId;

@Override
public double execute(ExplanationHolder explanation) {
try {
values.advance(docId);
values.advanceExact(docId);
if (values.docValueCount() != 1) {
throw new IllegalArgumentException("script only works when there is exactly one value");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
*/
package org.elasticsearch.aggregations.bucket.histogram;

import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.LongValues;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.util.CollectionUtil;
import org.elasticsearch.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo;
Expand All @@ -19,6 +17,7 @@
import org.elasticsearch.common.util.IntArray;
import org.elasticsearch.common.util.LongArray;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.index.fielddata.SortedNumericLongValues;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.AggregationExecutionContext;
import org.elasticsearch.search.aggregations.Aggregator;
Expand Down Expand Up @@ -125,17 +124,17 @@ public final DeferringBucketCollector buildDeferringCollector() {
return deferringCollector;
}

protected abstract LeafBucketCollector getLeafCollector(SortedNumericDocValues values, LeafBucketCollector sub) throws IOException;
protected abstract LeafBucketCollector getLeafCollector(SortedNumericLongValues values, LeafBucketCollector sub) throws IOException;

protected abstract LeafBucketCollector getLeafCollector(NumericDocValues values, LeafBucketCollector sub) throws IOException;
protected abstract LeafBucketCollector getLeafCollector(LongValues values, LeafBucketCollector sub) throws IOException;

@Override
public final LeafBucketCollector getLeafCollector(AggregationExecutionContext aggCtx, LeafBucketCollector sub) throws IOException {
if (valuesSource == null) {
return LeafBucketCollector.NO_OP_COLLECTOR;
}
final SortedNumericDocValues values = valuesSource.longValues(aggCtx.getLeafReaderContext());
final NumericDocValues singleton = DocValues.unwrapSingleton(values);
final SortedNumericLongValues values = valuesSource.longValues(aggCtx.getLeafReaderContext());
final LongValues singleton = SortedNumericLongValues.unwrapSingleton(values);
return singleton != null ? getLeafCollector(singleton, sub) : getLeafCollector(values, sub);
}

Expand Down Expand Up @@ -239,7 +238,7 @@ private static class FromSingle extends AutoDateHistogramAggregator {
}

@Override
protected LeafBucketCollector getLeafCollector(SortedNumericDocValues values, LeafBucketCollector sub) {
protected LeafBucketCollector getLeafCollector(SortedNumericLongValues values, LeafBucketCollector sub) {
return new LeafBucketCollectorBase(sub, values) {
@Override
public void collect(int doc, long owningBucketOrd) throws IOException {
Expand All @@ -265,7 +264,7 @@ public void collect(int doc, long owningBucketOrd) throws IOException {
}

@Override
protected LeafBucketCollector getLeafCollector(NumericDocValues values, LeafBucketCollector sub) {
protected LeafBucketCollector getLeafCollector(LongValues values, LeafBucketCollector sub) {
return new LeafBucketCollectorBase(sub, values) {
@Override
public void collect(int doc, long owningBucketOrd) throws IOException {
Expand Down Expand Up @@ -461,7 +460,7 @@ private static class FromMany extends AutoDateHistogramAggregator {
}

@Override
protected LeafBucketCollector getLeafCollector(SortedNumericDocValues values, LeafBucketCollector sub) {
protected LeafBucketCollector getLeafCollector(SortedNumericLongValues values, LeafBucketCollector sub) {
return new LeafBucketCollectorBase(sub, values) {
@Override
public void collect(int doc, long owningBucketOrd) throws IOException {
Expand All @@ -487,7 +486,7 @@ public void collect(int doc, long owningBucketOrd) throws IOException {
}

@Override
protected LeafBucketCollector getLeafCollector(NumericDocValues values, LeafBucketCollector sub) {
protected LeafBucketCollector getLeafCollector(LongValues values, LeafBucketCollector sub) {
return new LeafBucketCollectorBase(sub, values) {
@Override
public void collect(int doc, long owningBucketOrd) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

package org.elasticsearch.aggregations.bucket.timeseries;

import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.util.LongArray;
import org.elasticsearch.common.util.ObjectArray;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.index.fielddata.SortedNumericLongValues;
import org.elasticsearch.index.mapper.RoutingPathFields;
import org.elasticsearch.index.mapper.TimeSeriesIdFieldMapper;
import org.elasticsearch.search.aggregations.AggregationExecutionContext;
Expand Down Expand Up @@ -121,7 +121,7 @@ protected LeafBucketCollector getLeafCollector(AggregationExecutionContext aggCt
for (var entry : dimensionValueSources.entrySet()) {
String fieldName = entry.getKey();
if (entry.getValue() instanceof ValuesSource.Numeric numericVS) {
SortedNumericDocValues docValues = numericVS.longValues(aggCtx.getLeafReaderContext());
SortedNumericLongValues docValues = numericVS.longValues(aggCtx.getLeafReaderContext());
dimensionConsumers.put(entry.getKey(), (docId, tsidBuilder) -> {
if (docValues.advanceExact(docId)) {
assert docValues.docValueCount() == 1 : "Dimension field cannot be a multi-valued field";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

package org.elasticsearch.index.mapper.extras;

import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.LongValues;
import org.apache.lucene.search.Query;
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.settings.Setting;
Expand All @@ -28,6 +26,7 @@
import org.elasticsearch.index.fielddata.LeafNumericFieldData;
import org.elasticsearch.index.fielddata.NumericDoubleValues;
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
import org.elasticsearch.index.fielddata.SortedNumericLongValues;
import org.elasticsearch.index.fielddata.SourceValueFetcherSortedDoubleIndexFieldData;
import org.elasticsearch.index.fielddata.plain.LeafDoubleFieldData;
import org.elasticsearch.index.fielddata.plain.SortedNumericIndexFieldData;
Expand Down Expand Up @@ -831,8 +830,8 @@ public void close() {

@Override
public SortedNumericDoubleValues getDoubleValues() {
final SortedNumericDocValues values = scaledFieldData.getLongValues();
final NumericDocValues singleValues = DocValues.unwrapSingleton(values);
final SortedNumericLongValues values = scaledFieldData.getLongValues();
final LongValues singleValues = SortedNumericLongValues.unwrapSingleton(values);
if (singleValues != null) {
return FieldData.singleton(new NumericDoubleValues() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

package org.elasticsearch.script.field.murmur3;

import org.apache.lucene.index.SortedNumericDocValues;
import org.elasticsearch.index.fielddata.SortedNumericLongValues;
import org.elasticsearch.script.field.AbstractLongDocValuesField;

public class Murmur3DocValueField extends AbstractLongDocValuesField {

public Murmur3DocValueField(SortedNumericDocValues input, String name) {
public Murmur3DocValueField(SortedNumericLongValues input, String name) {
super(input, name);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import org.elasticsearch.script.BooleanFieldScript;

public final class BooleanScriptDocValues extends AbstractSortedNumericDocValues {
public final class BooleanScriptDocValues extends SortedNumericLongValues {
private final BooleanFieldScript script;
private int cursor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.index.fielddata;

import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.index.fielddata.plain.LeafLongFieldData;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
Expand All @@ -25,12 +24,12 @@ public final class BooleanScriptFieldData extends IndexNumericFieldData {
public static class Builder implements IndexFieldData.Builder {
private final String name;
private final BooleanFieldScript.LeafFactory leafFactory;
protected final ToScriptFieldFactory<SortedNumericDocValues> toScriptFieldFactory;
protected final ToScriptFieldFactory<SortedNumericLongValues> toScriptFieldFactory;

public Builder(
String name,
BooleanFieldScript.LeafFactory leafFactory,
ToScriptFieldFactory<SortedNumericDocValues> toScriptFieldFactory
ToScriptFieldFactory<SortedNumericLongValues> toScriptFieldFactory
) {
this.name = name;
this.leafFactory = leafFactory;
Expand All @@ -45,12 +44,12 @@ public BooleanScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerSer

private final String fieldName;
private final BooleanFieldScript.LeafFactory leafFactory;
protected final ToScriptFieldFactory<SortedNumericDocValues> toScriptFieldFactory;
protected final ToScriptFieldFactory<SortedNumericLongValues> toScriptFieldFactory;

private BooleanScriptFieldData(
String fieldName,
BooleanFieldScript.LeafFactory leafFactory,
ToScriptFieldFactory<SortedNumericDocValues> toScriptFieldFactory
ToScriptFieldFactory<SortedNumericLongValues> toScriptFieldFactory
) {
this.fieldName = fieldName;
this.leafFactory = leafFactory;
Expand Down Expand Up @@ -98,19 +97,19 @@ protected boolean isIndexed() {

public static class BooleanScriptLeafFieldData extends LeafLongFieldData {
private final BooleanScriptDocValues booleanScriptDocValues;
protected final ToScriptFieldFactory<SortedNumericDocValues> toScriptFieldFactory;
protected final ToScriptFieldFactory<SortedNumericLongValues> toScriptFieldFactory;

BooleanScriptLeafFieldData(
BooleanScriptDocValues booleanScriptDocValues,
ToScriptFieldFactory<SortedNumericDocValues> toScriptFieldFactory
ToScriptFieldFactory<SortedNumericLongValues> toScriptFieldFactory
) {
super(0);
this.booleanScriptDocValues = booleanScriptDocValues;
this.toScriptFieldFactory = toScriptFieldFactory;
}

@Override
public SortedNumericDocValues getLongValues() {
public SortedNumericLongValues getLongValues() {
return booleanScriptDocValues;
}

Expand Down
Loading