Skip to content

Pivot table zero sort - #8976

Closed
ericokuma wants to merge 1 commit into
mainfrom
cursor/ENG-1038-pivot-table-zero-sort-31d6
Closed

Pivot table zero sort#8976
ericokuma wants to merge 1 commit into
mainfrom
cursor/ENG-1038-pivot-table-zero-sort-31d6

Conversation

@ericokuma

Copy link
Copy Markdown
Contributor

Fixes ENG-1038 by ensuring numeric-like dimension values in pivot table column axes are sorted numerically (e.g., 0 appears before 1, not between 5 and 6).

Previously, these values were treated as strings, leading to incorrect ordering. This change introduces a utility to numerically sort column dimension axes only when all values are numeric-like, preserving existing behavior for categorical dimensions and row sorting.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Linear Issue: ENG-1038

Open in Web Open in Cursor 

Co-authored-by: ericokuma <ericokuma@users.noreply.github.com>
@cursor

cursor Bot commented Mar 4, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@nishantmonu51

Copy link
Copy Markdown
Collaborator

@djbarnwal : Please verify that we are honoring the data type returned by the aggregation API, If it returns string then lexicographical sorting, If a user explicity adds a CAST to number in a dimension, it should return a number and then UI should sort it numerically.

@nishantmonu51 nishantmonu51 added Type:Bug Something isn't working Area:Pivot Size:S Small change: under 100 lines labels Jun 30, 2026
@nishantmonu51

Copy link
Copy Markdown
Collaborator

Closing as stale. pivot-data-store.ts was rewritten by the #9538 staged-pipeline refactor, so most of the hunks here no longer apply.

The fix also belongs at a different layer. Re-sorting client-side over a result that was fetched top-100-by-measure-descending produces gapped orderings for dimensions with more than 100 values, and silently overrides measure ordering for any dimension whose values look numeric. The codebase already has the right pattern: time dimensions get a dimension-ascending sortBy in getAxisForDimensions (pivot-queries.ts). Worth keeping ENG-1038 open and redoing it there, sequenced after #9785's row-keying rewrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area:Pivot Size:S Small change: under 100 lines Type:Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants