Skip to content

[Lens] Do not break when the table has no data#217937

Merged
stratoula merged 4 commits intoelastic:mainfrom
stratoula:fix-table-empty-data
Apr 15, 2025
Merged

[Lens] Do not break when the table has no data#217937
stratoula merged 4 commits intoelastic:mainfrom
stratoula:fix-table-empty-data

Conversation

@stratoula
Copy link
Contributor

@stratoula stratoula commented Apr 11, 2025

Summary

When the datatable comes with empty results the visualization fails with bad way

image

With the fix
image

How to replicate:

  • Create a field ES|QL control with 2 values (extension and geo.dest). You can do it with multiple ways. I created with typing FROM kibana_sample_data_logs | STATS count = COUNT(*) BY and then Create control.
  • Use the variable in another panel with query: FROM kibana_sample_data_logs | WHERE ??field == "css" | KEEP extension (The control value should be in the extension). This will work
  • Select the second field (geo.dest). This will return an empty query and will break the table viz.

Checklist

fixes #222848

@stratoula stratoula marked this pull request as ready for review April 11, 2025 09:29
@stratoula stratoula requested a review from a team as a code owner April 11, 2025 09:29
@stratoula stratoula added release_note:fix Feature:Lens Feature:ES|QL ES|QL related features in Kibana backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Apr 11, 2025
@stratoula
Copy link
Contributor Author

/ci

@markov00 markov00 self-requested a review April 14, 2025 16:06
Copy link
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely better then the "red" error, it fixes the error it self.
Do you think we can also just return undefined immediately if columnsReverseLookup[field] is undefined? just to avoid any other calculation and wrongly returned invalid data?

I actually reached this different screen instead of the no-data result, with a table that scrolls a lot without data in it.
The content of the control where geo.dest, extension and extension.keyword

Screenshot 2025-04-14 at 18 09 03
@stratoula
Copy link
Contributor Author

stratoula commented Apr 15, 2025

I actually reached this different screen instead of the no-data result, with a table that scrolls a lot without data in it.
The content of the control where geo.dest, extension and extension.keyword

In order to get into the no data screen you need to select in the control a different than the extension field. The geo.dest for example. Because in your query you filter with extension so this will return data but if you do where geo.dest == "css" this will return no data as there is no css destination. (check my 3rd step in the description)

@stratoula
Copy link
Contributor Author

Do you think we can also just return undefined immediately if columnsReverseLookup[field] is undefined? just to avoid any other calculation and wrongly returned invalid data?

We could, check here f0d2b74

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.4MB 1.4MB +29.0B

History

@stratoula stratoula merged commit fa2d391 into elastic:main Apr 15, 2025
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/14468903934

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 15, 2025
## Summary

When the datatable comes with empty results the visualization fails with
bad way

<img width="396" alt="image"
src="https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db"
/>

With the fix
<img width="756" alt="image"
src="https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7"
/>

How to replicate:

- Create a field ES|QL control with 2 values (extension and geo.dest).
You can do it with multiple ways. I created with typing `FROM
kibana_sample_data_logs | STATS count = COUNT(*) BY` and then `Create
control`.
- Use the variable in another panel with query: `FROM
kibana_sample_data_logs | WHERE ??field == "css" | KEEP extension` (The
control value should be in the extension). This will work
- Select the second field (geo.dest). This will return an empty query
and will break the table viz.

### 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 fa2d391)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 16, 2025
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] Do not break when the table has no data
(#217937)](#217937)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2025-04-15T12:03:09Z","message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\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":"fa2d3912f408326980241df394c51bd87074e21c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Lens","Feature:ES|QL","backport:version","v9.1.0","v8.19.0"],"title":"[Lens]
Do not break when the table has no
data","number":217937,"url":"https://github.com/elastic/kibana/pull/217937","mergeCommit":{"message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\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":"fa2d3912f408326980241df394c51bd87074e21c"}},"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/217937","number":217937,"mergeCommit":{"message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\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":"fa2d3912f408326980241df394c51bd87074e21c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
@stratoula
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

stratoula added a commit to stratoula/kibana that referenced this pull request Jun 11, 2025
## Summary

When the datatable comes with empty results the visualization fails with
bad way

<img width="396" alt="image"
src="https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db"
/>

With the fix
<img width="756" alt="image"
src="https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7"
/>

How to replicate:

- Create a field ES|QL control with 2 values (extension and geo.dest).
You can do it with multiple ways. I created with typing `FROM
kibana_sample_data_logs | STATS count = COUNT(*) BY` and then `Create
control`.
- Use the variable in another panel with query: `FROM
kibana_sample_data_logs | WHERE ??field == "css" | KEEP extension` (The
control value should be in the extension). This will work
- Select the second field (geo.dest). This will return an empty query
and will break the table viz.

### 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 fa2d391)
stratoula added a commit that referenced this pull request Jun 11, 2025
# Backport

This will backport the following commits from `main` to `9.0`:
- [[Lens] Do not break when the table has no data
(#217937)](#217937)

<!--- Backport version: 10.0.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2025-04-15T12:03:09Z","message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\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":"fa2d3912f408326980241df394c51bd87074e21c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Lens","Feature:ES|QL","backport:version","v9.1.0","v8.19.0"],"title":"[Lens]
Do not break when the table has no
data","number":217937,"url":"https://github.com/elastic/kibana/pull/217937","mergeCommit":{"message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\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":"fa2d3912f408326980241df394c51bd87074e21c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217937","number":217937,"mergeCommit":{"message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\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":"fa2d3912f408326980241df394c51bd87074e21c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218254","number":218254,"state":"MERGED","mergeCommit":{"sha":"d35ae396a663a340f859f5fb29ef98fff52fb8ca","message":"[8.x]
[Lens] Do not break when the table has no data (#217937) (#218254)\n\n#
Backport\n\nThis will backport the following commits from `main` to
`8.x`:\n- [[Lens] Do not break when the table has no
data\n(#217937)](https://github.com/elastic/kibana/pull/217937)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Stratoula Kalafateli <efstratia.kalafateli@elastic.co>"}}]}] BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:ES|QL ES|QL related features in Kibana Feature:Lens release_note:fix v8.19.0 v9.0.3 v9.1.0

4 participants