codeant-ai-for-open-source[bot] commented on code in PR #45104:
URL: https://github.com/apache/superset/pull/45104#discussion_r4224009253
##########
superset/semantic_layers/mapper.py:
##########
@@ -125,15 +126,30 @@ class ValidatedQueryObject(QueryObject):
series_limit_metric: str | None
+@dataclass(frozen=True)
+class _ViewMetadata:
+ """One query's member observation, preserving provider iteration order."""
+
+ metrics: tuple[Metric, ...]
+ dimensions: tuple[Dimension, ...]
+
+ @classmethod
+ def from_view(cls, view: SemanticView) -> "_ViewMetadata":
+ return cls(tuple(view.get_metrics()), tuple(view.get_dimensions()))
+
+
def get_results(query_object: QueryObject) -> QueryResult:
"""
Run 1+ queries based on `QueryObject` and return the results.
:param query_object: The QueryObject containing query specifications
:return: QueryResult compatible with Superset's query interface
"""
- if not validate_query_object(query_object):
+ if not query_object.datasource:
raise ValueError("QueryObject must have a datasource defined.")
+ query_object = cast(ValidatedQueryObject, query_object)
+ metadata: _ViewMetadata = _validation_metadata(query_object)
+ _validate_query_object(query_object, metadata)
Review Comment:
**Suggestion:** For supported adhoc order expressions, this invokes
validation that hashes the expression dictionary and raises `TypeError`,
aborting the query.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Type error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=38481f9061ec4f98b25f7be40127ad8e&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=38481f9061ec4f98b25f7be40127ad8e&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/semantic_layers/mapper.py
**Line:** 152:152
**Comment:**
*Type Error: For supported adhoc order expressions, this invokes
validation that hashes the expression dictionary and raises `TypeError`,
aborting the query.
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%2F45104&comment_hash=936d701ba25623371827571df68ff5024037cec6e013b1cc2af980741df6fa74&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45104&comment_hash=936d701ba25623371827571df68ff5024037cec6e013b1cc2af980741df6fa74&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]