You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mikebridge (via GitHub)" <gi...@apache.org> on 2026/07/15 21:33:34 UTC

[I] fix(semantic-layers): consolidate duplicate time-axis helper and tests [superset]

mikebridge opened a new issue, #42092:
URL: https://github.com/apache/superset/issues/42092

   ### Bug description
   
   `master` defines `_get_time_axis_column` twice in `superset/semantic_layers/mapper.py` and repeats several test function names in `tests/unit_tests/semantic_layers/mapper_test.py`.
   
   The first helper was introduced by #41556 for time-comparison `TEMPORAL_RANGE` handling. The second was introduced later by #41456 for SemanticView time-grain selection:
   
   - First definition: https://github.com/apache/superset/blob/c6da740ce2/superset/semantic_layers/mapper.py#L515-L565
   - Second definition: https://github.com/apache/superset/blob/c6da740ce2/superset/semantic_layers/mapper.py#L1040-L1082
   - Earlier duplicate-named tests: https://github.com/apache/superset/blob/c6da740ce2/tests/unit_tests/semantic_layers/mapper_test.py#L1283
   - Later duplicate-named tests: https://github.com/apache/superset/blob/c6da740ce2/tests/unit_tests/semantic_layers/mapper_test.py#L3662
   
   Python silently replaces the first helper with the second at module import time. Pytest likewise replaces duplicate module-level test functions before collection. As a result, the earlier temporal-filter fallback behavior and its tests can be hidden rather than composed with the later time-grain behavior.
   
   Reproduction:
   
   1. Check out current `master`.
   2. Run `pre-commit run mypy --all-files` or `pre-commit run --all-files`.
   3. Observe:
   
   ```text
   superset/semantic_layers/mapper.py:1040: error: Name "_get_time_axis_column" already defined on line 515  [no-redef]
   tests/unit_tests/semantic_layers/mapper_test.py:3662: error: Name "test_get_time_axis_column_returns_granularity_when_set" already defined on line 1283  [no-redef]
   tests/unit_tests/semantic_layers/mapper_test.py:3671: error: Name "test_get_time_axis_column_finds_temporal_in_columns" already defined on line 1292  [no-redef]
   tests/unit_tests/semantic_layers/mapper_test.py:3774: error: Name "test_get_time_axis_column_skips_unparseable_adhoc_columns" already defined on line 1335  [no-redef]
   ```
   
   Expected behavior: one helper should deliberately combine the temporal-range fallback from #41556 with the unambiguous time-axis selection required by #41456, and each behavior should have uniquely named, collected tests.
   
   ### Environment
   
   - Superset version: master / latest-dev
   - Python version: local verification used Python 3.12
   - Node version: not applicable
   - Browser: not applicable
   
   ### Additional context
   
   This was discovered while running the mandatory all-files pre-commit gate for an unrelated backend change. The same duplicate definitions are present on `origin/master`; they are not part of that feature branch.
   
   ### Checklist
   
   - [x] I searched the GitHub issue tracker and did not find a similar bug report.
   - [x] I included the relevant MyPy output and exact source locations.
   - [x] This is not a security report.


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] fix(semantic-layers): consolidate duplicate time-axis helper and tests [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe closed issue #42092: fix(semantic-layers): consolidate duplicate time-axis helper and tests
URL: https://github.com/apache/superset/issues/42092


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org