Skip to content

test(semantic-layer): make date export parametrization deterministic - #46449

Merged
rusackas merged 1 commit into
apache:masterfrom
mikebridge:fix-date-result-test-collection
Nov 21, 2026
Merged

rusackas merged 1 commit into
apache:masterfrom
mikebridge:fix-date-result-test-collection

Conversation

@mikebridge

Copy link
Copy Markdown
Member

SUMMARY

Master's unit tests intermittently fail before running because different pytest workers collect the date-export cases in different orders. ChartDataResultFormat.table_like() returns a set, and wrapping it in list() preserves hash-dependent CSV/XLSX order.

Sort the formats before parametrizing the test. This keeps the same CSV, XLSX and JSON cases, with and without resampling, and changes no production behavior.

Observed on master's Python-Unit run at 29b6d4c193.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: Different tests were collected between gw0 and gw1, with CSV and XLSX cases reversed. After: both workers collect the same cases in the same order. No UI changes.

TESTING INSTRUCTIONS

  • Two local pytest -n 2 controls launched workers with distinct interpreter hash seeds (1/2, then 2/3). Both failed at collection before the change; both passed all 27 module tests afterward. A temporary launcher only set worker interpreter seeds; it did not alter collection and is not part of this change.
  • tests/unit_tests/semantic_layers: 2,620 passed with two workers using different hash seeds.
  • Changed-file pre-commit passed, including MyPy and Ruff.
  • To exercise normal randomized workers: PYTHONHASHSEED=random python -m pytest -n 2 tests/unit_tests/semantic_layers/date_result_test.py -q. Before the fix, failure depends on the workers choosing different set orders.
  • Checked sibling semantic-layer parametrizations and IDs; no other unstable collection source found.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 4fcf90d8840b

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.92%. Comparing base (29b6d4c) to head (4fcf90d).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #46449       +/-   ##
===========================================
+ Coverage   65.70%   85.92%   +20.22%     
===========================================
  Files        3122     3122               
  Lines      216867   216867               
  Branches    51420    51420               
===========================================
+ Hits       142486   186340    +43854     
+ Misses      71103    27110    -43993     
- Partials     3278     3417      +139     
Flag Coverage Δ
hive 33.88% <ø> (ø)
mysql 51.56% <ø> (-0.01%) ⬇️
postgres 51.59% <ø> (-0.01%) ⬇️
presto 35.56% <ø> (ø)
python 88.42% <ø> (+36.54%) ⬆️
sqlite 51.26% <ø> (ø)
unit 83.82% <ø> (?)

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.

@aminghadersohi aminghadersohi 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.

Sorting the table_like() set gives every worker the same collection order, and the export cases are unchanged.

@rusackas
rusackas merged commit 825d48a into apache:master Nov 21, 2026
77 checks passed
jprinet added a commit to jprinet/superset that referenced this pull request Nov 23, 2026
* origin/master: (393 commits)
  fix(a11y): name the semantic view description input (apache#46458)
  docs(semantic): explain datasource list modification eligibility (apache#46462)
  docs(semantic-layer): document NULL-preserving exclusion filters (apache#46447)
  fix(uploads): skip folder and system entries in columnar ZIP uploads (apache#45617)
  fix(i18n-es): promote 47 of the zero-context backfill entries (apache#45847)
  fix(mcp): return structured ChartError on SQLAlchemyError in get_chart_sql (apache#44351)
  fix(datasets): follow semantic view modification permissions (apache#46448)
  fix(docker): account for container memory limits in frontend-mem-nag.sh (apache#46373)
  fix(reports): carry the report's native filters in the email and Slack link (apache#46062)
  fix(explore): apply the dataset timezone to grained temporal filter values (apache#46175)
  fix(i18n): enforce the do-not-translate registry across the catalogs (apache#45974)
  chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup (apache#46139)
  fix(i18n): split parameter-suggestion plural into two messages (apache#46049)
  test(partition-mapping): cover Hive/Impala mirrored SQL, cache outage and migration (apache#46319)
  perf(dashboard): look up the dashboard once per filter_state read (apache#46314)
  fix(i18n): load the dayjs locale for every language with a catalog (apache#45982)
  test(semantic-layer): make date export parametrization deterministic (apache#46449)
  fix(oauth2): idempotent OAuth2 completion and resilient listener (apache#40292)
  fix(explore): prevent full table scan when SQL expression is used as x-axis (apache#41339)
  feat(mcp): radar chart type plugin (apache#43571)
  ...

# Conflicts:
#	.github/workflows/docker.yml
#	.github/workflows/superset-frontend.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants