codeant-ai-for-open-source[bot] commented on code in PR #45893:
URL: https://github.com/apache/superset/pull/45893#discussion_r4475833031
##########
superset-core/src/superset_core/semantic_layers/testing.py:
##########
@@ -106,6 +106,29 @@ def test_catalog_identity(
assert semantic_view.uid()
assert semantic_view.uid() == semantic_reloaded_view.uid()
assert _catalog(semantic_view) == _catalog(semantic_reloaded_view)
+ view: SemanticView
+ for view in (semantic_view, semantic_reloaded_view):
+ preferred: str | None = view.preferred_temporal_dimension
+ if preferred is not None:
+ assert isinstance(preferred, str), (
+ "preferred_temporal_dimension must be a string or None"
+ )
+ 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"
+ )
Review Comment:
**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`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2a9b349ce2c54a7e9d71ae6f9a329f45&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=2a9b349ce2c54a7e9d71ae6f9a329f45&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45893&comment_hash=dab033047ac8585fad2d10417ea8e590952bdfeaa8b10ac6d05f8af2ae718cd6&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45893&comment_hash=dab033047ac8585fad2d10417ea8e590952bdfeaa8b10ac6d05f8af2ae718cd6&reaction=dislike'>๐</a>
--
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]