-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Time Grain for BigQuery type: DATE & DATETIME is not available #9125
Comments
Thanks @ranugoldan , I have a fix for this that I'm looking to test later today, will put in a PR once it's finished. |
Thanks @villebro will look forward for it! |
@ranugoldan as a quick fix/check, would you mind adding the following to your TIME_GRAIN_ADDON_FUNCTIONS = {
'bigquery': {
"PT1S": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), SECOND)",
"PT1M": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), MINUTE)",
"PT1H": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), HOUR)",
"P1D": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), DAY)",
"P1W": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), WEEK)",
"P1M": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), MONTH)",
"P0.25Y": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), QUARTER)",
"P1Y": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), YEAR)",
}
} |
@villebro noted, will try it today. Thanks |
@villebro sorry for late reply. It worked fine. But the NaNaNaN return value from timestamp_trunc that I mentioned from slack threads before is still there. Should I create another issue for that? |
@ranugoldan no need to create a separate issue; if you can add a screenshot of the NaNaNaN issue to the main ticket (the one with the screenshot above), that should be enough. I'll try to make a PR for this in the coming days, will try to tackle the formatting problem, too, unless it turns out to be a deep rabbit hole. |
When using time grain for BigQuery table, it always uses timestamp_trunc though the field is DATE or DATETIME type.
Expected results
Able to use time grain for Bigquery Type: DATE & DATETIME
Actual results
it will occur syntax error.
Screenshots
How to reproduce the bug
Environment
0.35.0
3.6
Checklist
Make sure these boxes are checked before submitting your issue - thank you!
Additional context
Related slack thread: https://apache-superset.slack.com/archives/C7G8CG0LR/p1581403019215900
The text was updated successfully, but these errors were encountered: