Skip to content

Commit

Permalink
[TEST] Restore copy_to, double and float randomized testing (#120906)
Browse files Browse the repository at this point in the history
Partial rollback of #120859, these data types seem fine.
  • Loading branch information
kkrik-es authored Jan 27, 2025
1 parent 0fabaf7 commit 22099ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import org.elasticsearch.logsdb.datageneration.datasource.DataSource;
import org.elasticsearch.logsdb.datageneration.fields.leaf.ByteFieldDataGenerator;
import org.elasticsearch.logsdb.datageneration.fields.leaf.DoubleFieldDataGenerator;
import org.elasticsearch.logsdb.datageneration.fields.leaf.FloatFieldDataGenerator;
import org.elasticsearch.logsdb.datageneration.fields.leaf.IntegerFieldDataGenerator;
import org.elasticsearch.logsdb.datageneration.fields.leaf.KeywordFieldDataGenerator;
import org.elasticsearch.logsdb.datageneration.fields.leaf.LongFieldDataGenerator;
Expand All @@ -26,7 +28,9 @@ public enum FieldType {
UNSIGNED_LONG("unsigned_long"),
INTEGER("integer"),
SHORT("short"),
BYTE("byte");
BYTE("byte"),
DOUBLE("double"),
FLOAT("float");

private final String name;

Expand All @@ -42,6 +46,8 @@ public FieldDataGenerator generator(String fieldName, DataSource dataSource) {
case INTEGER -> new IntegerFieldDataGenerator(fieldName, dataSource);
case SHORT -> new ShortFieldDataGenerator(fieldName, dataSource);
case BYTE -> new ByteFieldDataGenerator(fieldName, dataSource);
case DOUBLE -> new DoubleFieldDataGenerator(fieldName, dataSource);
case FLOAT -> new FloatFieldDataGenerator(fieldName, dataSource);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques

return new DataSourceResponse.LeafMappingParametersGenerator(switch (request.fieldType()) {
case KEYWORD -> keywordMapping(request, map);
case LONG, INTEGER, SHORT, BYTE, UNSIGNED_LONG -> plain(map);

case LONG, INTEGER, SHORT, BYTE, DOUBLE, FLOAT, UNSIGNED_LONG -> plain(map);
});
}

Expand Down Expand Up @@ -61,8 +60,7 @@ private Supplier<Map<String, Object>> keywordMapping(
.collect(Collectors.toSet());

if (options.isEmpty() == false) {
// TODO: re-enable once #120831 is resolved
// injected.put("copy_to", ESTestCase.randomFrom(options));
injected.put("copy_to", ESTestCase.randomFrom(options));
}
}

Expand Down

0 comments on commit 22099ba

Please sign in to comment.