Skip to content

Conversation

@sonika-shah
Copy link
Contributor

@sonika-shah sonika-shah commented Jan 13, 2026

Describe your changes:

Fixes #17323 #23269

Summary

Implements automatic domain assignment for Query entities based on the domains of entities referenced in the queryUsedIn field. Queries now inherit all unique domains
from their associated entities (tables, dashboards, etc.), similar to how Users and Teams support multiple domains.

Changes

Backend Changes

  1. Domain Rule Bypass (entityRulesSettings.json)

    • Added query to ignoredEntities for "Multiple Domains are not allowed" rule
    • Added query to ignoredEntities for "Data Product Domain Validation" rule
    • Enables queries to have multiple domains like Users and Teams
  2. Auto-Domain Computation (QueryRepository.java)

    • New method: computeDomainsFromQueryUsage() - Extracts unique domains from all entities in queryUsedIn
    • Updated: prepare() - Auto-computes and sets domains before storing
    • Updated: QueryUpdater.entitySpecificUpdate() - Recomputes domains when queryUsedIn changes
  3. Ignore Manual Assignments (QueryMapper.java)

    • Overrode copy() method to set domains = null
    • Ensures manual domain assignments in create/update requests are ignored
  4. API Schema Documentation (createQuery.json)

    • Updated domains field description to indicate it's auto-computed and read-only

Testing

  1. Unit Tests (QueryResourceTest.java)

    • test_queryInheritsDomainsFromQueryUsedIn - Verifies single domain inheritance
    • test_queryInheritsMultipleDomainsFromQueryUsedIn - Verifies multiple domain support
    • test_queryDomainsUpdatedWhenQueryUsedInChanges - Verifies domain updates on changes
    • test_queryDomainsClearedWhenQueryUsedInEmpty - Verifies domains cleared when empty
    • test_manualDomainAssignmentsIgnored - Verifies manual assignments are ignored
  2. Integration Tests (QueryResourceIT.java)

    • Same 5 test scenarios as unit tests
    • Validates end-to-end functionality with real database interactions

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@github-actions
Copy link
Contributor

TypeScript types have been updated based on the JSON schema changes in the PR

@github-actions github-actions bot requested a review from a team as a code owner January 13, 2026 10:10
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.41% (53256/81422) 43.5% (26622/61199) 46.98% (8302/17671)

@harshach
Copy link
Collaborator

@sonika-shah this requires db migrations right?

@sonika-shah
Copy link
Contributor Author

@sonika-shah this requires db migrations right?

@harshach this will not require db migrations as we are calculating query domain on fly, reindex once should be enough

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

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.

Can't see Queries Tab infomation, when select domain

4 participants