[Lens][Table] Fix filtering on tables with formula columns#239222
Merged
nickofthyme merged 1 commit intoelastic:mainfrom Oct 15, 2025
Merged
[Lens][Table] Fix filtering on tables with formula columns#239222nickofthyme merged 1 commit intoelastic:mainfrom
nickofthyme merged 1 commit intoelastic:mainfrom
Conversation
Contributor
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
Contributor
|
Starting backport for target branches: 8.18, 8.19, 9.1, 9.2 |
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 15, 2025
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 15, 2025
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 15, 2025
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 15, 2025
Contributor
💚 All backports created successfully
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
Oct 15, 2025
…9222) (#239234) # Backport This will backport the following commits from `main` to `9.1`: - [[Lens][Table] Fix filtering on tables with formula columns (#239222)](#239222) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-10-15T20:57:22Z","message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:all-open","v9.3.0"],"title":"[Lens][Table] Fix filtering on tables with formula columns","number":239222,"url":"https://github.com/elastic/kibana/pull/239222","mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/239222","number":239222,"mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
kibanamachine
added a commit
that referenced
this pull request
Oct 15, 2025
…9222) (#239235) # Backport This will backport the following commits from `main` to `9.2`: - [[Lens][Table] Fix filtering on tables with formula columns (#239222)](#239222) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-10-15T20:57:22Z","message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:all-open","v9.3.0"],"title":"[Lens][Table] Fix filtering on tables with formula columns","number":239222,"url":"https://github.com/elastic/kibana/pull/239222","mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/239222","number":239222,"mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
kibanamachine
added a commit
that referenced
this pull request
Oct 15, 2025
…39222) (#239233) # Backport This will backport the following commits from `main` to `8.19`: - [[Lens][Table] Fix filtering on tables with formula columns (#239222)](#239222) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-10-15T20:57:22Z","message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:all-open","v9.3.0"],"title":"[Lens][Table] Fix filtering on tables with formula columns","number":239222,"url":"https://github.com/elastic/kibana/pull/239222","mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/239222","number":239222,"mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
kibanamachine
added a commit
that referenced
this pull request
Oct 15, 2025
…39222) (#239232) # Backport This will backport the following commits from `main` to `8.18`: - [[Lens][Table] Fix filtering on tables with formula columns (#239222)](#239222) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-10-15T20:57:22Z","message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:all-open","v9.3.0"],"title":"[Lens][Table] Fix filtering on tables with formula columns","number":239222,"url":"https://github.com/elastic/kibana/pull/239222","mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/239222","number":239222,"mergeCommit":{"message":"[Lens][Table] Fix filtering on tables with formula columns (#239222)\n\n## Summary\n\nFixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.\n\n## Release Notes\n\nFixes a bug in the Lens Table that broke **click to filter** on table\nrows when any column is used as a formula.","sha":"b0bac3df208a70bda7509fb96709d24d78dd2aba"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
mgadewoll
pushed a commit
to tkajtoch/kibana
that referenced
this pull request
Oct 17, 2025
…39222) ## Summary Fixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula. ## Release Notes Fixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.
nickpeihl
pushed a commit
to nickpeihl/kibana
that referenced
this pull request
Oct 23, 2025
…39222) ## Summary Fixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula. ## Release Notes Fixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.
NicholasPeretti
pushed a commit
to NicholasPeretti/kibana
that referenced
this pull request
Oct 27, 2025
…39222) ## Summary Fixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula. ## Release Notes Fixes a bug in the Lens Table that broke **click to filter** on table rows when any column is used as a formula.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug in the Lens Table that broke click to filter on table rows when any column is used as a formula.
Zight.Recording.2025-10-15.at.01.31.51.PM.mp4
Fixes #239170
Details
In #236673 We added column sorting to export the correct order to csv. The issue is that the formula columns create ghost columns in the datatable used to build-up the real columns. These use the id
<colId>X<number>and are removed from the export so as long as the order of the real columns was correct it was fine.However, with filtering we use the
colIndexto define the column to filter.kibana/x-pack/platform/plugins/shared/lens/public/visualizations/datatable/components/table_actions.ts
Lines 83 to 102 in c8bccc3
With the non-bucketed (aka Metrics) columns, we a lookup table to map the column id to the meta data including the column index of the full table, including the ghost columns. This is why this filtering was not also broken.
kibana/x-pack/platform/plugins/shared/lens/public/visualizations/datatable/components/columns.tsx
Line 62 in c8bccc3
But with the bucketed columns (aka Rows), we determine the column index from the
columnConfigwith excludes the ghost columns. Hence the issue, we were sorting the ghost columns to the front of the array such that all the indices of the real columns would be offset by the number of ghost columns.All that said, a simple fix would be to just sort the real columns to the start of the array and leave unknown/ghost columns to the end as their order does not matter. Alternatively, we could create a lookup similar to above to lookup the index on the full table but I don't think that is necessary if we enforce the correct order.
Ideally, we filter by passing the
columnIdand not thecolIndex. In this way there is no ambiguity and thecreateGridFilterHandlerhas the table to lookup the correct index from thetable.columns. See #239224.Checklist
release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
Minimal as sorting is the only impact.
Release Notes
Fixes a bug in the Lens Table that broke click to filter on table rows when any column is used as a formula.