Skip to content

Commit 07411e1

Browse files
committed
Drop useless proxy classes. Add insensitivity tests
1 parent fdcdcb9 commit 07411e1

File tree

28 files changed

+405
-322
lines changed

28 files changed

+405
-322
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import org.elasticsearch.xpack.esql.expression.function.scalar.math.RoundTo;
4949
import org.elasticsearch.xpack.esql.expression.function.scalar.multivalue.MvMin;
5050
import org.elasticsearch.xpack.esql.expression.function.scalar.nulls.Coalesce;
51-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
51+
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
5252
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToLower;
5353
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToUpper;
5454
import org.elasticsearch.xpack.esql.expression.predicate.operator.arithmetic.Add;

docs/reference/query-languages/esql/_snippets/functions/appendix/values.md

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/definition/functions/values.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/values.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLike.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/WildcardLike.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

x-pack/plugin/esql-core/src/test/java/org/elasticsearch/xpack/esql/core/util/TestUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.xpack.esql.core.type.DataType;
1414
import org.elasticsearch.xpack.esql.core.type.EsField;
1515

16+
import java.util.Locale;
1617
import java.util.regex.Pattern;
1718

1819
import static java.util.Collections.emptyMap;
@@ -61,4 +62,15 @@ public static FieldAttribute getFieldAttribute(String name, DataType dataType) {
6162
public static String stripThrough(String input) {
6263
return WS_PATTERN.matcher(input).replaceAll(StringUtils.EMPTY);
6364
}
65+
66+
/** Returns the input string, but with parts of it having the letter casing changed. */
67+
public static String randomCasing(String input) {
68+
StringBuilder sb = new StringBuilder(input.length());
69+
for (int i = 0, inputLen = input.length(), step = (int) Math.sqrt(inputLen), chunkEnd; i < inputLen; i += step) {
70+
chunkEnd = Math.min(i + step, inputLen);
71+
var chunk = input.substring(i, chunkEnd);
72+
sb.append(randomBoolean() ? chunk.toLowerCase(Locale.ROOT) : chunk.toUpperCase(Locale.ROOT));
73+
}
74+
return sb.toString();
75+
}
6476
}

x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/EsqlTestUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
import org.elasticsearch.xpack.esql.core.util.DateUtils;
6464
import org.elasticsearch.xpack.esql.core.util.StringUtils;
6565
import org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry;
66-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
67-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLike;
66+
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
67+
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLike;
6868
import org.elasticsearch.xpack.esql.expression.predicate.Range;
6969
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.Equals;
7070
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.GreaterThan;

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

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ emp_no:integer | job_positions:keyword
320320
10025 | Accountant
321321
;
322322

323-
likeWithUpper
323+
likeWithUpperTurnedInsensitive
324324
FROM employees
325325
| KEEP emp_no, first_name
326326
| SORT emp_no
@@ -332,7 +332,7 @@ emp_no:integer |first_name:keyword
332332
10055 |Georgy
333333
;
334334

335-
likeWithLower
335+
likeWithLowerTurnedInsensitive
336336
FROM employees
337337
| KEEP emp_no, first_name
338338
| SORT emp_no
@@ -344,7 +344,29 @@ emp_no:integer |first_name:keyword
344344
10055 |Georgy
345345
;
346346

347-
rlikeWithUpper
347+
likeWithLowerConflictingFolded
348+
FROM employees
349+
| KEEP emp_no, first_name
350+
| SORT emp_no
351+
| WHERE TO_UPPER(first_name) LIKE "geor*"
352+
;
353+
354+
emp_no:integer |first_name:keyword
355+
;
356+
357+
likeWithLowerTurnedInsensitiveNotPushedDown
358+
FROM employees
359+
| KEEP emp_no, first_name
360+
| SORT emp_no
361+
| WHERE TO_LOWER(first_name) LIKE "geor*" OR emp_no + 1 IN (10002, 10056)
362+
;
363+
364+
emp_no:integer |first_name:keyword
365+
10001 |Georgi
366+
10055 |Georgy
367+
;
368+
369+
rlikeWithUpperTurnedInsensitive
348370
FROM employees
349371
| KEEP emp_no, first_name
350372
| SORT emp_no
@@ -356,7 +378,7 @@ emp_no:integer |first_name:keyword
356378
10055 |Georgy
357379
;
358380

359-
rlikeWithLower
381+
rlikeWithLowerTurnedInsensitive
360382
FROM employees
361383
| KEEP emp_no, first_name
362384
| SORT emp_no
@@ -368,7 +390,17 @@ emp_no:integer |first_name:keyword
368390
10055 |Georgy
369391
;
370392

371-
negatedRLikeWithLower
393+
rlikeWithLowerConflictingFolded
394+
FROM employees
395+
| KEEP emp_no, first_name
396+
| SORT emp_no
397+
| WHERE TO_UPPER(first_name) RLIKE "geor.*"
398+
;
399+
400+
emp_no:integer |first_name:keyword
401+
;
402+
403+
negatedRLikeWithLowerTurnedInsensitive
372404
FROM employees
373405
| KEEP emp_no, first_name
374406
| SORT emp_no
@@ -379,3 +411,15 @@ FROM employees
379411
c:long
380412
88
381413
;
414+
415+
rlikeWithLowerTurnedInsensitiveNotPushedDown
416+
FROM employees
417+
| KEEP emp_no, first_name
418+
| SORT emp_no
419+
| WHERE TO_LOWER(first_name) RLIKE "geor.*" OR emp_no + 1 IN (10002, 10056)
420+
;
421+
422+
emp_no:integer |first_name:keyword
423+
10001 |Georgi
424+
10055 |Georgy
425+
;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/ExpressionWritables.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@
6868
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ByteLength;
6969
import org.elasticsearch.xpack.esql.expression.function.scalar.string.LTrim;
7070
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Length;
71-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
71+
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
7272
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RTrim;
7373
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Space;
7474
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Trim;
75-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLike;
75+
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLike;
7676
import org.elasticsearch.xpack.esql.expression.function.scalar.util.Delay;
7777
import org.elasticsearch.xpack.esql.expression.predicate.logical.Not;
7878
import org.elasticsearch.xpack.esql.expression.predicate.nulls.IsNotNull;

0 commit comments

Comments
 (0)