Skip to content

Fixes #30677: Keep topic schema order explicitly and restore the Name sort on reload - #37902

Merged
Rohit0301 merged 1 commit into
mainfrom
Rohit0301/30677-topic-schema-sort-followup
Nov 16, 2026
Merged

Rohit0301 merged 1 commit into
mainfrom
Rohit0301/30677-topic-schema-sort-followup

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #30677

Follow-up to #37862 (merged). It fixes two review findings raised on the 2.1 backport #37900, which carries the same commit:

  • Schema order no longer depends on a tie. /columns sorts by name by default, and Fixes #30677: Paginate topic schema fields from the server #37862 kept stored order by sending sortBy=ordinalPosition. That only worked because topic fields have no ordinal position, so every field tied under a stable sort. Both topic field endpoints (/columns and /columns/search) now accept sortBy=schema, which skips sorting. The Schema tab always sends sortBy=schema or sortBy=name. The /columns default stays name for existing API clients.
  • The Name sort survives a reload. The page number was kept in the URL but the sort wasn't, so reloading page 2 sorted descending returned page 2 in schema order. The sort now lives in the URL as fieldSort=asc|desc, next to the page and columnSearch.

ADR:2026-11-16-topic-schema-field-search-returns-flat-rows gets a v2 amendment recording the rule.

Type of change:

  • Bug fix

High-level design:

N/A — small change. TopicResource maps sortBy=schema to "no sort" before paging (the shared ChildFieldPageReader already keeps stored order for a null sortBy). In the UI, topicsAPI.ts always sends an explicit sort, and TopicSchema.tsx reads the Name sort from useTableFilters (fieldSort). Allowed values live in TopicSchema.constants.ts.

Tests:

Use cases covered

  • /columns?sortBy=schema returns stored order; the default still sorts by name.
  • Reloading a sorted page restores the sort, along with the page and search.

Unit tests

  • Jest: TopicSchema.test.tsx — 16 passed (new: restores the name sort from the URL on reload; the server-sort click test is updated).
  • tsc is clean for the changed files, and the CI formatter sequence leaves no diff.

Backend integration tests

  • TopicResourceIT.schemaFieldPage_schemaSortKeepsStoredOrder replaces the ordinalPosition test. It asserts stored order with sortBy=schema and name order with no sortBy.

Ran locally on main (mysql-elasticsearch, parallel lane): mvn -B verify -pl :openmetadata-integration-tests -am -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=TopicResourceIT → PASSED — 260 tests, 0 failures, 0 errors, 21 skipped. The same suite passed on 2.1 for #37900.

Not run locally (pending, merge queue): the rest of the impacted plan.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

Not run locally (merge queue).

Visual regression baselines

  • Not applicable (no rendering change).

Manual testing performed

Covered by the integration and Jest tests above. The UI change is limited to which sort param is sent and where the Name sort is stored.

UI screen recording:

Not applicable: this fixes sort parameters and URL state on the feature recorded in #37862.

Checklist:

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Makes topic field ordering explicit and keeps the Name sort after reload.

  • Topic fields keep schema order unless you choose Name sorting.
  • The Name sort survives a reload.

Reviews (1) · Last reviewed commit: "Keep topic schema order explicitly and r..." · Reviewed by Greptile

- Topic field endpoints accept sortBy=schema to return fields in stored order;
  the Schema tab sends it instead of relying on ordinalPosition ties.
- The Name sort is kept in the URL (fieldSort) with the page and search, so a
  reload returns the same rows.
- Amend ADR:2026-11-16-topic-schema-field-search-returns-flat-rows (v2).

(cherry picked from commit 40c215a)
@Rohit0301
Rohit0301 requested review from a team as code owners November 16, 2026 13:45
@Rohit0301 Rohit0301 added UI UI specific issues backend labels Nov 16, 2026
@Rohit0301
Rohit0301 requested a review from yan-3005 November 16, 2026 13:45
@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Nov 16, 2026
@gitar-bot

gitar-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Explicit schema sorting changes topic field order before pagination; a mismatch could show fields on the wrong page or in an unintended order.

Topic schema field endpoints now accept sortBy=schema to keep stored field order explicitly, and the Schema tab persists the Name sort in the URL as fieldSort so it survives a reload. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Rohit0301
Rohit0301 enabled auto-merge (squash) November 16, 2026 13:57
@Rohit0301
Rohit0301 merged commit 6c886d3 into main Nov 16, 2026
58 of 59 checks passed
@Rohit0301
Rohit0301 deleted the Rohit0301/30677-topic-schema-sort-followup branch November 16, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination support for Kafka topic schema

3 participants