mikebridge opened a new pull request, #45104: URL: https://github.com/apache/superset/pull/45104
### SUMMARY The semantic mapper can call `get_metrics()` four times and `get_dimensions()` five times while validating and executing a grouped chart query. Providers that resolve metadata remotely may pay for each call, and validation and mapping can observe different members. Capture each metadata collection once per execution and pass that observation through validation and mapping. Preserve provider iteration order, existing result transformations, and the public standalone validation/mapping signatures. Each subsequent execution fetches fresh metadata; nothing is cached across queries or requests. Also give the public `superset-core` `SemanticView.name` attribute an empty-string default. This is a backward-compatible optional display label; existing provider names and UID-based identity are unchanged. The host continues using its own model name. Known follow-up: if a metadata lookup itself fails, its provider error can surface before an invalid query input is rejected. Preserving the earlier error ordering would require lazy metadata retrieval; this draft does not change that case. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable; no UI changes. ### TESTING INSTRUCTIONS Run the focused host and SDK contract tests with the checkout's core package on the import path: ```sh TZ=UTC PYTHONPATH=.:superset-core/src python -m pytest -o addopts= tests/unit_tests/semantic_layers/ superset-core/tests/semantic_layers/ -q ``` With the project's test environment: 1. Run `test_mapper_fetches_metadata_once`: a grouped execution must call each metadata getter once and retain the expected result rows. The pre-fix control calls them four and five times. 2. Run `test_execution_reuses_members_but_next_query_fetches_fresh_metadata`: changing provider metadata is observed on the next execution of the same query object. 3. Run `test_execution_rejects_stale_selection_before_metadata_fetch`: an obsolete member-selection version fails before metadata is fetched. 4. Run `test_view_metadata_defaults_are_conservative` for the SDK defaults. Existing mapper tests cover grains, filtering, grouping, ordering, limits, comparisons and row counts. Verification: 817 focused tests passed; changed-file pre-commit passed. The whole unit suite produced 22,412 passes, 40 skips, 2 expected failures and 3 failures. All three failures reproduce on untouched master in the same environment: two arm64 long-double cases and the Babel script fixture, which strips `python` from its PATH. Live provider latency was not measured. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
