codeant-ai-for-open-source[bot] commented on code in PR #44152:
URL: https://github.com/apache/superset/pull/44152#discussion_r3985052914
##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -1276,6 +1379,16 @@ def map_treemap_config(config: TreemapChartConfig) ->
Dict[str, Any]:
"row_limit": config.row_limit,
"color_scheme": config.color_scheme or "supersetColors",
}
+ for key in _TREEMAP_PRESENTATION_KEYS | {
+ "time_range",
+ "granularity_sqla",
+ "template_params",
+ }:
+ value = getattr(config, key)
+ if value is not None:
+ form_data[key] = (
+ value.model_dump() if hasattr(value, "model_dump") else value
+ )
Review Comment:
**Suggestion:** `granularity_sqla` is copied into form data but never into
the query's `granularity` field, so treemap time filters use the dataset
default column instead of the selected column. [api mismatch]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4267314c5ae7412296411f099c70a115&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=4267314c5ae7412296411f099c70a115&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/mcp_service/chart/chart_utils.py
**Line:** 1382:1391
**Comment:**
*Api Mismatch: `granularity_sqla` is copied into form data but never
into the query's `granularity` field, so treemap time filters use the dataset
default column instead of the selected column.
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%2F44152&comment_hash=cc55c8b9f0048e622b33c4b714e605d8f5941aae273b8baa1bcbd013b6136d12&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44152&comment_hash=cc55c8b9f0048e622b33c4b714e605d8f5941aae273b8baa1bcbd013b6136d12&reaction=dislike'>๐</a>
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -1410,9 +1415,58 @@ class TreemapChartConfig(BaseChartConfig):
max_length=100,
)
+ show_labels: bool = True
+ show_upper_labels: bool = True
+ label_type: Literal["key", "Key", "value", "key_value"] = "key_value"
+ label_position: Literal[
+ "top",
+ "left",
+ "right",
+ "bottom",
+ "inside",
+ "insideLeft",
+ "insideRight",
+ "insideTop",
+ "insideBottom",
+ "insideTopLeft",
+ "insideBottomLeft",
+ "insideTopRight",
+ "insideBottomRight",
+ ] = "insideTopLeft"
+ number_format: str = Field("SMART_NUMBER", max_length=100)
+ date_format: str = Field("smart_date", max_length=100)
+ currency_format: CurrencyFormat | None = None
+ time_range: str | None = Field(None, max_length=1000)
+ granularity_sqla: str | None = Field(None, min_length=1, max_length=255)
+ template_params: str | None = Field(None, max_length=10000)
+
+ @model_validator(mode="before")
+ @classmethod
+ def adapt_native_form_data(cls, data: Any) -> Any:
+ """Accept native hierarchy and saved, SIMPLE, and SQL metric inputs."""
+ return _adapt_native_single_metric_form_data(data)
Review Comment:
**Suggestion:** The inherited unknown-field validator runs before this
adapter, so native fields such as `viz_type` and `datasource` are rejected
before they can be removed or converted. [api mismatch]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=39a63376540740199f231d76a976620c&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=39a63376540740199f231d76a976620c&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/mcp_service/chart/schemas.py
**Line:** 1445:1447
**Comment:**
*Api Mismatch: The inherited unknown-field validator runs before this
adapter, so native fields such as `viz_type` and `datasource` are rejected
before they can be removed or converted.
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%2F44152&comment_hash=30a70580ae7f99d9248048e8667b078141069ba1cc218548b30e7ed42c0582aa&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44152&comment_hash=30a70580ae7f99d9248048e8667b078141069ba1cc218548b30e7ed42c0582aa&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]