Skip to content

Commit 092d4ba

Browse files
authored
ESQL: Fix case-insensitive test generation with Unicodes (#128753)
This excludes from testing the strings containing Unicode chars that change length when changing case. Closes #128705 Closes #128706 Closes #128710 Closes #128711 Closes #128712 Closes #128713 Closes #128714 Closes #128715 Closes #128716 Closes #128717 Closes #128789 Closes #128790 Closes #128791 Closes #128792
1 parent 2856923 commit 092d4ba

File tree

2 files changed

+9
-32
lines changed

2 files changed

+9
-32
lines changed

muted-tests.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -489,36 +489,6 @@ tests:
489489
- class: org.elasticsearch.packaging.test.DockerTests
490490
method: test085EnvironmentVariablesAreRespectedUnderDockerExec
491491
issue: https://github.com/elastic/elasticsearch/issues/128115
492-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
493-
method: testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with text}
494-
issue: https://github.com/elastic/elasticsearch/issues/128705
495-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
496-
method: testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with keyword}
497-
issue: https://github.com/elastic/elasticsearch/issues/128706
498-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
499-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
500-
issue: https://github.com/elastic/elasticsearch/issues/128710
501-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
502-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
503-
issue: https://github.com/elastic/elasticsearch/issues/128711
504-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
505-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
506-
issue: https://github.com/elastic/elasticsearch/issues/128712
507-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
508-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
509-
issue: https://github.com/elastic/elasticsearch/issues/128713
510-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
511-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
512-
issue: https://github.com/elastic/elasticsearch/issues/128714
513-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
514-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
515-
issue: https://github.com/elastic/elasticsearch/issues/128715
516-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
517-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
518-
issue: https://github.com/elastic/elasticsearch/issues/128716
519-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
520-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
521-
issue: https://github.com/elastic/elasticsearch/issues/128717
522492
- class: org.elasticsearch.compute.operator.LimitOperatorTests
523493
method: testEarlyTermination
524494
issue: https://github.com/elastic/elasticsearch/issues/128721

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,15 @@ private static void casesForString(
9494
return new TextAndPattern(text, escapeString.apply(text));
9595
}, true);
9696
cases(cases, title + " matches self case insensitive", () -> {
97-
String text = textSupplier.get();
98-
return new TextAndPattern(randomCasing(text), escapeString.apply(text));
97+
// RegExp doesn't support case-insensitive matching for Unicodes whose length changes when the case changes.
98+
// Example: a case-insensitive ES regexp query for the pattern `weiß` won't match the value `WEISS` (but will match `WEIß`).
99+
// Or `ʼn` (U+0149) vs. `ʼN` (U+02BC U+004E).
100+
String text, caseChanged;
101+
for (text = textSupplier.get(), caseChanged = randomCasing(text); text.length() != caseChanged.length();) {
102+
text = textSupplier.get();
103+
caseChanged = randomCasing(text);
104+
}
105+
return new TextAndPattern(caseChanged, escapeString.apply(text));
99106
}, true, true);
100107
cases(cases, title + " doesn't match self with trailing", () -> {
101108
String text = textSupplier.get();

0 commit comments

Comments
 (0)