Skip to content

ESQL: Disable a bugged commit #127199

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 2 commits into from
Apr 23, 2025
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
6 changes: 6 additions & 0 deletions docs/changelog/127199.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 127199
summary: Disable a bugged commit
area: ES|QL
type: bug
issues:
- 127197
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,48 @@ public void testPushEqualityOnDefaults() throws IOException {
testPushQuery(value, """
FROM test
| WHERE test == "%value"
""", "#test.keyword:%value -_ignored:test.keyword", false);
""", "*:*", true, true);
}

public void testPushEqualityOnDefaultsTooBigToPush() throws IOException {
String value = "a".repeat(between(257, 1000));
testPushQuery(value, """
FROM test
| WHERE test == "%value"
""", "*:*", true);
""", "*:*", true, true);
}

public void testPushInequalityOnDefaults() throws IOException {
String value = "v".repeat(between(0, 256));
testPushQuery(value, """
FROM test
| WHERE test != "%different_value"
""", "*:*", true, true);
}

public void testPushInequalityOnDefaultsTooBigToPush() throws IOException {
String value = "a".repeat(between(257, 1000));
testPushQuery(value, """
FROM test
| WHERE test != "%value"
""", "*:*", true, false);
}

public void testPushCaseInsensitiveEqualityOnDefaults() throws IOException {
String value = "a".repeat(between(0, 256));
testPushQuery(value, """
FROM test
| WHERE TO_LOWER(test) == "%value"
""", "*:*", true);
""", "*:*", true, true);
}

private void testPushQuery(String value, String esqlQuery, String luceneQuery, boolean filterInCompute) throws IOException {
private void testPushQuery(String value, String esqlQuery, String luceneQuery, boolean filterInCompute, boolean found)
throws IOException {
indexValue(value);
String differentValue = randomValueOtherThan(value, () -> randomAlphaOfLength(value.length()));

RestEsqlTestCase.RequestObjectBuilder builder = requestObjectBuilder().query(
esqlQuery.replaceAll("%value", value) + "\n| KEEP test"
);
String replacedQuery = esqlQuery.replaceAll("%value", value).replaceAll("%different_value", differentValue);
RestEsqlTestCase.RequestObjectBuilder builder = requestObjectBuilder().query(replacedQuery + "\n| KEEP test");
builder.profile(true);
Map<String, Object> result = runEsql(builder, new AssertWarnings.NoWarnings(), RestEsqlTestCase.Mode.SYNC);
assertResultMap(
Expand All @@ -88,7 +105,7 @@ private void testPushQuery(String value, String esqlQuery, String luceneQuery, b
.entry("query", matchesMap().extraOk())
),
matchesList().item(matchesMap().entry("name", "test").entry("type", "text")),
equalTo(List.of(List.of(value)))
equalTo(found ? List.of(List.of(value)) : List.of())
);

@SuppressWarnings("unchecked")
Expand All @@ -100,7 +117,7 @@ private void testPushQuery(String value, String esqlQuery, String luceneQuery, b
@SuppressWarnings("unchecked")
List<Map<String, Object>> operators = (List<Map<String, Object>>) p.get("operators");
for (Map<String, Object> o : operators) {
sig.add(checkOperatorProfile(o, luceneQuery.replaceAll("%value", value)));
sig.add(checkOperatorProfile(o, luceneQuery.replaceAll("%value", value).replaceAll("%different_value", differentValue)));
}
String description = p.get("description").toString();
switch (description) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2332,3 +2332,40 @@ warning:Line 2:9: java.lang.IllegalArgumentException: single-value function enco
@timestamp:date | message:text
2023-10-23T13:55:01.546Z|More than one hundred characters long so it isn't indexed by the sub keyword field with ignore_above:100
;

mvStringNotEquals
FROM mv_text
| WHERE message != "Connected to 10.1.0.2"
| KEEP @timestamp, message
;
warning:Line 2:9: evaluation of [message != \"Connected to 10.1.0.2\"] failed, treating result as null. Only first 20 failures recorded.
warning:Line 2:9: java.lang.IllegalArgumentException: single-value function encountered multi-value

@timestamp:date | message:text
2023-10-23T13:55:01.544Z|Connected to 10.1.0.1
2023-10-23T13:55:01.546Z|More than one hundred characters long so it isn't indexed by the sub keyword field with ignore_above:100
;

mvStringNotEqualsFound
FROM mv_text
| WHERE message != "Connected to 10.1.0.1"
| KEEP @timestamp, message
;
warning:Line 2:9: evaluation of [message != \"Connected to 10.1.0.1\"] failed, treating result as null. Only first 20 failures recorded.
warning:Line 2:9: java.lang.IllegalArgumentException: single-value function encountered multi-value

@timestamp:date | message:text
2023-10-23T13:55:01.546Z|More than one hundred characters long so it isn't indexed by the sub keyword field with ignore_above:100
;

mvStringNotEqualsLong
FROM mv_text
| WHERE message != "More than one hundred characters long so it isn't indexed by the sub keyword field with ignore_above:100"
| KEEP @timestamp, message
;
warning:Line 2:9: evaluation of [message != \"More than one hundred characters long so it isn't indexed by the sub keyword field with ignore_above:100\"] failed, treating result as null. Only first 20 failures recorded.
warning:Line 2:9: java.lang.IllegalArgumentException: single-value function encountered multi-value

@timestamp:date | message:text
2023-10-23T13:55:01.544Z|Connected to 10.1.0.1
;
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public Equals(Source source, Expression left, Expression right, ZoneId zoneId) {
@Override
public boolean translatable(LucenePushdownPredicates pushdownPredicates) {
if (right() instanceof Literal lit) {
if (left().dataType() == DataType.TEXT && left() instanceof FieldAttribute fa) {
if (false && left().dataType() == DataType.TEXT && left() instanceof FieldAttribute fa) {
if (pushdownPredicates.canUseEqualityOnSyntheticSourceDelegate(fa, ((BytesRef) lit.value()).utf8ToString())) {
return true;
}
Expand All @@ -142,7 +142,8 @@ public boolean translatable(LucenePushdownPredicates pushdownPredicates) {
@Override
public Query asQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHandler handler) {
if (right() instanceof Literal lit) {
if (left().dataType() == DataType.TEXT && left() instanceof FieldAttribute fa) {
// Disabled because it cased a bug with !=. Fix incoming shortly.
if (false && left().dataType() == DataType.TEXT && left() instanceof FieldAttribute fa) {
String value = ((BytesRef) lit.value()).utf8ToString();
if (pushdownPredicates.canUseEqualityOnSyntheticSourceDelegate(fa, value)) {
String name = handler.nameOf(fa);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7793,6 +7793,7 @@ public void testReductionPlanForAggs() {
}

public void testEqualsPushdownToDelegate() {
assumeFalse("disabled from bug", true);
var optimized = optimizedPlan(physicalPlan("""
FROM test
| WHERE job == "v"
Expand Down
Loading