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


##########
superset/commands/dataset/importers/v1/utils.py:
##########
@@ -770,7 +770,7 @@ def _convert_temporal_columns(df: pd.DataFrame, dtype: 
dict[str, Any]) -> None:
     for column_name, sqla_type in dtype.items():
         if isinstance(sqla_type, (Date, DateTime)):
             try:
-                df[column_name] = pd.to_datetime(df[column_name])
+                df[column_name] = 
pd.to_datetime(df[column_name]).dt.as_unit("ns")

Review Comment:
   **Suggestion:** Mixed-offset timestamps can make `pd.to_datetime` return 
object dtype; `.dt.as_unit` then raises `AttributeError`, rejecting otherwise 
valid date imports.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes` ยท ๐Ÿท๏ธ `Type error`
   
   [![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=a63e4330dafe4654be460a72988909e5&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=a63e4330dafe4654be460a72988909e5&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/dataset/importers/v1/utils.py
   **Line:** 773:773
   **Comment:**
        *Type Error: Mixed-offset timestamps can make `pd.to_datetime` return 
object dtype; `.dt.as_unit` then raises `AttributeError`, rejecting otherwise 
valid date imports.
   
   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%2F45823&comment_hash=d5fac9f87d0851963750674066c29d616545cc3f04a9a4b3ac4cf2f0bd3801c6&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45823&comment_hash=d5fac9f87d0851963750674066c29d616545cc3f04a9a4b3ac4cf2f0bd3801c6&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/utils/pandas_postprocessing/pivot.py:
##########
@@ -404,8 +404,6 @@ def pivot(  # pylint: disable=too-many-arguments  # noqa: 
C901
         df = _apply_show_values_as(df, percent_mode)
 
     if combine_value_with_metric:
-        # dropna=False preserves restored all-NaN metric rows that would 
otherwise
-        # be silently dropped by stack's default dropna=True behavior.
-        df = df.stack(level=0, dropna=False).unstack()
+        df = df.stack(level=0, future_stack=True).unstack()

Review Comment:
   **Suggestion:** When `drop_missing_columns=True` leaves only observed 
metric/category pairs, stacking and unstacking recreates absent pairs as 
all-NaN columns, defeating the option.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Logic error`
   
   [![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=2259028394104051943ef51b11205c06&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=2259028394104051943ef51b11205c06&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/utils/pandas_postprocessing/pivot.py
   **Line:** 407:407
   **Comment:**
        *Logic Error: When `drop_missing_columns=True` leaves only observed 
metric/category pairs, stacking and unstacking recreates absent pairs as 
all-NaN columns, defeating the option.
   
   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%2F45823&comment_hash=2dde87214fd4c27fcad18a828c00ebdaa78f2c6b472d36fcaf203685ee01acea&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45823&comment_hash=2dde87214fd4c27fcad18a828c00ebdaa78f2c6b472d36fcaf203685ee01acea&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