Skip to content

Commit ecaaf7f

Browse files
committed
iter
1 parent cd900e6 commit ecaaf7f

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

server/src/main/java/org/elasticsearch/index/mapper/AbstractGeometryFieldMapper.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ protected BlockLoader blockLoaderFromSource(BlockLoaderContext blContext) {
194194
protected abstract Object nullValueAsSource(T nullValue);
195195

196196
protected BlockLoader blockLoaderFromFallbackSyntheticSource(BlockLoaderContext blContext) {
197-
Function<List<T>, List<Object>> formatter = getFormatter(GeometryFormatterFactory.WKB);
198-
199-
return new FallbackSyntheticSourceBlockLoader(new GeometriesFallbackSyntheticSourceReader(geometryParser, formatter), name()) {
197+
return new FallbackSyntheticSourceBlockLoader(new GeometriesFallbackSyntheticSourceReader(), name()) {
200198
@Override
201199
public Builder builder(BlockFactory factory, int expectedCount) {
202200
return factory.bytesRefs(expectedCount);
@@ -205,12 +203,10 @@ public Builder builder(BlockFactory factory, int expectedCount) {
205203
}
206204

207205
private class GeometriesFallbackSyntheticSourceReader implements FallbackSyntheticSourceBlockLoader.Reader<BytesRef> {
208-
private final Parser<T> geometryParser;
209206
private final Function<List<T>, List<Object>> formatter;
210207

211-
private GeometriesFallbackSyntheticSourceReader(Parser<T> geometryParser, Function<List<T>, List<Object>> formatter) {
212-
this.geometryParser = geometryParser;
213-
this.formatter = formatter;
208+
private GeometriesFallbackSyntheticSourceReader() {
209+
this.formatter = getFormatter(GeometryFormatterFactory.WKB);
214210
}
215211

216212
@Override

test/framework/src/main/java/org/elasticsearch/logsdb/datageneration/datasource/DefaultFieldDataGeneratorHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class DefaultFieldDataGeneratorHandler implements DataSourceHandler {
1515
public DataSourceResponse.FieldDataGenerator handle(DataSourceRequest.FieldDataGenerator request) {
1616
var fieldType = FieldType.tryParse(request.fieldType());
1717
if (fieldType == null) {
18+
// This is a custom field type
1819
return null;
1920
}
2021

x-pack/plugin/logsdb/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/qa/DataGenerationHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public DataGenerationHelper(Consumer<DataGeneratorSpecification.Builder> builder
7676
)
7777
)
7878
)
79-
// "shape" and "geo_shape" are very similar so we'll use only one of them
8079
.withDataSourceHandlers(List.of(new GeoShapeDataSourceHandler(), new ShapeDataSourceHandler()))
8180
.withDataSourceHandlers(List.of(new DataSourceHandler() {
8281
@Override
@@ -87,16 +86,18 @@ public DataSourceResponse.FieldTypeGenerator handle(DataSourceRequest.FieldTypeG
8786

8887
@Override
8988
public DataSourceResponse.FieldTypeGenerator.FieldTypeInfo get() {
89+
// Base set of field types
9090
var options = Arrays.stream(FieldType.values()).map(FieldType::toString).collect(Collectors.toSet());
9191
// Custom types coming from specific functionality modules
92+
9293
if (shapesGenerated < 5) {
9394
options.add("geo_shape");
9495
options.add("shape");
9596
}
9697

9798
var randomChoice = ESTestCase.randomFrom(options);
9899
if (randomChoice.equals("geo_shape") || randomChoice.equals("shape")) {
99-
shapesGenerated++;
100+
shapesGenerated += 1;
100101
}
101102

102103
return new DataSourceResponse.FieldTypeGenerator.FieldTypeInfo(ESTestCase.randomFrom(options));

x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/datageneration/GeoShapeFieldDataGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public GeoShapeFieldDataGenerator(DataSource dataSource) {
4343
@Override
4444
public Object generateValue(Map<String, Object> fieldMapping) {
4545
if (fieldMapping == null) {
46-
// ???
46+
// dynamically mapped and dynamic mapping does not play well with this type (it gets mapped as an object)
47+
// return null to skip indexing this field
4748
return null;
4849
}
4950

x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/datageneration/ShapeFieldDataGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public ShapeFieldDataGenerator(DataSource dataSource) {
4343
@Override
4444
public Object generateValue(Map<String, Object> fieldMapping) {
4545
if (fieldMapping == null) {
46-
// ???
46+
// dynamically mapped and dynamic mapping does not play well with this type (it gets mapped as an object)
47+
// return null to skip indexing this field
4748
return null;
4849
}
4950

0 commit comments

Comments
 (0)