Skip to content

Commit 3a2862d

Browse files
disable ReplaceStringCasingWithInsensitiveRegexMatch rule in 8.19 (#131387)
This PR disables the ReplaceStringCasingWithInsensitiveRegexMatch rule for 8.19, originally added with #128919 This is due to Lucene missing support for Unicode CASE_INSENSITIVE automation. If we allow the pushdown, we end up with wrong data in the vase majority of the cases when Unicode characters are involved. #131386 is logged for a complete fix and to reenable the change
1 parent ce31807 commit 3a2862d

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

docs/changelog/131387.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 131387
2+
summary: Disable `ReplaceStringCasingWithInsensitiveRegexMatch` rule in 8.19
3+
area: ES|QL
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,4 +411,4 @@ tests:
411411
issue: https://github.com/elastic/elasticsearch/issues/126085
412412
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
413413
method: test {yaml=reference/search/retriever/line_906}
414-
issue: https://github.com/elastic/elasticsearch/issues/131041
414+
issue: https://github.com/elastic/elasticsearch/issues/131041

x-pack/plugin/esql/qa/testFixtures/src/main/resources/where-like.csv-spec

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,3 +874,16 @@ emp_no:integer |first_name:keyword
874874
10001 |Georgi
875875
10055 |Georgy
876876
;
877+
878+
rlikeWithLowerTurnedInsensitiveUnicode#[skip:-8.12.99]
879+
FROM airport_city_boundaries
880+
| WHERE TO_UPPER(region) RLIKE ".*Л.*" and abbrev == "FRU"
881+
| KEEP region
882+
| LIMIT 1
883+
;
884+
885+
region:text
886+
Свердлов району
887+
;
888+
889+

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LocalLogicalPlanOptimizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateEmptyRelation;
1111
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceStatsFilteredAggWithEval;
12-
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceStringCasingWithInsensitiveRegexMatch;
1312
import org.elasticsearch.xpack.esql.optimizer.rules.logical.local.InferIsNotNull;
1413
import org.elasticsearch.xpack.esql.optimizer.rules.logical.local.InferNonNullAggConstraint;
1514
import org.elasticsearch.xpack.esql.optimizer.rules.logical.local.LocalPropagateEmptyRelation;
@@ -75,7 +74,8 @@ private static Batch<LogicalPlan> localOperators() {
7574
}
7675

7776
// add rule that should only apply locally
78-
newRules.add(new ReplaceStringCasingWithInsensitiveRegexMatch());
77+
// Waiting on https://github.com/elastic/elasticsearch/issues/131386
78+
// newRules.add(new ReplaceStringCasingWithInsensitiveRegexMatch());
7979

8080
return operators.with(newRules.toArray(Rule[]::new));
8181
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LocalLogicalPlanOptimizerTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ public void testIsNotNullOnCase_With_IS_NULL() {
646646
* \_Filter[RLIKE(first_name{f}#4, "VALÜ*", true)]
647647
* \_EsRelation[test][_meta_field{f}#9, emp_no{f}#3, first_name{f}#4, gen..]
648648
*/
649+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
649650
public void testReplaceUpperStringCasinqgWithInsensitiveRLike() {
650651
var plan = localPlan("FROM test | WHERE TO_UPPER(TO_LOWER(TO_UPPER(first_name))) RLIKE \"VALÜ*\"");
651652

@@ -660,6 +661,7 @@ public void testReplaceUpperStringCasinqgWithInsensitiveRLike() {
660661
}
661662

662663
// same plan as above, but lower case pattern
664+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
663665
public void testReplaceLowerStringCasingWithInsensitiveRLike() {
664666
var plan = localPlan("FROM test | WHERE TO_LOWER(TO_UPPER(first_name)) RLIKE \"valü*\"");
665667

@@ -677,6 +679,7 @@ public void testReplaceLowerStringCasingWithInsensitiveRLike() {
677679
* LocalRelation[[_meta_field{f}#9, emp_no{f}#3, first_name{f}#4, gender{f}#5, hire_date{f}#10, job{f}#11, job.raw{f}#12, langu
678680
* ages{f}#6, last_name{f}#7, long_noidx{f}#13, salary{f}#8],EMPTY]
679681
*/
682+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
680683
public void testReplaceStringCasingAndRLikeWithLocalRelation() {
681684
var plan = localPlan("FROM test | WHERE TO_LOWER(TO_UPPER(first_name)) RLIKE \"VALÜ*\"");
682685

@@ -685,6 +688,7 @@ public void testReplaceStringCasingAndRLikeWithLocalRelation() {
685688
}
686689

687690
// same plan as in testReplaceUpperStringCasingWithInsensitiveRLike, but with LIKE instead of RLIKE
691+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
688692
public void testReplaceUpperStringCasingWithInsensitiveLike() {
689693
var plan = localPlan("FROM test | WHERE TO_UPPER(TO_LOWER(TO_UPPER(first_name))) LIKE \"VALÜ*\"");
690694

@@ -699,6 +703,7 @@ public void testReplaceUpperStringCasingWithInsensitiveLike() {
699703
}
700704

701705
// same plan as above, but lower case pattern
706+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
702707
public void testReplaceLowerStringCasingWithInsensitiveLike() {
703708
var plan = localPlan("FROM test | WHERE TO_LOWER(TO_UPPER(first_name)) LIKE \"valü*\"");
704709

@@ -716,6 +721,7 @@ public void testReplaceLowerStringCasingWithInsensitiveLike() {
716721
* LocalRelation[[_meta_field{f}#9, emp_no{f}#3, first_name{f}#4, gender{f}#5, hire_date{f}#10, job{f}#11, job.raw{f}#12, langu
717722
* ages{f}#6, last_name{f}#7, long_noidx{f}#13, salary{f}#8],EMPTY]
718723
*/
724+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
719725
public void testReplaceStringCasingAndLikeWithLocalRelation() {
720726
var plan = localPlan("FROM test | WHERE TO_LOWER(TO_UPPER(first_name)) LIKE \"VALÜ*\"");
721727

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/PhysicalPlanOptimizerTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,7 @@ private void doTestPushDownCaseChangeRegexMatch(String query, String expected) {
22302230
assertThat(stripThrough(singleValue.toString()), is(stripThrough(expected)));
22312231
}
22322232

2233+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
22332234
public void testPushDownLowerCaseChangeRLike() {
22342235
doTestPushDownCaseChangeRegexMatch("""
22352236
FROM test
@@ -2255,6 +2256,7 @@ public void testPushDownLowerCaseChangeRLike() {
22552256
""");
22562257
}
22572258

2259+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
22582260
public void testPushDownUpperCaseChangeRLike() {
22592261
doTestPushDownCaseChangeRegexMatch("""
22602262
FROM test
@@ -2280,6 +2282,7 @@ public void testPushDownUpperCaseChangeRLike() {
22802282
""");
22812283
}
22822284

2285+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
22832286
public void testPushDownLowerCaseChangeLike() {
22842287
doTestPushDownCaseChangeRegexMatch("""
22852288
FROM test
@@ -2303,6 +2306,7 @@ public void testPushDownLowerCaseChangeLike() {
23032306
""");
23042307
}
23052308

2309+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
23062310
public void testPushDownUpperCaseChangeLike() {
23072311
doTestPushDownCaseChangeRegexMatch("""
23082312
FROM test
@@ -2338,6 +2342,7 @@ public void testPushDownUpperCaseChangeLike() {
23382342
* \_FieldExtractExec[first_name{f}#5, emp_no{f}#4]&lt;[],[]&gt;
23392343
* \_EsQueryExec[test], indexMode[standard], query[][_doc{f}#26], limit[], sort[] estimatedRowSize[332]
23402344
*/
2345+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/131041")
23412346
public void testChangeCaseAsInsensitiveWildcardLikeNotPushedDown() {
23422347
var esql = """
23432348
FROM test

0 commit comments

Comments
 (0)