Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -29,15 +29,15 @@
/**
* Specialization of {@link LeafNumericFieldData} for integers.
*/
abstract class LeafLongFieldData implements LeafNumericFieldData {
public abstract class LeafLongFieldData implements LeafNumericFieldData {

private final long ramBytesUsed;
/**
* Type of this field. Used to expose appropriate types in {@link #getScriptValues()}.
*/
private final NumericType numericType;

LeafLongFieldData(long ramBytesUsed, NumericType numericType) {
protected LeafLongFieldData(long ramBytesUsed, NumericType numericType) {
this.ramBytesUsed = ramBytesUsed;
this.numericType = numericType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.fielddata.FieldData;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
import org.elasticsearch.index.fielddata.LeafNumericFieldData;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.SearchLookupAware;
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
import org.elasticsearch.index.fielddata.plain.LeafLongFieldData;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
Expand Down Expand Up @@ -108,41 +104,17 @@ protected boolean sortRequiresCustomComparator() {
@Override
public void clear() {}

public static class ScriptLongLeafFieldData implements LeafNumericFieldData {
private final ScriptLongDocValues scriptBinaryDocValues;
public static class ScriptLongLeafFieldData extends LeafLongFieldData {
private final ScriptLongDocValues scriptLongDocValues;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


ScriptLongLeafFieldData(ScriptLongDocValues scriptBinaryDocValues) {
this.scriptBinaryDocValues = scriptBinaryDocValues;
}

@Override
public ScriptDocValues<?> getScriptValues() {
return new ScriptDocValues.Longs(getLongValues());
}

@Override
public SortedBinaryDocValues getBytesValues() {
return FieldData.toString(scriptBinaryDocValues);
}

@Override
public SortedNumericDoubleValues getDoubleValues() {
return FieldData.castToDouble(getLongValues());
ScriptLongLeafFieldData(ScriptLongDocValues scriptLongDocValues) {
super(0, NumericType.LONG);
this.scriptLongDocValues = scriptLongDocValues;
}

@Override
public SortedNumericDocValues getLongValues() {
return scriptBinaryDocValues;
}

@Override
public long ramBytesUsed() {
return 0;
}

@Override
public void close() {

return scriptLongDocValues;
}
}
}