You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/03/04 17:09:04 UTC
[GitHub] [incubator-superset] villebro opened a new pull request #9238: fix:
Add type specific date truncation functions to BigQuery
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io commented on issue #9238: fix: Add
type specific date truncation functions to BigQuery
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #9238: fix: Add type specific date truncation functions to BigQuery
URL: https://github.com/apache/incubator-superset/pull/9238#issuecomment-594715463
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9238?src=pr&el=h1) Report
> Merging [#9238](https://codecov.io/gh/apache/incubator-superset/pull/9238?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/7a91498cf1a9e56d4b3d7b3805076137525ea277?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9238/graphs/tree.svg?width=650&token=KsB0fHcx6l&height=150&src=pr)](https://codecov.io/gh/apache/incubator-superset/pull/9238?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9238 +/- ##
=======================================
Coverage 58.93% 58.93%
=======================================
Files 373 373
Lines 12014 12014
Branches 2945 2945
=======================================
Hits 7080 7080
Misses 4755 4755
Partials 179 179
```
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9238?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9238?src=pr&el=footer). Last update [7a91498...637e2e1](https://codecov.io/gh/apache/incubator-superset/pull/9238?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] villebro merged pull request #9238: fix: Add
type specific date truncation functions to BigQuery
Posted by GitBox <gi...@apache.org>.
villebro merged pull request #9238: fix: Add type specific date truncation functions to BigQuery
URL: https://github.com/apache/incubator-superset/pull/9238
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] villebro commented on issue #9238: fix: Add
type specific date truncation functions to BigQuery
Posted by GitBox <gi...@apache.org>.
villebro commented on issue #9238: fix: Add type specific date truncation functions to BigQuery
URL: https://github.com/apache/incubator-superset/pull/9238#issuecomment-594719218
Thanks @willbarrett ; fixed lint and added `UPDATING.md` comment
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] willbarrett commented on issue #9238: fix: Add
type specific date truncation functions to BigQuery
Posted by GitBox <gi...@apache.org>.
willbarrett commented on issue #9238: fix: Add type specific date truncation functions to BigQuery
URL: https://github.com/apache/incubator-superset/pull/9238#issuecomment-594698282
Overall looks good but it appears you have some `pylint` and `mypy` issues to resolve. Thanks for taking this on!
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org