codeant-ai-for-open-source[bot] commented on code in PR #44805:
URL: https://github.com/apache/superset/pull/44805#discussion_r4136371051
##########
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:
+ return f"'{dttm.date().isoformat()}'"
+ if isinstance(sqla_type, (types.String, types.Date, types.DateTime)):
return f"""'{dttm.isoformat(sep=" ", timespec="seconds")}'"""
Review Comment:
**Suggestion:** Non-midnight DATE values now bypass `python_date_format` and
database-specific fallback formatting, producing incorrect literals for
custom-formatted SQLite date columns.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8f604b0fdc2c43388884fc21706d18cc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8f604b0fdc2c43388884fc21706d18cc&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/sqlite.py
**Line:** 179:180
**Comment:**
*Api Mismatch: Non-midnight DATE values now bypass `python_date_format`
and database-specific fallback formatting, producing incorrect literals for
custom-formatted SQLite date columns.
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%2F44805&comment_hash=3b40d7df06c5a99b6e7d79835ecac80bf8a1049f2292e04087aff680ab20b336&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44805&comment_hash=3b40d7df06c5a99b6e7d79835ecac80bf8a1049f2292e04087aff680ab20b336&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]