Skip to content

test(semantic-layer): validate provider-declared default time dimensions - #45893

Open
mikebridge wants to merge 4 commits into
apache:masterfrom
mikebridge:sc-130335-default-time-dimension
Open

mikebridge wants to merge 4 commits into
apache:masterfrom
mikebridge:sc-130335-default-time-dimension

Conversation

@mikebridge

Copy link
Copy Markdown
Contributor

SUMMARY

TL;DR: Validate provider-declared default time dimensions in the reusable SDK conformance suite, and document how existing chart defaults use them.

Background: A semantic view can already declare its preferred exposed time dimension. The host validates that name and supplies it to Explore and query construction.

Problem: The conformance suite did not reject invalid or unstable declarations, and the existing documentation could imply that all saved-chart results remain unchanged when a provider adds a default.

What this changes: Check optional declarations against exposed temporal names and equivalent catalog reloads. Add metadata, frontend initialization, and explicit/implicit query-binding tests. Clarify the compatibility guarantee: explicit saved bindings remain authoritative, but omitted bindings may adopt a provider's new default and change results without saving the chart. An explicit temporal filter does not prevent omitted granularity from receiving default-date bounds for an independently supplied time range.

The check reuses existing provider fixtures and accepts Arrow date, timestamp and time types, including grain variants sharing a name. Providers that declare None remain conforming. This PR changes no host production behavior, provider selection policy, stored chart, migration, or feature-flag default.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable: SDK test utility, characterization tests and documentation only. Live provider/browser acceptance is separate.

TESTING INSTRUCTIONS

  • Run PYTHONPATH=superset-core/src python -m pytest -q -o addopts='' superset-core/tests/semantic_layers/test_conformance.py (78 passed, four existing optional-capability skips).
  • Run python -m pytest -q tests/unit_tests/semantic_layers/models_test.py -k 'preference or preferred_temporal' (10 passed).
  • Run python -m pytest -q tests/unit_tests/common/test_query_context_factory.py (91 passed).
  • From superset-frontend, run npm run test -- --runInBand packages/superset-ui-chart-controls/test/utils/getTemporalColumns.test.ts (10 passed).
  • Existing datasource/Explore and semantic metadata access/flag regressions pass; changed-file pre-commit hooks pass, including Python/frontend typing.
  • The new conformance cases fail against the original SDK utility (11 failures) and pass with the assertions added. No real-provider or browser result parity is claimed.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: existing SEMANTIC_LAYERS for host semantic behavior; no default change
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

Proposed title: test(semantic-layer): validate provider time defaults

@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 60c8cd6
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aeb859899b01d4273fcd9e0
😎 Deploy Preview https://deploy-preview-45893--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.02%. Comparing base (3cd5c5d) to head (60c8cd6).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45893      +/-   ##
==========================================
+ Coverage   84.99%   85.02%   +0.02%     
==========================================
  Files        3080     3085       +5     
  Lines      209131   209759     +628     
  Branches    49278    49278              
==========================================
+ Hits       177755   178342     +587     
- Misses      27993    28035      +42     
+ Partials     3383     3382       -1     
Flag Coverage Δ
hive 34.20% <ø> (ø)
javascript 81.32% <ø> (+0.01%) ⬆️
mysql 52.03% <ø> (ø)
postgres 52.05% <ø> (ø)
presto 35.86% <ø> (ø)
python 87.94% <ø> (+<0.01%) ⬆️
sqlite 51.80% <ø> (ø)
superset-extensions-cli 91.24% <ø> (?)
unit 82.87% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added doc Namespace | Anything related to documentation packages labels Oct 30, 2026
@sadpandajoe sadpandajoe added review:checkpoint Last PR reviewed during the daily review standup review:draft and removed review:checkpoint Last PR reviewed during the daily review standup labels Oct 30, 2026
@mikebridge
mikebridge marked this pull request as ready for review November 5, 2026 02:10
Comment on lines +116 to +127
assert any(
dimension.name == preferred
and (
pa.types.is_date(dimension.type)
or pa.types.is_timestamp(dimension.type)
or pa.types.is_time(dimension.type)
)
for dimension in view.get_dimensions()
), (
"preferred_temporal_dimension must name "
"an exposed temporal dimension"
)

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.

Suggestion: When a name has a non-temporal raw variant and a temporal grain variant, this accepts it, but Superset collapses to raw and ignores the declared default.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-core/src/superset_core/semantic_layers/testing.py
**Line:** 116:127
**Comment:**
	*Api Mismatch: When a name has a non-temporal raw variant and a temporal grain variant, this accepts it, but Superset collapses to raw and ignores the declared default.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟡  Medium Risk

  • The PR needs attention before merging because the conformance check may accept a default that Superset cannot honor.
  • For same-name raw and temporal grain variants, validation can pass on the temporal variant even if Superset resolves the exposed selection to the raw one.

Assessed commit: 60c8cd67f1da

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation packages review:draft size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants