codeant-ai-for-open-source[bot] commented on code in PR #43829:
URL: https://github.com/apache/superset/pull/43829#discussion_r3934401160


##########
superset/commands/datasource/list.py:
##########
@@ -70,14 +70,17 @@ def run(self) -> dict[str, Any]:
             type_filter,
             database_id,
             semantic_layer_uuid,
+            schema_filter,
         ) = self._parse_filters(filters)
 
         source_type = self._resolve_connection_source_type(
             source_type,
             database_id,
             semantic_layer_uuid,
         )
-        source_type = self._resolve_source_type(source_type, sql_filter, 
type_filter)
+        source_type = self._resolve_source_type(
+            source_type, sql_filter, type_filter, schema_filter
+        )

Review Comment:
   **Suggestion:** When users can read semantic views but not datasets, a 
schema filter still resolves to semantic views, so unrelated schema-less views 
appear in schema-filtered results. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5fb0d97d63fa457ba47b781d50358893&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5fb0d97d63fa457ba47b781d50358893&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/commands/datasource/list.py
   **Line:** 81:83
   **Comment:**
        *Api Mismatch: When users can read semantic views but not datasets, a 
schema filter still resolves to semantic views, so unrelated schema-less views 
appear in schema-filtered results.
   
   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%2F43829&comment_hash=044c52fb151d183974e38e5aac1fcf16433c685a33af65e054896fa327617694&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43829&comment_hash=044c52fb151d183974e38e5aac1fcf16433c685a33af65e054896fa327617694&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/commands/datasource/list.py:
##########
@@ -205,18 +213,47 @@ def _resolve_source_type(
         # Source="Database" filter and showing inconsistent results.
         if source_type in ("database", "semantic_layer"):
             return source_type
-        # sql_filter (physical/virtual toggle) only applies to datasets
-        if sql_filter is not None:
+        # sql_filter (physical/virtual toggle) and schema both only apply to
+        # datasets (semantic views have no schema), so either narrows to 
datasets.
+        if sql_filter is not None or schema_filter is not None:
+            # A schema filter combined with an explicit Type="Semantic View" is
+            # contradictory: no semantic view has a schema, so under AND 
semantics
+            # the honest result is zero rows rather than silently dropping 
either
+            # filter. This pair is reachable because the Schema control is not 
part
+            # of the frontend cascade; sql_filter and type_filter share one 
control
+            # and cannot collide, so that combination needs no such guard.
+            if schema_filter is not None and type_filter == "semantic_view":
+                return "empty"
             return "database"
         # Explicit semantic-view type filter (only reached when 
source_type="all")
         if type_filter == "semantic_view":
             return "semantic_layer"
         return source_type
 
+    @staticmethod
+    def _apply_sql_null_filter(
+        value: Any,
+        type_filter: str | None,
+        sql_filter: bool | None,
+    ) -> tuple[str | None, bool | None]:
+        """Interpret a ``sql``/``dataset_is_null_or_empty`` filter value.
+
+        ``"semantic_view"`` selects semantic views; a boolean toggles the
+        physical/virtual dataset split. Unrecognized values leave both inputs
+        unchanged, so the caller can pass its current values straight through.
+        """
+        if value == "semantic_view":
+            return "semantic_view", sql_filter
+        if isinstance(value, bool):
+            return type_filter, value

Review Comment:
   **Suggestion:** With multiple SQL filters, a semantic-view selector and 
boolean selector can both remain set; the later resolution silently drops the 
semantic-view filter. [incorrect condition logic]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1b562b7fe6d24935a0dfa7dfd0d487de&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1b562b7fe6d24935a0dfa7dfd0d487de&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/commands/datasource/list.py
   **Line:** 245:248
   **Comment:**
        *Incorrect Condition Logic: With multiple SQL filters, a semantic-view 
selector and boolean selector can both remain set; the later resolution 
silently drops the semantic-view filter.
   
   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%2F43829&comment_hash=b661f37abde842235b3097e8c448bedaabc7b6cb2dfd3e91711a4398fe7aa5ae&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43829&comment_hash=b661f37abde842235b3097e8c448bedaabc7b6cb2dfd3e91711a4398fe7aa5ae&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]

Reply via email to