Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [ES|QL] separate `STATS` autocomplete routine (#198224)…
… (#198693) # Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] separate `STATS` autocomplete routine (#198224)](#198224) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Drew Tate","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-01T15:11:05Z","message":"[ES|QL] separate `STATS` autocomplete routine (#198224)\n\n## Summary\r\n\r\nPart of https://github.com/elastic/kibana/issues/195418\r\n\r\nThis PR moves the `STATS` completion logic to its own home.\r\n\r\nThere are also a few changes in behavior. I am open for feedback on any\r\nof these.\r\n- the cursor is automatically advanced after accepting a comma\r\nsuggestion\r\n- variables from previous `EVAL` commands are no longer suggested (e.g.\r\n`...| EVAL foo = 1 | STATS /`). I'm not sure about this change, but it\r\nseemed potentially unintended to suggest variables but no other columns\r\nsuch as field names.\r\n- a new variable is suggested for new expressions in the `BY` clause.\r\nFormerly, new variables were only suggested in the `STATS` clause.\r\n- `+` and `-` are no longer suggested after a completed function call\r\nwithin an assignment in the `BY` clause (e.g. `... | STATS ... BY var1 =\r\nBUCKET(dateField, 1 day) /`. This behavior was encoded in our tests, but\r\nit feels unintended to me, especially since it only applied when the\r\nresult of the function was assigned to a new variable in the `BY`\r\nclause.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli <[email protected]>","sha":"7f2b56f0e687d466c20127d358d25a0456e51a03","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.17.0"],"title":"[ES|QL] separate `STATS` autocomplete routine","number":198224,"url":"https://github.com/elastic/kibana/pull/198224","mergeCommit":{"message":"[ES|QL] separate `STATS` autocomplete routine (#198224)\n\n## Summary\r\n\r\nPart of https://github.com/elastic/kibana/issues/195418\r\n\r\nThis PR moves the `STATS` completion logic to its own home.\r\n\r\nThere are also a few changes in behavior. I am open for feedback on any\r\nof these.\r\n- the cursor is automatically advanced after accepting a comma\r\nsuggestion\r\n- variables from previous `EVAL` commands are no longer suggested (e.g.\r\n`...| EVAL foo = 1 | STATS /`). I'm not sure about this change, but it\r\nseemed potentially unintended to suggest variables but no other columns\r\nsuch as field names.\r\n- a new variable is suggested for new expressions in the `BY` clause.\r\nFormerly, new variables were only suggested in the `STATS` clause.\r\n- `+` and `-` are no longer suggested after a completed function call\r\nwithin an assignment in the `BY` clause (e.g. `... | STATS ... BY var1 =\r\nBUCKET(dateField, 1 day) /`. This behavior was encoded in our tests, but\r\nit feels unintended to me, especially since it only applied when the\r\nresult of the function was assigned to a new variable in the `BY`\r\nclause.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli <[email protected]>","sha":"7f2b56f0e687d466c20127d358d25a0456e51a03"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198224","number":198224,"mergeCommit":{"message":"[ES|QL] separate `STATS` autocomplete routine (#198224)\n\n## Summary\r\n\r\nPart of https://github.com/elastic/kibana/issues/195418\r\n\r\nThis PR moves the `STATS` completion logic to its own home.\r\n\r\nThere are also a few changes in behavior. I am open for feedback on any\r\nof these.\r\n- the cursor is automatically advanced after accepting a comma\r\nsuggestion\r\n- variables from previous `EVAL` commands are no longer suggested (e.g.\r\n`...| EVAL foo = 1 | STATS /`). I'm not sure about this change, but it\r\nseemed potentially unintended to suggest variables but no other columns\r\nsuch as field names.\r\n- a new variable is suggested for new expressions in the `BY` clause.\r\nFormerly, new variables were only suggested in the `STATS` clause.\r\n- `+` and `-` are no longer suggested after a completed function call\r\nwithin an assignment in the `BY` clause (e.g. `... | STATS ... BY var1 =\r\nBUCKET(dateField, 1 day) /`. This behavior was encoded in our tests, but\r\nit feels unintended to me, especially since it only applied when the\r\nresult of the function was assigned to a new variable in the `BY`\r\nclause.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli <[email protected]>","sha":"7f2b56f0e687d466c20127d358d25a0456e51a03"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Drew Tate <[email protected]>
- Loading branch information