mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ES|QL] Fixes the wrong validation when a named param is used as function (#213355)
## Summary Fixes the bug described here https://github.com/elastic/kibana/issues/192255#issuecomment-2684125449 <img width="1094" alt="image" src="https://github.com/user-attachments/assets/69d4f004-6a66-416b-8aa6-e477b0380010" /> ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
209afbabfc
commit
4a8af4ca27
2 changed files with 3 additions and 1 deletions
|
@ -151,10 +151,11 @@ const statsValidator = (command: ESQLCommand) => {
|
|||
// * the agg function is at root level
|
||||
// * or if it's a operators function, then all operands are agg functions or literals
|
||||
// * or if it's a eval function then all arguments are agg functions or literals
|
||||
// * or if a named param is used
|
||||
function checkFunctionContent(arg: ESQLFunction) {
|
||||
// TODO the grouping function check may not
|
||||
// hold true for all future cases
|
||||
if (isAggFunction(arg)) {
|
||||
if (isAggFunction(arg) || isFunctionOperatorParam(arg)) {
|
||||
return true;
|
||||
}
|
||||
return (arg as ESQLFunction).args.every(
|
||||
|
|
|
@ -170,6 +170,7 @@ export const validationStatsCommandTestSuite = (setup: helpers.Setup) => {
|
|||
'from a_index | stats avg(doubleField), percentile(doubleField, 50) + 1 by ipField',
|
||||
[]
|
||||
);
|
||||
await expectErrors('from a_index | stats ?func(doubleField)', []);
|
||||
for (const op of ['+', '-', '*', '/', '%']) {
|
||||
await expectErrors(
|
||||
`from a_index | stats avg(doubleField) ${op} percentile(doubleField, 50) BY ipField`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue