[ES|QL] Deep check if CHANGE_POINT ON option has any contents#216093
[ES|QL] Deep check if CHANGE_POINT ON option has any contents#216093vadimkibana merged 2 commits intoelastic:mainfrom
CHANGE_POINT ON option has any contents#216093Conversation
|
Pinging @elastic/kibana-esql (Team:ESQL) |
💚 Build Succeeded
Metrics [docs]Page load bundle
|
|
@darnautov can you take this code review? |
| command.args.push(value); | ||
|
|
||
| if (ctx._key) { | ||
| if (ctx._key && ctx._key.getText()) { |
There was a problem hiding this comment.
❓ do we need the same check with getText for ctx._targetType && ctx._targetPvalue?
There was a problem hiding this comment.
No. If it was only ctx._targetType we would need the check but because it is ctx._targetType && ctx._targetPvalue we don't need it. ANTLR does not generate an empty identifier for pvalue, only for target.
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/14103787549 |
…astic#216093) ## Summary When `ON` option in `CHANGE_POINT` has no value, it is invalid syntax according ANTLR grammar. However, ANTLR does not fail but succeeds and returns a column name, which is an empty string. Hence, in the past we created an `ON` option with an empty column name, but marked as `incomplete: true`, beucause ANTLR at least told us that. <img width="295" alt="Screenshot 2025-03-26 at 18 13 32" src="https://github.com/user-attachments/assets/b5fd4512-04a2-48b3-b874-1ea35a3c7e84" /> All of the above, IMO, relies on the ANTLR's behavior of trying to parse even invalid input, and mark some nodes with exception. This behavior is somewhat a "black box", not something we should rely on, as ANTLR will be able to parse or not invalid input depending on the complexity of the grammar rule at hand, and the rules themselves change over time. Hence, better and more consistent, to not mark nodes as `incomplete` but not generate the `ON` option altogether. This PR does a deep check, simple string check, to see if there is anything in the `ON` option at all, if not, it does not generate it. ### Checklist - [x] [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 (cherry picked from commit f7d8bc3)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…ts (#216093) (#216136) # Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Deep check if `CHANGE_POINT` `ON` option has any contents (#216093)](#216093) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Vadim Kibana","email":"82822460+vadimkibana@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-27T09:59:48Z","message":"[ES|QL] Deep check if `CHANGE_POINT` `ON` option has any contents (#216093)\n\n## Summary\n\nWhen `ON` option in `CHANGE_POINT` has no value, it is invalid syntax\naccording ANTLR grammar. However, ANTLR does not fail but succeeds and\nreturns a column name, which is an empty string.\n\nHence, in the past we created an `ON` option with an empty column name,\nbut marked as `incomplete: true`, beucause ANTLR at least told us that.\n\n<img width=\"295\" alt=\"Screenshot 2025-03-26 at 18 13 32\"\nsrc=\"https://github.com/user-attachments/assets/b5fd4512-04a2-48b3-b874-1ea35a3c7e84\"\n/>\n\nAll of the above, IMO, relies on the ANTLR's behavior of trying to parse\neven invalid input, and mark some nodes with exception. This behavior is\nsomewhat a \"black box\", not something we should rely on, as ANTLR will\nbe able to parse or not invalid input depending on the complexity of the\ngrammar rule at hand, and the rules themselves change over time.\n\nHence, better and more consistent, to not mark nodes as `incomplete` but\nnot generate the `ON` option altogether. This PR does a deep check,\nsimple string check, to see if there is anything in the `ON` option at\nall, if not, it does not generate it.\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"f7d8bc3c25663ebd5e473087790e3a53c4901548","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","review","release_note:skip","Feature:ES|QL","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL] Deep check if `CHANGE_POINT` `ON` option has any contents","number":216093,"url":"https://github.com/elastic/kibana/pull/216093","mergeCommit":{"message":"[ES|QL] Deep check if `CHANGE_POINT` `ON` option has any contents (#216093)\n\n## Summary\n\nWhen `ON` option in `CHANGE_POINT` has no value, it is invalid syntax\naccording ANTLR grammar. However, ANTLR does not fail but succeeds and\nreturns a column name, which is an empty string.\n\nHence, in the past we created an `ON` option with an empty column name,\nbut marked as `incomplete: true`, beucause ANTLR at least told us that.\n\n<img width=\"295\" alt=\"Screenshot 2025-03-26 at 18 13 32\"\nsrc=\"https://github.com/user-attachments/assets/b5fd4512-04a2-48b3-b874-1ea35a3c7e84\"\n/>\n\nAll of the above, IMO, relies on the ANTLR's behavior of trying to parse\neven invalid input, and mark some nodes with exception. This behavior is\nsomewhat a \"black box\", not something we should rely on, as ANTLR will\nbe able to parse or not invalid input depending on the complexity of the\ngrammar rule at hand, and the rules themselves change over time.\n\nHence, better and more consistent, to not mark nodes as `incomplete` but\nnot generate the `ON` option altogether. This PR does a deep check,\nsimple string check, to see if there is anything in the `ON` option at\nall, if not, it does not generate it.\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"f7d8bc3c25663ebd5e473087790e3a53c4901548"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216093","number":216093,"mergeCommit":{"message":"[ES|QL] Deep check if `CHANGE_POINT` `ON` option has any contents (#216093)\n\n## Summary\n\nWhen `ON` option in `CHANGE_POINT` has no value, it is invalid syntax\naccording ANTLR grammar. However, ANTLR does not fail but succeeds and\nreturns a column name, which is an empty string.\n\nHence, in the past we created an `ON` option with an empty column name,\nbut marked as `incomplete: true`, beucause ANTLR at least told us that.\n\n<img width=\"295\" alt=\"Screenshot 2025-03-26 at 18 13 32\"\nsrc=\"https://github.com/user-attachments/assets/b5fd4512-04a2-48b3-b874-1ea35a3c7e84\"\n/>\n\nAll of the above, IMO, relies on the ANTLR's behavior of trying to parse\neven invalid input, and mark some nodes with exception. This behavior is\nsomewhat a \"black box\", not something we should rely on, as ANTLR will\nbe able to parse or not invalid input depending on the complexity of the\ngrammar rule at hand, and the rules themselves change over time.\n\nHence, better and more consistent, to not mark nodes as `incomplete` but\nnot generate the `ON` option altogether. This PR does a deep check,\nsimple string check, to see if there is anything in the `ON` option at\nall, if not, it does not generate it.\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"f7d8bc3c25663ebd5e473087790e3a53c4901548"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
…astic#216093) ## Summary When `ON` option in `CHANGE_POINT` has no value, it is invalid syntax according ANTLR grammar. However, ANTLR does not fail but succeeds and returns a column name, which is an empty string. Hence, in the past we created an `ON` option with an empty column name, but marked as `incomplete: true`, beucause ANTLR at least told us that. <img width="295" alt="Screenshot 2025-03-26 at 18 13 32" src="https://github.com/user-attachments/assets/b5fd4512-04a2-48b3-b874-1ea35a3c7e84" /> All of the above, IMO, relies on the ANTLR's behavior of trying to parse even invalid input, and mark some nodes with exception. This behavior is somewhat a "black box", not something we should rely on, as ANTLR will be able to parse or not invalid input depending on the complexity of the grammar rule at hand, and the rules themselves change over time. Hence, better and more consistent, to not mark nodes as `incomplete` but not generate the `ON` option altogether. This PR does a deep check, simple string check, to see if there is anything in the `ON` option at all, if not, it does not generate it. ### Checklist - [x] [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
Summary
When
ONoption inCHANGE_POINThas no value, it is invalid syntax according ANTLR grammar. However, ANTLR does not fail but succeeds and returns a column name, which is an empty string.Hence, in the past we created an
ONoption with an empty column name, but marked asincomplete: true.All of the above, IMO, relies on the ANTLR's behavior of trying to parse even invalid input, and mark some nodes with exception. This behavior is somewhat a "black box", not something we should rely on, as ANTLR will be able to parse or not invalid input depending on the complexity of the grammar rule at hand, and the rules themselves change over time.
Hence, better and more consistent, to not mark nodes as
incompletebut not generate theONoption altogether. This PR does a deep check, simple string check, to see if there is anything in theONoption at all, if not, it does not generate it.Checklist