villebro opened a new pull request #9238: fix: Add type specific date 
truncation functions to BigQuery
URL: https://github.com/apache/incubator-superset/pull/9238
 
 
   ### CATEGORY
   
   Choose one
   
   - [x] Bug Fix
   - [ ] Enhancement (new features, refinement)
   - [x] Refactor
   - [x] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   Superset currently only supports having a common truncation function for 
time grain expressions. BigQuery, on the other hand, requires type-specific 
truncation functions for all temporal types:
   
   
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#time_trunc
   
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#date_trunc
   
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#datetime_trunc
   
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#timestamp_trunc
   
   This PR adds the option to specify a type-specific truncation function 
denoted `{func}` in the time grain expression. For example, the time grain 
expression `{func}({col}, HOUR)` with type `DATE` will yield 
`DATE_TRUNC(`my_col`, HOUR)`. Similarly, `DATETIME` will yield 
`DATETIME_TRUNC(`my_col`, HOUR)`. This also renames the config option 
`TIME_GRAIN_ADDON_FUNCTIONS ` to `TIME_GRAIN_ADDON_EXPRESSIONS`, as they 
weren't really functions, but rather expressions. (This is not yet reflected in 
`UPDATING.md`, will add that once the PR gets an id).
   
   ### BEFORE
   
![image](https://user-images.githubusercontent.com/33317356/75903984-153b7e00-5e4b-11ea-9d15-54f0a55b7c71.png)
   
   ### AFTER
   (note `DATETIME_TRUNC` instead of `TIMESTAMP_TRUNC`)
   
![image](https://user-images.githubusercontent.com/33317356/75903923-f9d07300-5e4a-11ea-870c-8f5b11b0c4d8.png)
   
   ### TEST PLAN
   CI + Tested locally.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: closes #9125
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ### REVIEWERS
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to