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


##########
superset/connectors/sqla/models.py:
##########
@@ -1295,7 +1296,7 @@ def get_timestamp_expression(  # noqa: C901
         label = label or utils.DTTM_ALIAS
 
         pdf = self.python_date_format
-        is_epoch = pdf in ("epoch_s", "epoch_ms")
+        is_epoch = pdf in EPOCH_FORMATS

Review Comment:
   **Suggestion:** A string column configured as `epoch_us` now enters epoch 
arithmetic, so PostgreSQL attempts numeric division on text and the generated 
query fails at runtime.
   
   **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=398c4d1bb13d4f6b9ad337cf967ec3f5&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=398c4d1bb13d4f6b9ad337cf967ec3f5&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/models.py
   **Line:** 1299:1299
   **Comment:**
        *Type Error: A string column configured as `epoch_us` now enters epoch 
arithmetic, so PostgreSQL attempts numeric division on text and the generated 
query fails at runtime.
   
   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%2F44500&comment_hash=b451128522c7357f5f949fdf6c9b9f08c58aa47b6849a5addcc0fd5b5ec3c60b&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44500&comment_hash=b451128522c7357f5f949fdf6c9b9f08c58aa47b6849a5addcc0fd5b5ec3c60b&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/db_engine_specs/base.py:
##########
@@ -1529,6 +1532,16 @@ def epoch_ms_to_dttm(cls) -> str:
         """
         return cls.epoch_to_dttm().replace("{col}", "({col}/1000)")
 
+    @classmethod
+    def epoch_us_to_dttm(cls) -> str:
+        """
+        SQL expression that converts epoch (microseconds) to datetime that can 
be used
+        in a query.
+
+        :return: SQL Expression
+        """
+        return cls.epoch_to_dttm().replace("{col}", "({col}/1000000)")

Review Comment:
   **Suggestion:** BigQuery inherits this implementation, producing 
`TIMESTAMP_SECONDS(col / 1000000)`, but BigQuery requires an integer argument 
and rejects the resulting floating-point expression.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes` ยท ๐Ÿท๏ธ `Api mismatch`
   
   [![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=7af414a2f9924fe1adac23b9f031614f&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=7af414a2f9924fe1adac23b9f031614f&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/db_engine_specs/base.py
   **Line:** 1543:1543
   **Comment:**
        *Api Mismatch: BigQuery inherits this implementation, producing 
`TIMESTAMP_SECONDS(col / 1000000)`, but BigQuery requires an integer argument 
and rejects the resulting floating-point expression.
   
   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%2F44500&comment_hash=dc631bbf554dbb5716c80bfe18d78c0fe6939dab6282331d5e7aff73d1bd6a75&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44500&comment_hash=dc631bbf554dbb5716c80bfe18d78c0fe6939dab6282331d5e7aff73d1bd6a75&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