EnxDev commented on code in PR #44700:
URL: https://github.com/apache/superset/pull/44700#discussion_r4137477868
##########
superset/db_engine_specs/datafusion.py:
##########
@@ -84,9 +90,13 @@ def convert_dttm(
) -> str | None:
sqla_type = cls.get_sqla_column_type(target_type)
- if isinstance(sqla_type, types.Date):
- return f"TO_DATE('{dttm.date().isoformat()}', 'YYYY-MM-DD')"
+ # DataFusion's to_timestamp()/to_date() take chrono format strings, not
+ # Oracle/PostgreSQL ones, so render ANSI typed literals instead.
+ if isinstance(sqla_type, types.Date) and not isinstance(
+ sqla_type, types.DateTime
+ ):
Review Comment:
Nit, take it or leave it. In SQLAlchemy 2.0, `DateTime` and `TIMESTAMP`
don't subclass `Date`, so the old branch never caught them. The extra check
here doesn't change anything, and the description's "no longer catches DateTime
subtypes" line suggests a fix that isn't really there.
I'd drop the guard, or keep it and trim that line from the description.
```suggestion
if isinstance(sqla_type, types.Date):
```
--
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]