Skip to content

fix(column-bulk): make column grid sort null-safe (follow-up to #29699)#29752

Open
sonika-shah wants to merge 2 commits into
mainfrom
sonika/column-grid-sort-nullsafe
Open

fix(column-bulk): make column grid sort null-safe (follow-up to #29699)#29752
sonika-shah wants to merge 2 commits into
mainfrom
sonika/column-grid-sort-nullsafe

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #29699 — make the column grid sort null-safe

The alphabetical sort added in #29699 (ColumnMetadataGrouper.groupColumns) uses Comparator.comparing(ColumnGridItem::getColumnName, String.CASE_INSENSITIVE_ORDER), which throws a NullPointerException if a column name is null. Column names are realistically non-null (callers guard the map key), but the sort introduced a new failure mode that didn't exist before — a single malformed bucket with a null key would fail the whole column-grid request instead of returning the remaining results.

Fix

Wrap both key comparators in Comparator.nullsLast(...) so a null column name sorts last rather than crashing:

gridItems.sort(
    Comparator.comparing(
            ColumnGridItem::getColumnName, Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER))
        .thenComparing(
            ColumnGridItem::getColumnName, Comparator.nullsLast(Comparator.naturalOrder())));

Adds testGroupColumns_nullColumnNameSortsLastWithoutError covering the null case.

Verification

  • Backend build (openmetadata-service + deps) — BUILD SUCCESS.
  • ColumnMetadataGrouperTest — 11/11 pass.

Also applied to the 1.13 backport (#29751) so the two lines stay aligned.

Greptile Summary

This PR makes column-grid grouping handle malformed null column names safely.

  • Skips null column-name buckets before building grid rows.
  • Keeps the alphabetical grid sort null-safe.
  • Adds a test that null buckets are dropped while valid columns stay sorted.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/search/ColumnMetadataGrouper.java Skips malformed null column-name buckets and preserves deterministic sorting for returned grid rows.
openmetadata-service/src/test/java/org/openmetadata/service/search/ColumnMetadataGrouperTest.java Adds coverage for dropping a null column-name bucket without losing sorted valid results.

Reviews (2): Last reviewed commit: "fix(column-bulk): skip null-named column..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

Guard the column-name comparator with Comparator.nullsLast so a null
column name (e.g. a null map key) sorts last instead of throwing an NPE.
Adds a test covering the null case.
Copilot AI review requested due to automatic review settings July 5, 2026 18:32
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Jul 5, 2026

Copilot AI left a comment

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.

Pull request overview

Makes the column bulk-operations grid sorting in ColumnMetadataGrouper.groupColumns null-safe so malformed data (e.g., a null column-name key) doesn’t crash the whole request, while preserving deterministic alphabetical ordering.

Changes:

  • Wraps the primary (case-insensitive) and tie-breaker (natural) comparators with Comparator.nullsLast(...) to prevent NullPointerException during sorting.
  • Adds a unit test ensuring null column names sort last and do not throw.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
openmetadata-service/src/main/java/org/openmetadata/service/search/ColumnMetadataGrouper.java Updates the grid item comparator chain to be null-safe (nullsLast) while keeping existing ordering semantics.
openmetadata-service/src/test/java/org/openmetadata/service/search/ColumnMetadataGrouperTest.java Adds coverage for the null column-name scenario to prevent regressions.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (23 flaky)

✅ 4497 passed · ❌ 0 failed · 🟡 23 flaky · ⏭️ 37 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 439 0 4 16
🟡 Shard 2 819 0 5 8
🟡 Shard 3 799 0 2 7
🟡 Shard 4 814 0 1 5
🟡 Shard 5 857 0 6 0
🟡 Shard 6 769 0 5 1
🟡 23 flaky test(s) (passed on retry)
  • Features/Glossary/GlossaryPagination.spec.ts › should check for nested glossary term search (shard 1, 1 retry)
  • Pages/AISettings.spec.ts › persists MCP Chat configuration after save (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Database service (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Table (shard 2, 1 retry)
  • Features/ContextCenterDocumentPage.spec.ts › delete single document from card menu removes it from the list (shard 2, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with editAll permission can see restore action but not delete action on an archived document, and can restore it (shard 2, 1 retry)
  • Features/KnowledgeCenterTextEditor.spec.ts › Rich Text Editor - Text Formatting (shard 3, 1 retry)
  • Features/Tasks/TaskNavigation.spec.ts › navigating to /table/TASK-XXXXX should show 404 (invalid URL pattern) (shard 3, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Not_Set (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Description Add, Update and Remove for child entities (shard 5, 1 retry)
  • Pages/Entity.spec.ts › User as Owner Add, Update and Remove (shard 5, 1 retry)
  • Pages/Entity.spec.ts › User as Owner Add, Update and Remove (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Tier Add, Update and Remove (shard 5, 1 retry)
  • Pages/ExploreBrowse.spec.ts › service type drill-down disables unrelated roots and query-panel Clear resets it (shard 5, 2 retries)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Features/AutoPilot.spec.ts › Create Service and check the AutoPilot status (shard 6, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary CSV import rejects unknown relation type (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

…required field

A null column name (columnName is required in the column-grid response) is now
skipped when building rows, so a malformed bucket is dropped and the remaining
valid columns are returned. This also avoids the sort NPE at the source; the
comparator keeps nullsLast as a backstop. Test updated to assert the null-named
row is dropped.
@gitar-bot

gitar-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Wraps column grid sort comparators in nullsLast to prevent NullPointerExceptions and skips null-named columns. No issues found.

Options

Display: compact → Showing less information.

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

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants