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


##########
tests/unit_tests/db_engine_specs/test_clickhouse.py:
##########
@@ -562,3 +562,43 @@ def run(sql: str) -> str:
     with pytest.raises(Exception, match="TOO_MANY_ROWS"):
         database.run_with_sampling_read_limit_retry("SELECT 1", run)
     assert executed == ["SELECT 1"]
+
+
+def test_handle_boolean_filter() -> None:
+    """
+    Test that ClickHouse uses equality operators for boolean filters instead 
of IS.
+
+    ClickHouse rejects the ``column IS true/false`` form, so boolean filters 
must
+    render as ``column = true/false``.
+    """
+    from sqlalchemy import Boolean, Column
+
+    from superset.db_engine_specs.clickhouse import ClickHouseBaseEngineSpec
+    from superset.utils.core import FilterOperator
+
+    bool_col = Column("test_col", Boolean)
+
+    result_true = ClickHouseBaseEngineSpec.handle_boolean_filter(
+        bool_col, FilterOperator.IS_TRUE, True
+    )
+    assert (
+        str(result_true.compile(compile_kwargs={"literal_binds": True}))
+        == "test_col = true"
+    )
+
+    result_false = ClickHouseBaseEngineSpec.handle_boolean_filter(
+        bool_col, FilterOperator.IS_FALSE, False
+    )
+    assert (
+        str(result_false.compile(compile_kwargs={"literal_binds": True}))
+        == "test_col = false"
+    )

Review Comment:
   **Suggestion:** The test exercises the generic SQLAlchemy compiler with 
`ClickHouseBaseEngineSpec`, so it does not verify rendering through either 
concrete ClickHouse engine spec or the ClickHouse dialect. A dialect-specific 
regression, especially for computed or nullable boolean expressions, could 
therefore make ClickHouse queries fail while this test remains green. Add 
coverage using a concrete ClickHouse spec and a computed expression such as 
`(expiration = 1)`. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Dialect-specific boolean rendering regressions can escape tests.
   - ⚠️ Computed ClickHouse boolean filters lack regression coverage.
   - ⚠️ Production compilation uses a path absent from this test.
   ```
   </details>
   
   [![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=5d325c7c4d2642beba8746469cc67fd2&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=5d325c7c4d2642beba8746469cc67fd2&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:** tests/unit_tests/db_engine_specs/test_clickhouse.py
   **Line:** 579:595
   **Comment:**
        *Api Mismatch: The test exercises the generic SQLAlchemy compiler with 
`ClickHouseBaseEngineSpec`, so it does not verify rendering through either 
concrete ClickHouse engine spec or the ClickHouse dialect. A dialect-specific 
regression, especially for computed or nullable boolean expressions, could 
therefore make ClickHouse queries fail while this test remains green. Add 
coverage using a concrete ClickHouse spec and a computed expression such as 
`(expiration = 1)`.
   
   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%2F41867&comment_hash=5b9bb06cef444e0f3da913f09bedac95a90f938b9db2ef072c17568dea7c43fd&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41867&comment_hash=5b9bb06cef444e0f3da913f09bedac95a90f938b9db2ef072c17568dea7c43fd&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