Skip to content

Fix table column tag hydration#27526

Open
PRADDZY wants to merge 1 commit intoopen-metadata:mainfrom
PRADDZY:hackathon/fix-table-column-tags
Open

Fix table column tag hydration#27526
PRADDZY wants to merge 1 commit intoopen-metadata:mainfrom
PRADDZY:hackathon/fix-table-column-tags

Conversation

@PRADDZY
Copy link
Copy Markdown

@PRADDZY PRADDZY commented Apr 19, 2026

Summary

  • Hydrate column-level tags whenever table columns are requested, even when top-level tags are not requested.
  • Keep top-level table tags gated behind fields=tags in bulk table reads.
  • Add regression coverage for single-table and bulk field hydration paths.

Fixes #27519

Validation

  • git diff --cached --check
  • gh pr checks 27522 --repo open-metadata/OpenMetadata as the current green Java-service CI baseline
  • Could not run mvn -pl openmetadata-service -Dtest=TableRepositoryColumnTagsTest test locally because mvn and java are not installed in this environment.

Copilot AI review requested due to automatic review settings April 19, 2026 15:36
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@PRADDZY
Copy link
Copy Markdown
Author

PRADDZY commented Apr 19, 2026

CI is blocked by the repository label gate. A maintainer needs to add the \safe to test\ label before the required checks can run past the label verification step.

@gitar-bot
Copy link
Copy Markdown

gitar-bot bot commented Apr 19, 2026

Code Review ✅ Approved

Refactors table column tag hydration to ensure accurate property mapping. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes missing column-level tag hydration for table reads when only fields=columns is requested, while keeping table-level tags gated behind fields=tags for bulk reads (per #27519).

Changes:

  • Hydrate column tags whenever columns are requested in single-table reads (setFields).
  • Update bulk hydration to fetch column tags when columns are requested, but only fetch table tags when tags are requested.
  • Add regression tests covering single-table and bulk hydration paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java Ensures column tag hydration runs when columns are requested; avoids bulk table-tag fetch unless tags is requested.
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TableRepositoryColumnTagsTest.java Adds regression coverage for column tag hydration in both single-entity and bulk paths.

Comment on lines +77 to +96
@Test
void setFieldsInBulk_hydratesColumnTagsWhenOnlyColumnsAreRequested() {
Table table = tableWithColumn("service.database.schema.users", "email");
TagLabel piiTag =
new TagLabel()
.withTagFQN("PII.Sensitive")
.withSource(TagSource.CLASSIFICATION)
.withLabelType(LabelType.MANUAL)
.withState(State.CONFIRMED);
String columnFqn = table.getColumns().getFirst().getFullyQualifiedName();

when(tagUsageDAO.getTagsInternalBatch(anyList()))
.thenReturn(List.of(tagUsage(columnFqn, piiTag)));

repository.setFieldsInBulk(
new Fields(repository.getAllowedFields(), "columns"), List.of(table));

assertNull(table.getTags());
assertColumnTags(table, piiTag);
}
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

In setFieldsInBulk_hydratesColumnTagsWhenOnlyColumnsAreRequested, assertNull(table.getTags()) doesn’t prove bulk table-level tags were not fetched, since clearFieldsInternal will null out table.tags whenever fields doesn’t include tags (even if they were loaded). To fully regression-test the “keep top-level tags gated behind fields=tags” behavior, add a Mockito verification that the tag DAO is only queried for the column FQN(s) (and not also for the table FQN) when Fields is just columns.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GET /tables/{id}?fields=columns returns empty tags arrays for all columns

2 participants