Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -58,6 +58,7 @@

import static java.util.Collections.emptyMap;
import static org.elasticsearch.xpack.esql.core.type.DataType.TEXT;
import static org.elasticsearch.xpack.esql.plan.QuerySettings.UNMAPPED_FIELDS;

@Fork(1)
@Warmup(iterations = 5)
Expand Down Expand Up @@ -119,7 +120,8 @@ public void setup() {
Map.of(),
new EnrichResolution(),
InferenceResolution.EMPTY,
minimumVersion
minimumVersion,
UNMAPPED_FIELDS.defaultValue()
),
new Verifier(new Metrics(functionRegistry), new XPackLicenseState(() -> 0L))
);
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/140463.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 140463
summary: "Introduce support for mapping-unavailable fields (Fork from #139417)"
area: ES|QL
type: feature
issues: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import org.elasticsearch.xpack.esql.analysis.AnalyzerSettings;
import org.elasticsearch.xpack.esql.analysis.EnrichResolution;
import org.elasticsearch.xpack.esql.analysis.MutableAnalyzerContext;
import org.elasticsearch.xpack.esql.analysis.UnmappedResolution;
import org.elasticsearch.xpack.esql.analysis.Verifier;
import org.elasticsearch.xpack.esql.core.expression.Alias;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
Expand Down Expand Up @@ -218,6 +219,7 @@
import static org.elasticsearch.xpack.esql.parser.ParserUtils.ParamClassification.IDENTIFIER;
import static org.elasticsearch.xpack.esql.parser.ParserUtils.ParamClassification.PATTERN;
import static org.elasticsearch.xpack.esql.parser.ParserUtils.ParamClassification.VALUE;
import static org.elasticsearch.xpack.esql.plan.QuerySettings.UNMAPPED_FIELDS;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
Expand Down Expand Up @@ -544,6 +546,26 @@ public static MutableAnalyzerContext testAnalyzerContext(
Map<String, IndexResolution> lookupResolution,
EnrichResolution enrichResolution,
InferenceResolution inferenceResolution
) {
return testAnalyzerContext(
configuration,
functionRegistry,
indexResolutions,
lookupResolution,
enrichResolution,
inferenceResolution,
UNMAPPED_FIELDS.defaultValue()
);
}

public static MutableAnalyzerContext testAnalyzerContext(
Configuration configuration,
EsqlFunctionRegistry functionRegistry,
Map<IndexPattern, IndexResolution> indexResolutions,
Map<String, IndexResolution> lookupResolution,
EnrichResolution enrichResolution,
InferenceResolution inferenceResolution,
UnmappedResolution unmappedResolution
) {
return new MutableAnalyzerContext(
configuration,
Expand All @@ -552,7 +574,8 @@ public static MutableAnalyzerContext testAnalyzerContext(
lookupResolution,
enrichResolution,
inferenceResolution,
randomMinimumVersion()
randomMinimumVersion(),
unmappedResolution
);
}

Expand Down Expand Up @@ -1205,6 +1228,23 @@ static BytesReference randomTsId() {
return routingPathFields.buildHash();
}

// lifted from org.elasticsearch.http.HttpClientStatsTrackerTests
public static String randomizeCase(String s) {
final char[] chars = s.toCharArray();
for (int i = 0; i < chars.length; i++) {
chars[i] = randomizeCase(chars[i]);
}
return new String(chars);
}

private static char randomizeCase(char c) {
return switch (between(1, 3)) {
case 1 -> Character.toUpperCase(c);
case 2 -> Character.toLowerCase(c);
default -> c;
};
}

public static WildcardLike wildcardLike(Expression left, String exp) {
return new WildcardLike(EMPTY, left, new WildcardPattern(exp), false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@ public MutableAnalyzerContext(
Map<String, IndexResolution> lookupResolution,
EnrichResolution enrichResolution,
InferenceResolution inferenceResolution,
TransportVersion minimumVersion
TransportVersion minimumVersion,
UnmappedResolution unmappedResolution
) {
super(configuration, functionRegistry, indexResolution, lookupResolution, enrichResolution, inferenceResolution, minimumVersion);
super(
configuration,
functionRegistry,
indexResolution,
lookupResolution,
enrichResolution,
inferenceResolution,
minimumVersion,
unmappedResolution
);
this.currentVersion = minimumVersion;
}

Expand Down
Loading
Loading