Skip to content

Commit 1b74ec0

Browse files
authored
Add competitive sort tests to MapperTestCase (#137437)
This adds a new abstract method to MapperTestCase for checking whether a particular field type configuration supports competitive iterators during sorting.
1 parent 4f3ff81 commit 1b74ec0

File tree

37 files changed

+276
-0
lines changed

37 files changed

+276
-0
lines changed

modules/legacy-geo/src/test/java/org/elasticsearch/legacygeo/mapper/LegacyGeoShapeFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,4 +678,9 @@ protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed)
678678
protected IngestScriptSupport ingestScriptSupport() {
679679
throw new AssumptionViolatedException("not supported");
680680
}
681+
682+
@Override
683+
protected List<SortShortcutSupport> getSortShortcutSupport() {
684+
return List.of();
685+
}
681686
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,4 +385,9 @@ public void testLoadSyntheticSourceFromStringOrBytesRef() throws IOException {
385385
}
386386
}
387387
}
388+
389+
@Override
390+
protected List<SortShortcutSupport> getSortShortcutSupport() {
391+
return List.of();
392+
}
388393
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/RankFeatureFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,9 @@ protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed)
215215
protected IngestScriptSupport ingestScriptSupport() {
216216
throw new AssumptionViolatedException("not supported");
217217
}
218+
219+
@Override
220+
protected List<SortShortcutSupport> getSortShortcutSupport() {
221+
return List.of();
222+
}
218223
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/RankFeaturesFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,9 @@ protected SyntheticSourceSupport syntheticSourceSupport(boolean syntheticSource)
209209
protected IngestScriptSupport ingestScriptSupport() {
210210
throw new AssumptionViolatedException("not supported");
211211
}
212+
213+
@Override
214+
protected List<SortShortcutSupport> getSortShortcutSupport() {
215+
return List.of();
216+
}
212217
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/ScaledFloatFieldMapperTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,4 +649,12 @@ private double encodeDecode(double value, double scalingFactor) {
649649
private static double randomValue() {
650650
return randomBoolean() ? randomDoubleBetween(-Double.MAX_VALUE, Double.MAX_VALUE, true) : randomFloat();
651651
}
652+
653+
@Override
654+
protected List<SortShortcutSupport> getSortShortcutSupport() {
655+
return List.of(
656+
// TODO doubles currently disable pruning, can we re-enable?
657+
new SortShortcutSupport(this::minimalMapping, this::writeField, false)
658+
);
659+
}
652660
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/SearchAsYouTypeFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,4 +877,9 @@ protected RandomIndexWriter indexWriterForSyntheticSource(Directory directory) t
877877
protected IngestScriptSupport ingestScriptSupport() {
878878
throw new AssumptionViolatedException("not supported");
879879
}
880+
881+
@Override
882+
protected List<SortShortcutSupport> getSortShortcutSupport() {
883+
return List.of();
884+
}
880885
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/TokenCountFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,9 @@ public void testAggregationsDocValuesDisabled() throws IOException {
264264
}));
265265
assertAggregatableConsistency(mapperService.fieldType("field"));
266266
}
267+
268+
@Override
269+
protected List<SortShortcutSupport> getSortShortcutSupport() {
270+
return List.of();
271+
}
267272
}

plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,4 +318,9 @@ protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed)
318318
protected IngestScriptSupport ingestScriptSupport() {
319319
throw new AssumptionViolatedException("not supported");
320320
}
321+
322+
@Override
323+
protected List<SortShortcutSupport> getSortShortcutSupport() {
324+
return List.of();
325+
}
321326
}

plugins/mapper-annotated-text/src/test/java/org/elasticsearch/index/mapper/annotatedtext/AnnotatedTextFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,4 +704,9 @@ protected void validateRoundTripReader(String syntheticSource, DirectoryReader r
704704
protected IngestScriptSupport ingestScriptSupport() {
705705
throw new AssumptionViolatedException("not supported");
706706
}
707+
708+
@Override
709+
protected List<SortShortcutSupport> getSortShortcutSupport() {
710+
return List.of();
711+
}
707712
}

plugins/mapper-murmur3/src/test/java/org/elasticsearch/index/mapper/murmur3/Murmur3FieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,9 @@ protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed)
148148
protected IngestScriptSupport ingestScriptSupport() {
149149
throw new AssumptionViolatedException("not supported");
150150
}
151+
152+
@Override
153+
protected List<SortShortcutSupport> getSortShortcutSupport() {
154+
return List.of();
155+
}
151156
}

0 commit comments

Comments
 (0)