Skip to content

[Lens] [ES|QL] Add helper to map the value to the corresponding column#261581

Merged
mariairiartef merged 13 commits intoelastic:mainfrom
mariairiartef:lens-esql/fix-esql-query-results
Apr 20, 2026
Merged

[Lens] [ES|QL] Add helper to map the value to the corresponding column#261581
mariairiartef merged 13 commits intoelastic:mainfrom
mariairiartef:lens-esql/fix-esql-query-results

Conversation

@mariairiartef
Copy link
Copy Markdown
Contributor

@mariairiartef mariairiartef commented Apr 7, 2026

Summary

Fix #261912

Adds helper to match the values to the columns displayed.

After

Screenshot 2026-04-16 at 11 50 51

Checklist

@mariairiartef mariairiartef changed the title Add helper to map the value to the corresponding column [Lens] [ES|QL] Add helper to map the value to the corresponding column Apr 8, 2026
@mariairiartef mariairiartef added the Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// label Apr 8, 2026
@mariairiartef mariairiartef self-assigned this Apr 8, 2026
@mariairiartef mariairiartef added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels Feature:Lens labels Apr 8, 2026
@mariairiartef mariairiartef marked this pull request as ready for review April 13, 2026 15:54
@mariairiartef mariairiartef requested a review from a team as a code owner April 13, 2026 15:54
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@mariairiartef mariairiartef marked this pull request as draft April 15, 2026 09:39
Comment thread src/platform/plugins/shared/data/common/search/expressions/esql.ts Outdated
@elastic elastic deleted a comment from elasticmachine Apr 16, 2026
@mariairiartef mariairiartef force-pushed the lens-esql/fix-esql-query-results branch from 3e866ab to 8f7db61 Compare April 16, 2026 09:47
@mariairiartef
Copy link
Copy Markdown
Contributor Author

/ci

@mariairiartef mariairiartef marked this pull request as ready for review April 16, 2026 12:35
@mariairiartef mariairiartef requested a review from markov00 April 17, 2026 07:57
Copy link
Copy Markdown
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM. Reproduced the original issue on main, verified this PR fixes it. Added some suggestions but no blockers.

return values;
}

return values.map((row) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I played around with a small improvement on this:

  // Pre-compute which value column index each display column maps to (-1 if missing)
  const indexMap = displayColumns.map((col) => valueColumns.findIndex((v) => v.name === col.name));

  // For each row, pick values by index; fill null for columns with no data
  return values.map((row) => indexMap.map((i) => (i >= 0 ? row[i] : null)));

Instead of byName on each row, it will create indexMap only once and reuse it. Can you tell if this might work or do we need to consider the actual row each time? The above at least passes the new tests you created :).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I think it makes sense, applied you suggestion here

@mariairiartef mariairiartef enabled auto-merge (squash) April 20, 2026 13:39
@mariairiartef mariairiartef merged commit ba7931f into elastic:main Apr 20, 2026
18 checks passed
@kibanamachine kibanamachine added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels labels Apr 20, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

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 2.0MB 2.0MB +298.0B

History

cc @mariairiartef

justinkambic added a commit to justinkambic/kibana that referenced this pull request Apr 20, 2026
The lens entry bundle was 72-83B over its 86,000B page-load limit after
rebasing this branch on main. Nothing in this PR's scope
(kbn-unified-chart-section-viewer + one Discover test spec) can reach
lens's bundle — a codebase-wide grep shows zero imports of
@kbn/unified-chart-section-viewer from x-pack/platform/plugins/shared/lens,
and a local dist build's stats.json contains no matching module paths.

Cumulative drift from recent Lens-as-code commits that merged into main
(e.g., elastic#262871, elastic#264134, elastic#261581, elastic#264147, elastic#263810) pushed the entry
bundle just over the line. Raising the limit here is the documented
path when no in-PR contribution is found.

Limit set via `node scripts/build_kibana_platform_plugins --focus lens --update-limits`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens] [ES|QL] ES|QL query results don't appear correctly

5 participants