Skip to content

Remove ValuesSourceType.ANY #51539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 @@ -35,13 +35,6 @@

public abstract class ArrayValuesSourceParser<VS extends ValuesSource> implements Aggregator.Parser {

public abstract static class AnyValuesSourceParser extends ArrayValuesSourceParser<ValuesSource> {

protected AnyValuesSourceParser(boolean formattable) {
super(formattable, CoreValuesSourceType.ANY, null);
}
}

public abstract static class NumericValuesSourceParser extends ArrayValuesSourceParser<ValuesSource.Numeric> {

protected NumericValuesSourceParser(boolean formattable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,6 @@
* {@link CoreValuesSourceType} holds the {@link ValuesSourceType} implementations for the core aggregations package.
*/
public enum CoreValuesSourceType implements ValuesSourceType {
ANY(EquivalenceType.STRING) {
// ANY still has a lot of special handling in ValuesSourceConfig, and as such doesn't adhere to this interface yet
@Override
public ValuesSource getEmpty() {
// TODO: Implement this or get rid of ANY
throw new UnsupportedOperationException("CoreValuesSourceType.ANY is still a special case");
}

@Override
public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType) {
// TODO: Implement this or get rid of ANY
throw new UnsupportedOperationException("CoreValuesSourceType.ANY is still a special case");
}

@Override
public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script) {
// TODO: Implement this or get rid of ANY
throw new UnsupportedOperationException("CoreValuesSourceType.ANY is still a special case");
}

@Override
public ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, LongSupplier now) {
return BYTES.replaceMissing(valuesSource, rawMissing, docValueFormat, now);
}
},
NUMERIC(EquivalenceType.NUMBER) {
@Override
public ValuesSource getEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,11 @@ public ValuesSource toValuesSource(QueryShardContext context) {
}
} else {
if (fieldContext() == null) {
// Script case
vs = valueSourceType().getScript(script(), scriptValueType());
} else {
if (valueSourceType() == CoreValuesSourceType.ANY) {
// TODO: Clean up special cases around CoreValuesSourceType.ANY
// falling back to bytes values
vs = CoreValuesSourceType.BYTES.getField(fieldContext(), script());
} else {
// TODO: Better docs for Scripts vs Scripted Fields
vs = valueSourceType().getField(fieldContext(), script());
}
// Field or Value Script case
vs = valueSourceType().getField(fieldContext(), script());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
public class CoreValuesSourceTypeTests extends ESTestCase {

public void testFromString() {
assertThat(CoreValuesSourceType.fromString("any"), equalTo(CoreValuesSourceType.ANY));
assertThat(CoreValuesSourceType.fromString("numeric"), equalTo(CoreValuesSourceType.NUMERIC));
assertThat(CoreValuesSourceType.fromString("bytes"), equalTo(CoreValuesSourceType.BYTES));
assertThat(CoreValuesSourceType.fromString("geopoint"), equalTo(CoreValuesSourceType.GEOPOINT));
Expand Down