Skip to content

Commit 3d43498

Browse files
authored
[TEST] Restore scaled_float and half_float data generation (#120756)
1 parent 090e0dd commit 3d43498

File tree

16 files changed

+237
-99
lines changed

16 files changed

+237
-99
lines changed

test/framework/src/main/java/org/elasticsearch/logsdb/datageneration/FieldType.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
import org.elasticsearch.logsdb.datageneration.fields.leaf.ByteFieldDataGenerator;
1414
import org.elasticsearch.logsdb.datageneration.fields.leaf.DoubleFieldDataGenerator;
1515
import org.elasticsearch.logsdb.datageneration.fields.leaf.FloatFieldDataGenerator;
16+
import org.elasticsearch.logsdb.datageneration.fields.leaf.HalfFloatFieldDataGenerator;
1617
import org.elasticsearch.logsdb.datageneration.fields.leaf.IntegerFieldDataGenerator;
1718
import org.elasticsearch.logsdb.datageneration.fields.leaf.KeywordFieldDataGenerator;
1819
import org.elasticsearch.logsdb.datageneration.fields.leaf.LongFieldDataGenerator;
20+
import org.elasticsearch.logsdb.datageneration.fields.leaf.ScaledFloatFieldDataGenerator;
1921
import org.elasticsearch.logsdb.datageneration.fields.leaf.ShortFieldDataGenerator;
2022
import org.elasticsearch.logsdb.datageneration.fields.leaf.UnsignedLongFieldDataGenerator;
2123

@@ -30,7 +32,9 @@ public enum FieldType {
3032
SHORT("short"),
3133
BYTE("byte"),
3234
DOUBLE("double"),
33-
FLOAT("float");
35+
FLOAT("float"),
36+
HALF_FLOAT("half_float"),
37+
SCALED_FLOAT("scaled_float");
3438

3539
private final String name;
3640

@@ -48,6 +52,8 @@ public FieldDataGenerator generator(String fieldName, DataSource dataSource) {
4852
case BYTE -> new ByteFieldDataGenerator(fieldName, dataSource);
4953
case DOUBLE -> new DoubleFieldDataGenerator(fieldName, dataSource);
5054
case FLOAT -> new FloatFieldDataGenerator(fieldName, dataSource);
55+
case HALF_FLOAT -> new HalfFloatFieldDataGenerator(fieldName, dataSource);
56+
case SCALED_FLOAT -> new ScaledFloatFieldDataGenerator(fieldName, dataSource);
5157
};
5258
}
5359

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques
3232

3333
return new DataSourceResponse.LeafMappingParametersGenerator(switch (request.fieldType()) {
3434
case KEYWORD -> keywordMapping(request, map);
35-
case LONG, INTEGER, SHORT, BYTE, DOUBLE, FLOAT, UNSIGNED_LONG -> plain(map);
35+
case LONG, INTEGER, SHORT, BYTE, DOUBLE, FLOAT, HALF_FLOAT, UNSIGNED_LONG -> plain(map);
36+
case SCALED_FLOAT -> scaledFloatMapping(map);
3637
});
3738
}
3839

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import org.elasticsearch.common.settings.Settings;
1113
import org.elasticsearch.xcontent.XContentBuilder;
1214

1315
import java.util.Arrays;
1416
import java.util.List;
1517

16-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.formatErrorMessage;
17-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.prettyPrintArrays;
18+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.formatErrorMessage;
19+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.prettyPrintArrays;
1820

1921
class ArrayEqualMatcher extends GenericEqualsMatcher<Object[]> {
2022
ArrayEqualMatcher(
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import org.elasticsearch.common.settings.Settings;
1113
import org.elasticsearch.xcontent.XContentBuilder;
1214

1315
import java.util.List;
1416

15-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.formatErrorMessage;
17+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.formatErrorMessage;
1618

1719
public class GenericEqualsMatcher<T> extends Matcher {
1820
protected final XContentBuilder actualMappings;
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import org.elasticsearch.common.settings.Settings;
1113
import org.elasticsearch.xcontent.XContentBuilder;
1214

1315
import java.util.List;
1416

15-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.formatErrorMessage;
16-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.prettyPrintCollections;
17+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.formatErrorMessage;
18+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.prettyPrintCollections;
1719

1820
public class ListEqualMatcher extends GenericEqualsMatcher<List<?>> {
1921
public ListEqualMatcher(
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import java.util.Objects;
1113

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import org.elasticsearch.common.settings.Settings;
13+
import org.elasticsearch.logsdb.datageneration.matchers.source.SourceMatcher;
1114
import org.elasticsearch.xcontent.XContentBuilder;
12-
import org.elasticsearch.xpack.logsdb.qa.matchers.source.SourceMatcher;
1315

1416
import java.util.List;
1517
import java.util.Map;
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import org.elasticsearch.common.Strings;
1113
import org.elasticsearch.common.settings.Settings;
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers;
10+
package org.elasticsearch.logsdb.datageneration.matchers;
911

1012
import org.elasticsearch.common.settings.Settings;
1113
import org.elasticsearch.xcontent.XContentBuilder;
1214

13-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.formatErrorMessage;
15+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.formatErrorMessage;
1416

1517
public class ObjectMatcher extends GenericEqualsMatcher<Object> {
1618
ObjectMatcher(
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.logsdb.qa.matchers.source;
10+
package org.elasticsearch.logsdb.datageneration.matchers.source;
911

1012
import org.elasticsearch.common.settings.Settings;
13+
import org.elasticsearch.logsdb.datageneration.matchers.MatchResult;
1114
import org.elasticsearch.xcontent.XContentBuilder;
12-
import org.elasticsearch.xpack.logsdb.qa.matchers.MatchResult;
1315

1416
import java.util.List;
1517
import java.util.Objects;
@@ -18,8 +20,8 @@
1820
import java.util.function.Function;
1921
import java.util.stream.Collectors;
2022

21-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.formatErrorMessage;
22-
import static org.elasticsearch.xpack.logsdb.qa.matchers.Messages.prettyPrintCollections;
23+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.formatErrorMessage;
24+
import static org.elasticsearch.logsdb.datageneration.matchers.Messages.prettyPrintCollections;
2325

2426
class DynamicFieldMatcher {
2527
private final XContentBuilder actualMappings;

0 commit comments

Comments
 (0)