sadpandajoe commented on code in PR #45041:
URL: https://github.com/apache/superset/pull/45041#discussion_r4211089883


##########
superset/db_engine_specs/duckdb.py:
##########
@@ -315,7 +315,7 @@ class DuckDBEngineSpec(DuckDBParametersMixin, 
BaseEngineSpec):
 
     @classmethod
     def epoch_to_dttm(cls) -> str:
-        return "datetime({col}, 'unixepoch')"
+        return "(TIMESTAMP 'epoch' + to_seconds({col}))"

Review Comment:
   `epoch_ms` and `epoch_us` still inherit the base templates, which substitute 
`({col}/1000)` without grouping the column. So a calculated column like `1000 - 
1001` on an `epoch_ms` field compiles to `to_seconds((1000 - 1001/1000))` and 
lands about 999 seconds after the epoch instead of 1 ms before it. The new 
arithmetic test only covers `epoch_s`, so it won't catch this. Should DuckDB 
also override `epoch_ms_to_dttm`/`epoch_us_to_dttm` to group the column, and 
extend the arithmetic test to those formats?



-- 
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