diff --git a/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql b/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql index 12ad026a3..87e94b053 100644 --- a/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql +++ b/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql @@ -10,3 +10,12 @@ AS ( SAFE.ST_X(geog), SAFE.ST_Y(geog), resolution ) ); + +CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.H3_FROMGEOPOINT` +(geo GEOGRAPHY, resolution INT64) +RETURNS STRING +AS ( + `@@BQ_DATASET@@.H3_FROMGEOGPOINT`( + geo, resolution + ) +); \ No newline at end of file diff --git a/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql b/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql index 53cf9ecd1..81b01e5da 100644 --- a/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -10,3 +10,12 @@ AS ( ST_X(point), ST_Y(point), resolution ) ); + +CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.QUADBIN_FROMGEOPOINT` +(point GEOGRAPHY, resolution INT64) +RETURNS INT64 +AS ( + `@@BQ_DATASET@@.QUADBIN_FROMGEOGPOINT`( + point, resolution + ) +); diff --git a/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql b/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql index 4c66d3c4c..a0370fec2 100644 --- a/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql +++ b/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql @@ -17,3 +17,14 @@ $BODY$ END $BODY$ LANGUAGE sql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION @@PG_SCHEMA@@.H3_FROMGEOPOINT( + geo GEOMETRY, + resolution INT +) +RETURNS VARCHAR(16) +AS +$BODY$ + SELECT @@PG_SCHEMA@@.H3_FROMGEOGPOINT(geo, resolution) +$BODY$ +LANGUAGE sql IMMUTABLE PARALLEL SAFE; diff --git a/clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql b/clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql index ff3a1ea6c..5172bb73d 100644 --- a/clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -20,3 +20,14 @@ $BODY$ FROM __geom4326; $BODY$ LANGUAGE sql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION @@PG_SCHEMA@@.QUADBIN_FROMGEOPOINT( + point GEOMETRY, + resolution INT +) +RETURNS BIGINT +AS +$BODY$ + SELECT @@PG_SCHEMA@@.QUADBIN_FROMGEOGPOINT(point, resolution) +$BODY$ +LANGUAGE sql IMMUTABLE PARALLEL SAFE; diff --git a/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql b/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql index b936d4b8e..56ac60e99 100644 --- a/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -13,3 +13,12 @@ AS $$ ELSE @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(ST_X(ST_TRANSFORM($1, 4326)), ST_Y(ST_TRANSFORM($1, 4326)), $2) END $$ LANGUAGE sql; + +CREATE OR REPLACE FUNCTION @@RS_SCHEMA@@.QUADBIN_FROMGEOPOINT +(GEOMETRY, INT) +-- (point, resolution) +RETURNS BIGINT +STABLE +AS $$ + SELECT @@RS_SCHEMA@@.QUADBIN_FROMGEOGPOINT($1, $2) +$$ LANGUAGE sql; diff --git a/clouds/snowflake/modules/sql/h3/H3_FROMGEOGPOINT.sql b/clouds/snowflake/modules/sql/h3/H3_FROMGEOGPOINT.sql index 069551dd8..49a2bb512 100644 --- a/clouds/snowflake/modules/sql/h3/H3_FROMGEOGPOINT.sql +++ b/clouds/snowflake/modules/sql/h3/H3_FROMGEOGPOINT.sql @@ -11,3 +11,11 @@ AS $$ H3_POINT_TO_CELL_STRING(GEOG, RESOLUTION), NULL) $$; + +CREATE OR REPLACE SECURE FUNCTION @@SF_SCHEMA@@.H3_FROMGEOPOINT +(geo GEOGRAPHY, resolution INT) +RETURNS STRING +IMMUTABLE +AS $$ + @@SF_SCHEMA@@.H3_FROMGEOGPOINT(geo, resolution) +$$; diff --git a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql index b130ee2a6..4d15368d0 100644 --- a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -17,3 +17,11 @@ IMMUTABLE AS $$ @@SF_SCHEMA@@._QUADBIN_FROMLONGLAT(ST_X(point), ST_Y(point), resolution) $$; + +CREATE OR REPLACE SECURE FUNCTION @@SF_SCHEMA@@.QUADBIN_FROMGEOPOINT +(point GEOGRAPHY, resolution INT) +RETURNS BIGINT +IMMUTABLE +AS $$ + @@SF_SCHEMA@@._QUADBIN_FROMGEOGPOINT(point, resolution) +$$; \ No newline at end of file