Remove IndexFieldData#clear since it is unused. (#60475)

This method was never called. It also seemed tricky that calling a method on
`IndexFieldData` could clear the contents of a shared cache.
This commit is contained in:
Julie Tibshirani 2020-07-30 13:53:59 -07:00
parent 0022d316bb
commit 8ac81a3447
18 changed files with 2 additions and 96 deletions

View File

@ -541,11 +541,6 @@ public class ScaledFloatFieldMapper extends FieldMapper {
return true;
}
@Override
public void clear() {
scaledFieldData.clear();
}
@Override
public NumericType getNumericType() {
/*

View File

@ -86,11 +86,6 @@ public interface IndexFieldData<FD extends LeafFieldData> {
BucketedSort newBucketedSort(BigArrays bigArrays, @Nullable Object missingValue, MultiValueMode sortMode,
Nested nested, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra);
/**
* Clears any resources associated with this field data.
*/
void clear();
// we need this extended source we we have custom comparators to reuse our field data
// in this case, we need to reduce type that will be used when search results are reduced
// on another node (we don't have the custom source them...)

View File

@ -44,8 +44,4 @@ public abstract class IndexHistogramFieldData implements IndexFieldData<LeafHist
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
}

View File

@ -117,9 +117,6 @@ public final class GlobalOrdinalsIndexFieldData implements IndexOrdinalsFieldDat
throw new IllegalArgumentException("only supported on numeric fields");
}
@Override
public void clear() {}
@Override
public long ramBytesUsed() {
return memorySizeInBytes;
@ -211,9 +208,6 @@ public final class GlobalOrdinalsIndexFieldData implements IndexOrdinalsFieldDat
throw new IllegalArgumentException("only supported on numeric fields");
}
@Override
public void clear() {}
@Override
public long ramBytesUsed() {
return memorySizeInBytes;

View File

@ -58,11 +58,6 @@ public abstract class AbstractIndexFieldData<FD extends LeafFieldData> implement
return valuesSourceType;
}
@Override
public void clear() {
cache.clear(fieldName);
}
@Override
public FD load(LeafReaderContext context) {
if (context.reader().getFieldInfos().fieldInfo(fieldName) == null) {

View File

@ -59,11 +59,6 @@ public abstract class AbstractLatLonPointIndexFieldData implements IndexGeoPoint
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public SortField sortField(@Nullable Object missingValue, MultiValueMode sortMode, XFieldComparatorSource.Nested nested,
boolean reverse) {

View File

@ -69,10 +69,6 @@ public class BinaryIndexFieldData implements IndexFieldData<BinaryDVLeafFieldDat
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public BinaryDVLeafFieldData load(LeafReaderContext context) {

View File

@ -57,11 +57,6 @@ public class BytesBinaryIndexFieldData implements IndexFieldData<BytesBinaryDVLe
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public SortField sortField(@Nullable Object missingValue, MultiValueMode sortMode, Nested nested, boolean reverse) {
throw new IllegalArgumentException("can't sort on binary field");

View File

@ -146,10 +146,6 @@ public class ConstantIndexFieldData extends AbstractIndexOrdinalsFieldData {
atomicFieldData = new ConstantLeafFieldData(value);
}
@Override
public void clear() {
}
@Override
public final LeafOrdinalsFieldData load(LeafReaderContext context) {
return atomicFieldData;

View File

@ -92,11 +92,6 @@ public class SortedNumericIndexFieldData extends IndexNumericFieldData {
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
protected boolean sortRequiresCustomComparator() {
return numericType == NumericType.HALF_FLOAT;

View File

@ -109,11 +109,6 @@ public class SortedSetOrdinalsIndexFieldData implements IndexOrdinalsFieldData {
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public SortField sortField(@Nullable Object missingValue, MultiValueMode sortMode, Nested nested, boolean reverse) {
XFieldComparatorSource source = new BytesRefFieldComparatorSource(this, missingValue, sortMode, nested);

View File

@ -54,11 +54,6 @@ public class StringBinaryIndexFieldData implements IndexFieldData<StringBinaryDV
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public SortField sortField(Object missingValue, MultiValueMode sortMode, Nested nested, boolean reverse) {
XFieldComparatorSource source = new BytesRefFieldComparatorSource(this, missingValue,

View File

@ -209,12 +209,6 @@ public class IdFieldMapper extends MetadataFieldMapper {
Nested nested, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra) {
throw new UnsupportedOperationException("can't sort on the [" + CONTENT_TYPE + "] field");
}
@Override
public void clear() {
fieldData.clear();
}
};
}
};

View File

@ -69,11 +69,6 @@ public class NoOrdinalsStringFieldDataTests extends PagedBytesStringFieldDataTes
throw new UnsupportedOperationException();
}
@Override
public void clear() {
in.clear();
}
};
}

View File

@ -159,11 +159,6 @@ public class FunctionScoreTests extends ESTestCase {
SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra) {
throw new UnsupportedOperationException(UNSUPPORTED);
}
@Override
public void clear() {
throw new UnsupportedOperationException(UNSUPPORTED);
}
}
/**
@ -249,11 +244,6 @@ public class FunctionScoreTests extends ESTestCase {
protected boolean sortRequiresCustomComparator() {
return false;
}
@Override
public void clear() {
throw new UnsupportedOperationException(UNSUPPORTED);
}
}
private static final ScoreFunction RANDOM_SCORE_FUNCTION = new RandomScoreFunction(0, 0, new IndexFieldDataStub());

View File

@ -374,11 +374,6 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
throw new IllegalArgumentException("only supported on numeric fields");
}
@Override
public void clear() {
delegate.clear();
}
@Override
public LeafOrdinalsFieldData load(LeafReaderContext context) {
LeafOrdinalsFieldData fieldData = delegate.load(context);

View File

@ -42,11 +42,6 @@ public abstract class AbstractLatLonShapeIndexFieldData implements IndexGeoShape
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public SortField sortField(@Nullable Object missingValue, MultiValueMode sortMode, XFieldComparatorSource.Nested nested,
boolean reverse) {

View File

@ -45,11 +45,6 @@ public class VectorIndexFieldData implements IndexFieldData<VectorDVLeafFieldDat
return valuesSourceType;
}
@Override
public final void clear() {
// can't do
}
@Override
public SortField sortField(@Nullable Object missingValue, MultiValueMode sortMode, Nested nested, boolean reverse) {
throw new IllegalArgumentException("can't sort on the vector field");