Correct implemented interface of ParsedReverseNested (#35455)
The ParsedReverseNested implementation should implement the ReverseNested interface and not the Nested interface. Although this is an empty marker interface it is confusing and can lead to casting errors. Also adding a test to check that both ParsedNested and ParsedReverseNested implement the correct interface. Closes #35449
This commit is contained in:
parent
09965cb370
commit
0a6614a03a
|
@ -23,7 +23,7 @@ import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregatio
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ParsedReverseNested extends ParsedSingleBucketAggregation implements Nested {
|
public class ParsedReverseNested extends ParsedSingleBucketAggregation implements ReverseNested {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
|
|
|
@ -22,9 +22,11 @@ package org.elasticsearch.search.aggregations.bucket.nested;
|
||||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||||
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
|
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
|
||||||
|
import org.elasticsearch.search.aggregations.ParsedAggregation;
|
||||||
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
|
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
|
||||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -49,4 +51,10 @@ public class InternalNestedTests extends InternalSingleBucketAggregationTestCase
|
||||||
protected Class<? extends ParsedSingleBucketAggregation> implementationClass() {
|
protected Class<? extends ParsedSingleBucketAggregation> implementationClass() {
|
||||||
return ParsedNested.class;
|
return ParsedNested.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void assertFromXContent(InternalNested aggregation, ParsedAggregation parsedAggregation) throws IOException {
|
||||||
|
super.assertFromXContent(aggregation, parsedAggregation);
|
||||||
|
assertTrue(parsedAggregation instanceof Nested);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,11 @@ package org.elasticsearch.search.aggregations.bucket.nested;
|
||||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||||
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
|
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
|
||||||
|
import org.elasticsearch.search.aggregations.ParsedAggregation;
|
||||||
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
|
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
|
||||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -49,4 +51,10 @@ public class InternalReverseNestedTests extends InternalSingleBucketAggregationT
|
||||||
protected Class<? extends ParsedSingleBucketAggregation> implementationClass() {
|
protected Class<? extends ParsedSingleBucketAggregation> implementationClass() {
|
||||||
return ParsedReverseNested.class;
|
return ParsedReverseNested.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void assertFromXContent(InternalReverseNested aggregation, ParsedAggregation parsedAggregation) throws IOException {
|
||||||
|
super.assertFromXContent(aggregation, parsedAggregation);
|
||||||
|
assertTrue(parsedAggregation instanceof ReverseNested);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue