File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
main/java/org/elasticsearch/xpack/esql/expression/function/fulltext
test/java/org/elasticsearch/xpack/esql/analysis Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ public String functionName() {
132132
133133 private boolean isOperator () {
134134 if (isOperator == null ) {
135- isOperator = source ().text ().toUpperCase (Locale .ROOT ).startsWith ( super .functionName ()) == false ;
135+ isOperator = source ().text ().toUpperCase (Locale .ROOT ).matches ( "^" + super .functionName () + " \\ s* \\ (.* \\ )" ) == false ;
136136 }
137137 return isOperator ;
138138 }
Original file line number Diff line number Diff line change @@ -1145,6 +1145,19 @@ public void testMatchFunctionNotAllowedAfterCommands() throws Exception {
11451145 );
11461146 }
11471147
1148+ public void testMatchFunctionAndOperatorHaveCorrectErrorMessages () throws Exception {
1149+ assertEquals (
1150+ "1:24: [MATCH] function cannot be used after LIMIT" ,
1151+ error ("from test | limit 10 | where match(first_name, \" Anna\" )" )
1152+ );
1153+ assertEquals (
1154+ "1:24: [MATCH] function cannot be used after LIMIT" ,
1155+ error ("from test | limit 10 | where match ( first_name, \" Anna\" ) " )
1156+ );
1157+ assertEquals ("1:24: [:] operator cannot be used after LIMIT" , error ("from test | limit 10 | where first_name:\" Anna\" " ));
1158+ assertEquals ("1:24: [:] operator cannot be used after LIMIT" , error ("from test | limit 10 | where first_name : \" Anna\" " ));
1159+ }
1160+
11481161 public void testQueryStringFunctionsNotAllowedAfterCommands () throws Exception {
11491162 // Source commands
11501163 assertEquals ("1:13: [QSTR] function cannot be used after SHOW" , error ("show info | where qstr(\" 8.16.0\" )" ));
You can’t perform that action at this time.
0 commit comments