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


##########
superset/connectors/sqla/partition_mapping.py:
##########
@@ -689,27 +783,94 @@ def preview_partition_mapping(
         transform=value_transform,
         engine=engine,
     ):
-        return {"valid": False, "error": str(issue.message)}
+        return {
+            "valid": False,
+            # The parse failure is the one an owner sees constantly, and it is
+            # the only one the mockup gives its own headline to.
+            "reason": (
+                "parse"
+                if issue.field == "partition_value_transform"
+                and not is_parseable(value_transform, engine)
+                else "validation"
+            ),
+            "error": str(issue.message),
+        }
 
-    evaluated = evaluate_transform(
-        datasource.database,
-        datasource.catalog,
-        datasource.schema,
-        cast(str, value_transform),
-        [sample_value],
+    mapping = PartitionMapping(
+        partition_column=str(partition_column),
+        mapped_column=mapped_column,
+        value_transform=cast(str, value_transform),
+        is_monotonic=is_monotonic,
     )
-    if evaluated is None:
+    sample_input = _render_sample_input(mapped_column, operator, sample_values)
+
+    if not mapping.mirrors(operator):
         return {
             "valid": False,
-            "error": _("The transform could not be evaluated against the 
database."),
+            "reason": "operator",
+            "sample_input": sample_input,
+            "error": _(
+                "A %(operator)s filter is only mirrored when the transform "
+                "preserves ordering, which this one is not declared to do.",
+                operator=operator.value,
+            ),
+        }
+
+    value: Any = sample_values if operator == FilterOperator.IN else 
sample_values[0]
+    errors: list[str] = []
+    predicates = build_mirrored_predicates(
+        datasource, mapping, [(operator, value)], errors=errors
+    )

Review Comment:
   **Suggestion:** Preview accepts `TEMPORAL_RANGE`, but this call sends it to 
a comparison handler that raises `ValueError`, causing the endpoint to return 
500. [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=e2240db6d44b45bda5a10fc633941cdc&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=e2240db6d44b45bda5a10fc633941cdc&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/connectors/sqla/partition_mapping.py
   **Line:** 821:823
   **Comment:**
        *Api Mismatch: Preview accepts `TEMPORAL_RANGE`, but this call sends it 
to a comparison handler that raises `ValueError`, causing the endpoint to 
return 500.
   
   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%2F43891&comment_hash=17a278845f692b1fb3829287b6da6aeb4f970fa4df620cee42a38722bd8d3914&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43891&comment_hash=17a278845f692b1fb3829287b6da6aeb4f970fa4df620cee42a38722bd8d3914&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