bito-code-review[bot] commented on code in PR #44500:
URL: https://github.com/apache/superset/pull/44500#discussion_r4067893757
##########
superset/models/helpers.py:
##########
@@ -4194,9 +4199,7 @@ def dttm_sql_literal(self, dttm: datetime, col:
"TableColumn") -> str:
dttm_tz_aware = dttm_tz_aware.replace(tzinfo=timezone.utc)
seconds_since_epoch = int(dttm_tz_aware.timestamp())
- if tf == "epoch_s":
- return str(seconds_since_epoch)
- return str(seconds_since_epoch * 1000)
+ return str(seconds_since_epoch * EPOCH_FORMATS[tf])
Review Comment:
<!-- Bito Reply -->
The suggestion is appropriate because it addresses a potential mismatch in
epoch units. By introducing a guard or rejecting `epoch_us` in
`dttm_sql_literal`, you ensure that the function does not incorrectly apply a
multiplier intended for milliseconds to a microsecond-based column, which would
lead to incorrect data representation.
**superset/models/helpers.py**
```
seconds_since_epoch = int(dttm_tz_aware.timestamp())
return str(seconds_since_epoch * EPOCH_FORMATS[tf])
```
--
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]