bito-code-review[bot] commented on code in PR #44500:
URL: https://github.com/apache/superset/pull/44500#discussion_r4063828235


##########
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:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Wrong epoch unit for epoch_us</b></div>
   <div id="fix">
   
   `EPOCH_FORMATS` now includes `epoch_us`, so `dttm_sql_literal` renders 
`seconds_since_epoch * 1_000_000` for it — microseconds, while `epoch_ms` 
consumers expect milliseconds. `validate_python_date_format` accepts `epoch_us` 
(superset/datasets/schemas.py), so a dataset column can reach this line. Guard 
or reject `epoch_us` here; previously only s/ms were supported.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #300647</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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