codeant-ai-for-open-source[bot] commented on code in PR #38716:
URL: https://github.com/apache/superset/pull/38716#discussion_r3688994087
##########
superset/models/helpers.py:
##########
@@ -4018,6 +4065,27 @@ def get_sqla_query( # pylint:
disable=too-many-arguments,too-many-locals,too-ma
template_processor=template_processor
)
is_metric_filter = True
+ elif col_obj is None and isinstance(flt_col, str):
+ adhoc_col = next(
+ (
+ c
+ for c in reversed(columns)
+ if utils.is_adhoc_column(c) and c.get("label") ==
flt_col
+ ),
+ None,
+ )
+ if adhoc_col is not None:
+ try:
+ sqla_col, adhoc_generic_type =
self.adhoc_column_to_sqla(
+ col=adhoc_col,
+ force_type_check=True,
+ template_processor=template_processor,
+ )
+ applied_adhoc_filters_columns.append(adhoc_col)
+
applied_template_filters.append(get_column_name(adhoc_col))
Review Comment:
**Suggestion:** The label-based path records the same filter twice:
`flt_col` remains the original label and is included because it was added to
`applied_template_filters`, while `adhoc_col` is also appended to
`applied_adhoc_filters_columns`. The resulting API metadata reports duplicate
applied filters even though the filter was applied only once. Do not mark this
normally executed adhoc filter as a template-applied filter, or otherwise
deduplicate the metadata. [api mismatch]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Query metadata duplicates label-resolved adhoc filters.
- โ ๏ธ Cache/filter bookkeeping receives inconsistent column representations.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1e74526adf62408fa45b6becd175eab1&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=1e74526adf62408fa45b6becd175eab1&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/models/helpers.py
**Line:** 4084:4085
**Comment:**
*Api Mismatch: The label-based path records the same filter twice:
`flt_col` remains the original label and is included because it was added to
`applied_template_filters`, while `adhoc_col` is also appended to
`applied_adhoc_filters_columns`. The resulting API metadata reports duplicate
applied filters even though the filter was applied only once. Do not mark this
normally executed adhoc filter as a template-applied filter, or otherwise
deduplicate the metadata.
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%2F38716&comment_hash=4516e5f88e4245153d24325754a84b4d7f9414305a0d219dfec3ef545ff0e4a6&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38716&comment_hash=4516e5f88e4245153d24325754a84b4d7f9414305a0d219dfec3ef545ff0e4a6&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]