Skip to content

Commit

Permalink
fix(viz): BigQuery time grain 'minute'/'second' throws an error (#20350)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5afeba3)
  • Loading branch information
diegomedina248 authored and michael-s-molina committed Jun 28, 2022
1 parent 2d551fa commit 9e6a3e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions superset/db_engine_specs/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ class BigQueryEngineSpec(BaseEngineSpec):

_time_grain_expressions = {
None: "{col}",
"PT1S": "{func}({col}, SECOND)",
"PT1M": "{func}({col}, MINUTE)",
"PT1S": "CAST(TIMESTAMP_SECONDS("
"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("
"5*60 * DIV(UNIX_SECONDS(CAST({col} AS TIMESTAMP)), 5*60)"
") AS {type})",
Expand Down

0 comments on commit 9e6a3e1

Please sign in to comment.