-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.1.0rc1 Druid queries with CURRENT_TIMETAMP fails #29729
Comments
To resolve the issue with the Here is the relevant part of the code that needs to be adjusted: @classmethod
def convert_dttm(
cls, target_type: str, dttm: datetime, db_extra: dict[str, Any] | None = None
) -> str | None:
sqla_type = cls.get_sqla_column_type(target_type)
if isinstance(sqla_type, types.Date):
return f"CAST(TIME_PARSE('{dttm.date().isoformat()}') AS DATE)"
if isinstance(sqla_type, (types.DateTime, types.TIMESTAMP)):
return f"""TIME_PARSE('{dttm.isoformat(timespec="seconds")}')"""
if target_type.upper() == "CURRENT_TIMESTAMP":
return "CURRENT_TIMESTAMP" # Ensure no parentheses are added
return None By adding the condition to check if the |
Pinging some folks from the rolodex that might be able to help repro/test/fix. |
I don't see anything that has changed in the |
I tried to recreate using import sqlparse
sql = "SELECT case when __time > TIMESTAMPADD(DAY, -7, CURRENT_DATE) AND __time < TIMESTAMPADD(DAY, -7, CURRENT_DATE) FROM t;"
formatted_sql = sqlparse.format(sql, reindent=True, keyword_case='upper', strip_comments=True)
print(formatted_sql) it doesn't add parenthesis... |
Also reviewed https://github.com/apache/superset/blob/master/superset/db_engine_specs/druid.py for SQL mutation logic that would be Druid specific and couldn't find anything... |
@iercan can you add the version of your druid db and the driver? |
@betodealmeida might have some intuition as to what might be adding those |
Apologies for the late reply. Druid version is 30.0.0 and pydruid is 0.6.9. |
Error has gone on 4.1.0rc3 |
Bug description
I'm testing 4.1.0rc1 and encountering an error with Druid datasets that use the CURRENT_TIMESTAMP function. It seems to be adding parentheses at the end, which is causing the failure, even though we don't define any in the metric.
How to reproduce the bug
Screenshots/recordings
How metric looks like
How superset sends query
Given error
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: