Change error message for comp against fields (#57126)

Change the error message wording for comparisons against fields in
filtering (s/variables/fields).

(cherry picked from commit d9a1cb50940d0a98fd75b9c0123ca6e1d862f65d)
This commit is contained in:
Bogdan Pintea 2020-05-26 10:15:58 +02:00
parent 0c379e334a
commit 74b2c8a770
6 changed files with 7 additions and 7 deletions

View File

@ -811,7 +811,7 @@ expected_event_ids = [82]
query = "file where serial_event_id / 2 == 41"
[[queries]]
# Error: Line 1:42: Comparisons against variables are not (currently) supported; offender [serial_event_id] in [==]
# Error: Line 1:42: Comparisons against fields are not (currently) supported; offender [serial_event_id] in [==]
query = '''
process where modulo(11, add(serial_event_id, 1)) == serial_event_id'''
expected_event_ids = [1, 2, 3, 5, 11]

View File

@ -188,14 +188,14 @@ public class QueryFolderFailTests extends AbstractQueryFolderTestCase {
QlIllegalArgumentException e = expectThrows(QlIllegalArgumentException.class,
() -> plan("process where (serial_event_id<9 and serial_event_id >= 7) or (opcode == pid)"));
String msg = e.getMessage();
assertEquals("Line 1:74: Comparisons against variables are not (currently) supported; offender [pid] in [==]", msg);
assertEquals("Line 1:74: Comparisons against fields are not (currently) supported; offender [pid] in [==]", msg);
}
public void testPropertyEquationInClauseFilterUnsupported() {
VerificationException e = expectThrows(VerificationException.class,
() -> plan("process where opcode in (1,3) and process_name in (parent_process_name, \"SYSTEM\")"));
String msg = e.getMessage();
assertEquals("Found 1 problem\nline 1:35: Comparisons against variables are not (currently) supported; " +
assertEquals("Found 1 problem\nline 1:35: Comparisons against fields are not (currently) supported; " +
"offender [parent_process_name] in [process_name in (parent_process_name, \"SYSTEM\")]", msg);
}

View File

@ -129,7 +129,7 @@ public class In extends ScalarFunction {
for (Expression ex : list) {
if (ex.foldable() == false) {
return new TypeResolution(format(null, "Comparisons against variables are not (currently) supported; offender [{}] in [{}]",
return new TypeResolution(format(null, "Comparisons against fields are not (currently) supported; offender [{}] in [{}]",
Expressions.name(ex),
sourceText()));
}

View File

@ -217,7 +217,7 @@ public final class ExpressionTranslators {
public static void checkBinaryComparison(BinaryComparison bc) {
Check.isTrue(bc.right().foldable(),
"Line {}:{}: Comparisons against variables are not (currently) supported; offender [{}] in [{}]",
"Line {}:{}: Comparisons against fields are not (currently) supported; offender [{}] in [{}]",
bc.right().sourceLocation().getLineNumber(), bc.right().sourceLocation().getColumnNumber(),
Expressions.name(bc.right()), bc.symbol());
}

View File

@ -654,7 +654,7 @@ public class VerifierErrorMessagesTests extends ESTestCase {
}
public void testInWithFieldInListOfValues() {
assertEquals("1:26: Comparisons against variables are not (currently) supported; offender [int] in [int IN (1, int)]",
assertEquals("1:26: Comparisons against fields are not (currently) supported; offender [int] in [int IN (1, int)]",
error("SELECT * FROM test WHERE int IN (1, int)"));
}

View File

@ -254,7 +254,7 @@ public class QueryTranslatorTests extends ESTestCase {
assertTrue(p instanceof Filter);
Expression condition = ((Filter) p).condition();
QlIllegalArgumentException ex = expectThrows(QlIllegalArgumentException.class, () -> translate(condition));
assertEquals("Line 1:43: Comparisons against variables are not (currently) supported; offender [int] in [>]", ex.getMessage());
assertEquals("Line 1:43: Comparisons against fields are not (currently) supported; offender [int] in [>]", ex.getMessage());
}
public void testDateRange() {