mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(viz): BigQuery time grain 'minute'/'second' throws an error (#20350)
(cherry picked from commit 5afeba34bd)
This commit is contained in:
committed by
Michael S. Molina
parent
2d551faaf4
commit
9e6a3e1a4e
@@ -123,8 +123,12 @@ class BigQueryEngineSpec(BaseEngineSpec):
|
|||||||
|
|
||||||
_time_grain_expressions = {
|
_time_grain_expressions = {
|
||||||
None: "{col}",
|
None: "{col}",
|
||||||
"PT1S": "{func}({col}, SECOND)",
|
"PT1S": "CAST(TIMESTAMP_SECONDS("
|
||||||
"PT1M": "{func}({col}, MINUTE)",
|
"UNIX_SECONDS(CAST({col} AS TIMESTAMP))"
|
||||||
|
") AS {type})",
|
||||||
|
"PT1M": "CAST(TIMESTAMP_SECONDS("
|
||||||
|
"60 * DIV(UNIX_SECONDS(CAST({col} AS TIMESTAMP)), 60)"
|
||||||
|
") AS {type})",
|
||||||
"PT5M": "CAST(TIMESTAMP_SECONDS("
|
"PT5M": "CAST(TIMESTAMP_SECONDS("
|
||||||
"5*60 * DIV(UNIX_SECONDS(CAST({col} AS TIMESTAMP)), 5*60)"
|
"5*60 * DIV(UNIX_SECONDS(CAST({col} AS TIMESTAMP)), 5*60)"
|
||||||
") AS {type})",
|
") AS {type})",
|
||||||
|
|||||||
Reference in New Issue
Block a user