Skip to content

Commit

Permalink
fix polyfill functions not working with holes
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelacruzb committed Jan 23, 2025
1 parent b5649a7 commit 7596897
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion clouds/bigquery/modules/sql/h3/H3_POLYFILL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ AS ((
IF(resolution < 0 OR resolution > 15,
ERROR('Invalid resolution, should be between 0 and 15'), (
WITH __bbox AS (
SELECT ST_BOUNDINGBOX(geog) AS box
SELECT IF(ST_DIMENSION(geog) = 2,
ST_BOUNDINGBOX(`@@BQ_DATASET@@.ST_ENVELOPE`(ARRAY[geog])),
ST_BOUNDINGBOX(geog)
) AS box
),
__params AS (
SELECT
Expand Down
5 changes: 4 additions & 1 deletion clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.__QUADBIN_POLYFILL_INIT`
RETURNS ARRAY<INT64>
AS ((
WITH __bbox AS (
SELECT ST_BOUNDINGBOX(geog) AS box
SELECT IF(ST_DIMENSION(geog) = 2,
ST_BOUNDINGBOX(`@@BQ_DATASET@@.ST_ENVELOPE`(ARRAY[geog])),
ST_BOUNDINGBOX(geog)
) AS box
),
__params AS (
SELECT
Expand Down

0 comments on commit 7596897

Please sign in to comment.