danielalyoshin commented on code in PR #44805:
URL: https://github.com/apache/superset/pull/44805#discussion_r4136556366


##########
superset/db_engine_specs/sqlite.py:
##########
@@ -164,8 +164,19 @@ def get_temporal_column_shift_expr(
     def convert_dttm(
         cls, target_type: str, dttm: datetime, db_extra: dict[str, Any] | None 
= None
     ) -> str | None:
+        """
+        Write midnight as a bare date for DATE columns.
+
+        SQLite has no date type, so a DATE column usually holds text such as
+        ``2026-09-20`` and is compared as text. ``'2026-09-20 00:00:00'`` sorts
+        after the day it starts, so a time filter on a DATE column would be 
one day
+        off. Any other time keeps its time part, which sorts between two days, 
as a
+        comparison of dates should.
+        """
         sqla_type = cls.get_sqla_column_type(target_type)
-        if isinstance(sqla_type, (types.String, types.DateTime)):
+        if isinstance(sqla_type, types.Date) and dttm.time() == time.min:

Review Comment:
   This does not apply: in SQLAlchemy, `DateTime` and `TIMESTAMP` are not 
subclasses of `Date` (`issubclass(types.DateTime, types.Date)` is `False`), and 
the `DATETIME` and `TIMESTAMP` midnight cases in the tests pass.
   



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