GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: Add BigFrames.bigquery.st_regionstats method by tswast · Pull Request #2200 · google/bigframes Conversation
Collaborator
This commit adds the The implementation includes:
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThis commit adds the `BigFrames.bigquery.st_regionstats` method, which allows users to compute statistics for a raster band within a given geography. The implementation includes: - A new `StRegionStatsOp` in `bigframes/operations/geo_ops.py`. - Compiler implementations for both the SQLGlot and Ibis backends. - A unit test with a SQL snapshot. - A code sample in `samples/snippets/wildfire_risk.py` that demonstrates the use of the new function.
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing "include". Also, "options" might not work if it is keyword-only.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, don't use mutable values as the default.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Uh oh!
There was an error while loading. Please reload this page.
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_regionstats it should also include area.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should put this inside a test file so we actually run it.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should use pytest style not unittest style.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThis commit adds the `BigFrames.bigquery.st_regionstats` method, which allows users to compute statistics for a raster band within a given geography. The implementation includes: - A new `StRegionStatsOp` in `bigframes/operations/geo_ops.py`. - Compiler implementations for both the SQLGlot and Ibis backends. - A unit test with a SQL snapshot. - A system test that demonstrates the use of the new function. This commit also addresses feedback from the code review, including: - Adding `area` to the output struct of `st_regionstats`. - Making the `options` parameter a positional argument. - Adding comments to explain the use of `pass_op`. - Converting the unit test to a pytest-style function. - Moving the sample code to a system test. …ython-bigquery-dataframes into feat-st-regionstats …ython-bigquery-dataframes into feat-st-regionstats This commit introduces the `st_regionstats` method in `bigframes.bigquery`, allowing users to compute statistics for a raster band within a given geography. Key changes: - Added `StRegionStatsOp` in `bigframes/operations/geo_ops.py`. - Implemented compilation logic for the operation in both Ibis and SQLGlot compilers. - Exposed the `st_regionstats` function in `bigframes/bigquery/_operations/geo.py` and the public API. - Added a new `_apply_ternary_op` method to `bigframes.series.Series`. - Included a unit test with a snapshot to verify the generated SQL. - Added a system test that demonstrates the functionality by converting a complex wildfire risk analysis query from SQL to BigFrames. - Refactored compiler registries to support `pass_op=True` for ternary operations, enabling access to operator parameters during compilation.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bad merge. Revert these changes.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs to be reverted too.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThis commit introduces the `st_regionstats` method in `bigframes.bigquery`, allowing users to compute statistics for a raster band within a given geography. Key changes: - Added `StRegionStatsOp` in `bigframes/operations/geo_ops.py`. - Implemented compilation logic for the operation in both Ibis and SQLGlot compilers. - Exposed the `st_regionstats` function in `bigframes/bigquery/_operations/geo.py` and the public API. - Added a new `_apply_ternary_op` method to `bigframes.series.Series`. - Included a unit test with a snapshot to verify the generated SQL. - Added a system test that demonstrates the functionality by converting a complex wildfire risk analysis query from SQL to BigFrames. - Refactored compiler registries to support `pass_op=True` for ternary operations, enabling access to operator parameters during compilation.
|
There was an error while loading. Please reload this page.
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # TODO: Add st_simplify when it is available in BigFrames. | ||
| # https://github.com/googleapis/python-bigquery-dataframes/issues/1497 | ||
| # countries["simplified_geometry"] = bq.st_simplify(countries["geometry"], 10000) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'd like to add st_simplify first so that this sample can work without any todos for us.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # [START bigquery_dataframes_st_regionstats] | ||
| from typing import cast | ||
|
|
||
| import bigframes.bigquery as bq |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Let's use bbq instead of bq.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing in favor of #2228 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.