|
@@ -1035,8 +1035,8 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
|
|
|
|
|
|
public record SyntheticSourceExample(
|
|
|
CheckedConsumer<XContentBuilder, IOException> inputValue,
|
|
|
- CheckedConsumer<XContentBuilder, IOException> result,
|
|
|
- CheckedConsumer<XContentBuilder, IOException> blockLoaderResult,
|
|
|
+ CheckedConsumer<XContentBuilder, IOException> expectedForSyntheticSource,
|
|
|
+ CheckedConsumer<XContentBuilder, IOException> expectedForBlockLoader,
|
|
|
CheckedConsumer<XContentBuilder, IOException> mapping
|
|
|
) {
|
|
|
public SyntheticSourceExample(Object inputValue, Object result, CheckedConsumer<XContentBuilder, IOException> mapping) {
|
|
@@ -1063,22 +1063,15 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
|
|
|
|
|
|
private String expected() throws IOException {
|
|
|
XContentBuilder b = JsonXContent.contentBuilder().startObject().field("field");
|
|
|
- result.accept(b);
|
|
|
+ expectedForSyntheticSource.accept(b);
|
|
|
return Strings.toString(b.endObject());
|
|
|
}
|
|
|
|
|
|
- private Object expectedParsed() throws IOException {
|
|
|
- return XContentHelper.convertToMap(JsonXContent.jsonXContent, expected(), false).get("field");
|
|
|
- }
|
|
|
-
|
|
|
- private String expectedBlockLoader() throws IOException {
|
|
|
+ private Object expectedParsedForBlockLoader() throws IOException {
|
|
|
XContentBuilder b = JsonXContent.contentBuilder().startObject().field("field");
|
|
|
- blockLoaderResult.accept(b);
|
|
|
- return Strings.toString(b.endObject());
|
|
|
- }
|
|
|
-
|
|
|
- private Object expectedParsedBlockLoader() throws IOException {
|
|
|
- return XContentHelper.convertToMap(JsonXContent.jsonXContent, expectedBlockLoader(), false).get("field");
|
|
|
+ expectedForBlockLoader.accept(b);
|
|
|
+ String str = Strings.toString(b.endObject());
|
|
|
+ return XContentHelper.convertToMap(JsonXContent.jsonXContent, str, false).get("field");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1239,23 +1232,19 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
|
|
|
assertNoDocValueLoader(b -> b.startArray("field").endArray());
|
|
|
}
|
|
|
|
|
|
- // TextFieldMapperTests @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/104152")
|
|
|
- public void testBlockLoaderFromColumnReader() throws IOException {
|
|
|
+ public final void testBlockLoaderFromColumnReader() throws IOException {
|
|
|
testBlockLoader(false, true);
|
|
|
}
|
|
|
|
|
|
- // TextFieldMapperTests @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/104152")
|
|
|
- public void testBlockLoaderFromRowStrideReader() throws IOException {
|
|
|
+ public final void testBlockLoaderFromRowStrideReader() throws IOException {
|
|
|
testBlockLoader(false, false);
|
|
|
}
|
|
|
|
|
|
- // TextFieldMapperTests @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/104152")
|
|
|
- public void testBlockLoaderFromColumnReaderWithSyntheticSource() throws IOException {
|
|
|
+ public final void testBlockLoaderFromColumnReaderWithSyntheticSource() throws IOException {
|
|
|
testBlockLoader(true, true);
|
|
|
}
|
|
|
|
|
|
// Removed 'final' to silence this test in GeoPointFieldMapperTests, which does not support synthetic source completely
|
|
|
- // TextFieldMapperTests @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/104152")
|
|
|
public void testBlockLoaderFromRowStrideReaderWithSyntheticSource() throws IOException {
|
|
|
testBlockLoader(true, false);
|
|
|
}
|
|
@@ -1343,8 +1332,7 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
|
|
|
inBlock = valuesConvert.apply(inBlock);
|
|
|
}
|
|
|
}
|
|
|
- // If we're reading from _source we expect the order to be preserved, otherwise it's jumbled.
|
|
|
- Object expected = loader instanceof BlockSourceReader ? example.expectedParsed() : example.expectedParsedBlockLoader();
|
|
|
+ Object expected = example.expectedParsedForBlockLoader();
|
|
|
if (List.of().equals(expected)) {
|
|
|
assertThat(inBlock, nullValue());
|
|
|
return;
|