Skip to content

A random-random test for time-series data #132556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
613bda8
First test case in prototype messy test file
pabloem Aug 7, 2025
2d70cef
[CI] Auto commit changes from spotless
Aug 8, 2025
19e2f8a
First two randomized test cases
pabloem Aug 9, 2025
14b4c17
smol cleanup
pabloem Aug 9, 2025
836d49a
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 9, 2025
64624be
[CI] Auto commit changes from spotless
Aug 9, 2025
77a368b
cleanup and ready for first check
pabloem Aug 11, 2025
f53f904
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 11, 2025
afdac85
Address comments
pabloem Aug 12, 2025
c384e0c
addressing comments
pabloem Aug 12, 2025
f5bfbf1
more addressing comments
pabloem Aug 12, 2025
820d950
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 13, 2025
3d9325a
include values check that guarantees avg,count are off
pabloem Aug 15, 2025
0c02d2a
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 15, 2025
9fc14e1
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 15, 2025
0e2de20
fixed computation
pabloem Aug 18, 2025
51b4083
fixed computation
pabloem Aug 18, 2025
46c3feb
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 18, 2025
82a17e9
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 18, 2025
2349873
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 18, 2025
079f73a
fixup
pabloem Aug 19, 2025
5249814
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 19, 2025
b36fcf3
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 19, 2025
456df30
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 19, 2025
8ff3f82
fixup
pabloem Aug 19, 2025
e30deb0
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 19, 2025
7b796e6
smol cleanup
pabloem Aug 19, 2025
5df52c5
[CI] Auto commit changes from spotless
Aug 19, 2025
9126d11
foixup
pabloem Aug 19, 2025
dd912e4
Merge branch 'main' into pem-randomrandom-testing
pabloem Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public enum FieldType {
TEXT("text"),
IP("ip"),
CONSTANT_KEYWORD("constant_keyword"),
PASSTHROUGH("passthrough"), // For now this field type does not have default generators.
WILDCARD("wildcard"),
MATCH_ONLY_TEXT("match_only_text");

Expand Down Expand Up @@ -81,6 +82,7 @@ public FieldDataGenerator generator(String fieldName, DataSource dataSource) {
case CONSTANT_KEYWORD -> new ConstantKeywordFieldDataGenerator();
case WILDCARD -> new WildcardFieldDataGenerator(dataSource);
case MATCH_ONLY_TEXT -> new MatchOnlyTextFieldDataGenerator(dataSource);
case PASSTHROUGH -> throw new IllegalArgumentException("Passthrough field type does not have a default generator");
};
}

Expand All @@ -104,8 +106,9 @@ public static FieldType tryParse(String name) {
case "ip" -> FieldType.IP;
case "constant_keyword" -> FieldType.CONSTANT_KEYWORD;
case "wildcard" -> FieldType.WILDCARD;
case "passthrough" -> FieldType.PASSTHROUGH;
case "match_only_text" -> FieldType.MATCH_ONLY_TEXT;
default -> null;
default -> throw new IllegalArgumentException("Unknown field type: " + name);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public Mapping generate(Template template) {
if (specification.fullyDynamicMapping()) {
// Has to be "true" for fully dynamic mapping
topLevelMappingParameters.remove("dynamic");

return new Mapping(rawMapping, lookup);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public <T extends DataSourceResponse> T get(DataSourceRequest<T> request) {
return response;
}
}

throw new IllegalStateException("Request is not supported by data source");
throw new IllegalStateException(
"Request is not supported by data source. Request: "
+ request.toString()
+ "\n"
+ "Available handlers: "
+ handlers.stream().map(Object::getClass).map(Class::getName).toList().toString()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques
case CONSTANT_KEYWORD -> constantKeywordMapping();
case WILDCARD -> wildcardMapping();
case MATCH_ONLY_TEXT -> matchOnlyTextMapping();
case PASSTHROUGH -> throw new IllegalArgumentException("Unsupported field type: " + fieldType);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import org.elasticsearch.datageneration.FieldType;
import org.elasticsearch.test.ESTestCase;

import java.util.Arrays;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import static org.elasticsearch.test.ESTestCase.randomDouble;
import static org.elasticsearch.test.ESTestCase.randomIntBetween;
Expand Down Expand Up @@ -77,13 +79,17 @@ public String generateFieldName() {

// UNSIGNED_LONG is excluded because it is mapped as long
// and values larger than long fail to parse.
private static final Set<FieldType> EXCLUDED_FROM_DYNAMIC_MAPPING = Set.of(FieldType.UNSIGNED_LONG);
private static final Set<FieldType> EXCLUDED_FROM_DYNAMIC_MAPPING = Set.of(FieldType.UNSIGNED_LONG, FieldType.PASSTHROUGH);
private static final Set<FieldType> ALLOWED_FIELD_TYPES = Arrays.stream(FieldType.values())
.filter(fieldType -> EXCLUDED_FROM_DYNAMIC_MAPPING.contains(fieldType) == false)
.collect(Collectors.toSet());

@Override
public DataSourceResponse.FieldTypeGenerator handle(DataSourceRequest.FieldTypeGenerator request) {
return new DataSourceResponse.FieldTypeGenerator(
() -> new DataSourceResponse.FieldTypeGenerator.FieldTypeInfo(ESTestCase.randomFrom(FieldType.values()).toString())
);
return new DataSourceResponse.FieldTypeGenerator(() -> {
var fieldType = ESTestCase.randomFrom(ALLOWED_FIELD_TYPES);
return new DataSourceResponse.FieldTypeGenerator.FieldTypeInfo(fieldType.toString());
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.elasticsearch.xpack.wildcard.Wildcard;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -94,11 +95,16 @@ public DataSourceResponse.ChildFieldGenerator handle(DataSourceRequest.ChildFiel
return testChildFieldGenerator;
}

private static final FieldType[] SUPPORTED_FIELD_TYPES = Arrays.asList(FieldType.values())
.stream()
.filter(fieldType -> fieldType != FieldType.PASSTHROUGH)
.toArray(FieldType[]::new);

@Override
public DataSourceResponse.FieldTypeGenerator handle(DataSourceRequest.FieldTypeGenerator request) {
return new DataSourceResponse.FieldTypeGenerator(
() -> new DataSourceResponse.FieldTypeGenerator.FieldTypeInfo(
FieldType.values()[generatedFields++ % FieldType.values().length].toString()
SUPPORTED_FIELD_TYPES[generatedFields++ % SUPPORTED_FIELD_TYPES.length].toString()
)
);

Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugin/esql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dependencies {
compileOnly project(':modules:lang-painless:spi')
compileOnly project(xpackModule('esql-core'))
compileOnly project(xpackModule('ml'))
compileOnly project(path: xpackModule('mapper-aggregate-metric'))
compileOnly project(path: xpackModule('downsample'))
implementation project(xpackModule('kql'))
implementation project('compute')
implementation project('compute:ann')
Expand Down
Loading