Skip to content

Commit

Permalink
added "geo" aliases for certain functions
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Sep 6, 2024
1 parent 259895d commit 838e4ab
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
);
9 changes: 9 additions & 0 deletions clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
);
11 changes: 11 additions & 0 deletions clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
11 changes: 11 additions & 0 deletions clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
9 changes: 9 additions & 0 deletions clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 8 additions & 0 deletions clouds/snowflake/modules/sql/h3/H3_FROMGEOGPOINT.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
$$;
Original file line number Diff line number Diff line change
Expand Up @@ -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)
$$;

0 comments on commit 838e4ab

Please sign in to comment.