diff --git a/clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md b/clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md index 63bd18b66..58d018d52 100644 --- a/clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md +++ b/clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ H3_FROMGEOGPOINT(point, resolution) **Description** -Returns the H3 cell index that the point belongs to in the required `resolution`. It will return `null` on error (invalid geography type or resolution out of bounds). +Returns the H3 cell index that the point belongs to in the required `resolution`. It will return `null` on error (invalid geography type or resolution out of bounds). This function is an alias for `H3_FROMGEOPOINT`. * `point`: `GEOGRAPHY` point to get the H3 cell from. * `resolution`: `INT64` number between 0 and 15 with the [H3 resolution](https://h3geo.org/docs/core-library/restable). diff --git a/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md b/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md index 59799e32f..0f8496e6a 100644 --- a/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md +++ b/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ QUADBIN_FROMGEOGPOINT(point, resolution) **Description** -Returns the Quadbin of a given point at a given level of detail. +Returns the Quadbin of a given point at a given level of detail. This function is an alias for `QUADBIN_FROMGEOPOINT`. * `point`: `GEOGRAPHY` point to get the Quadbin from. * `resolution`: `INT64` level of detail or zoom. diff --git a/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql b/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql index 12ad026a3..f6725b114 100644 --- a/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql +++ b/clouds/bigquery/modules/sql/h3/H3_FROMGEOGPOINT.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2021 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2021-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.H3_FROMGEOGPOINT` (geog GEOGRAPHY, resolution INT64) @@ -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 + ) +); diff --git a/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql b/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql index 53cf9ecd1..94eaa4570 100644 --- a/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/bigquery/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2022 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2022-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.QUADBIN_FROMGEOGPOINT` (point GEOGRAPHY, resolution INT64) @@ -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/bigquery/modules/test/h3/H3_FROMGEOGPOINT.test.js b/clouds/bigquery/modules/test/h3/H3_FROMGEOGPOINT.test.js index fe75d3e43..f8ce4d8aa 100644 --- a/clouds/bigquery/modules/test/h3/H3_FROMGEOGPOINT.test.js +++ b/clouds/bigquery/modules/test/h3/H3_FROMGEOGPOINT.test.js @@ -50,4 +50,35 @@ test('H3_FROMGEOGPOINT returns NULL with non POINT geographies', async () => { null, null ]); +}); + +test('H3_FROMGEOPOINT returns the proper INT64', async () => { + const query = ` + WITH inputs AS + ( + SELECT 1 AS id, ST_GEOGPOINT(-122.0553238, 37.3615593) as geom, 5 as resolution UNION ALL + SELECT 2 AS id, ST_GEOGPOINT(-164.991559, 30.943387) as geom, 5 as resolution UNION ALL + SELECT 3 AS id, ST_GEOGPOINT(71.52790329909925, 46.04189431883772) as geom, 15 as resolution UNION ALL + + -- null inputs + SELECT 4 AS id, NULL AS geom, 5 as resolution UNION ALL + SELECT 5 AS id, ST_GEOGPOINT(-122.0553238, 37.3615593) as geom, -1 as resolution UNION ALL + SELECT 6 AS id, ST_GEOGPOINT(-122.0553238, 37.3615593) as geom, 20 as resolution UNION ALL + SELECT 7 AS id, ST_GEOGPOINT(-122.0553238, 37.3615593) as geom, NULL as resolution + ) + SELECT CAST(\`@@BQ_DATASET@@.H3_FROMGEOPOINT\`(geom, resolution) AS STRING) as h3_id + FROM inputs + ORDER BY id ASC + `; + const rows = await runQuery(query); + expect(rows.length).toEqual(7); + expect(rows.map((r) => r.h3_id)).toEqual([ + '85283473fffffff', + '8547732ffffffff', + '8f2000000000000', + null, + null, + null, + null + ]); }); \ No newline at end of file diff --git a/clouds/bigquery/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js b/clouds/bigquery/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js index 51f2a03dd..93b094856 100644 --- a/clouds/bigquery/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js +++ b/clouds/bigquery/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js @@ -5,4 +5,11 @@ test('QUADBIN_FROMGEOGPOINT should work', async () => { const rows = await runQuery(query); expect(rows.length).toEqual(1); expect(rows[0].output).toEqual('5209574053332910079'); +}); + +test('QUADBIN_FROMGEOPOINT should work', async () => { + const query = 'SELECT CAST(`@@BQ_DATASET@@.QUADBIN_FROMGEOPOINT`(ST_GEOGPOINT(40.4168, -3.7038), 4) AS STRING) AS output'; + const rows = await runQuery(query); + expect(rows.length).toEqual(1); + expect(rows[0].output).toEqual('5209574053332910079'); }); \ No newline at end of file diff --git a/clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md b/clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md index acd6c6a4f..c5af10567 100644 --- a/clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md +++ b/clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ H3_FROMGEOGPOINT(point, resolution) **Description** -Returns the H3 cell index that the point belongs to in the required `resolution`. It will return `null` on error (invalid geography type or resolution out of bounds). +Returns the H3 cell index that the point belongs to in the required `resolution`. It will return `null` on error (invalid geography type or resolution out of bounds). This function is an alias for `H3_FROMGEOPOINT`. * `point`: `GEOMETRY` point to get the H3 cell from. * `resolution`: `INT` number between 0 and 15 with the [H3 resolution](https://h3geo.org/docs/core-library/restable). diff --git a/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md b/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md index 18a095d29..b0cf5f192 100644 --- a/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md +++ b/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ QUADBIN_FROMGEOGPOINT(point, resolution) **Description** -Returns the Quadbin of a given point at a given level of detail. +Returns the Quadbin of a given point at a given level of detail. This function is an alias for `QUADBIN_FROMGEOPOINT`. * `point`: `GEOMETRY` point to get the Quadbin from. * `resolution`: `BIGINT` level of detail or zoom. diff --git a/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql b/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql index 4c66d3c4c..664818065 100644 --- a/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql +++ b/clouds/postgres/modules/sql/h3/H3_FROMGEOGPOINT.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2023 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2023-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION @@PG_SCHEMA@@.H3_FROMGEOGPOINT( geog GEOMETRY, @@ -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..140020bb5 100644 --- a/clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/postgres/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2022 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2022-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION @@PG_SCHEMA@@.QUADBIN_FROMGEOGPOINT( point GEOMETRY, @@ -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/postgres/modules/test/h3/test_H3_FROMGEOGPOINT.py b/clouds/postgres/modules/test/h3/test_H3_FROMGEOGPOINT.py index b75073ead..a829113ef 100644 --- a/clouds/postgres/modules/test/h3/test_H3_FROMGEOGPOINT.py +++ b/clouds/postgres/modules/test/h3/test_H3_FROMGEOGPOINT.py @@ -51,3 +51,34 @@ def test_h3_fromgeogpoint_non_points(): assert result[0][0] is None assert result[1][0] is None assert result[2][0] is None + + +def test_h3_fromgeopoint(): + """Returns the proper index.""" + result = run_query( + """ + WITH inputs AS + ( + SELECT 1 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, 5 as resolution UNION ALL + SELECT 2 AS id, ST_POINT(-164.991559, 30.943387) as geom, 5 as resolution UNION ALL + SELECT 3 AS id, ST_POINT(71.52790329909925, 46.04189431883772) as geom, 15 as resolution UNION ALL + + -- null inputs + SELECT 4 AS id, NULL AS geom, 5 as resolution UNION ALL + SELECT 5 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, -1 as resolution UNION ALL + SELECT 6 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, 20 as resolution UNION ALL + SELECT 7 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, NULL as resolution + ) + SELECT @@PG_SCHEMA@@.H3_FROMGEOPOINT(geom, resolution) as h3_id + FROM inputs + ORDER BY id ASC + """ # noqa + ) + assert len(result) == 7 + assert result[0][0] == '85283473fffffff' + assert result[1][0] == '8547732ffffffff' + assert result[2][0] == '8f2000000000000' + assert result[3][0] is None + assert result[4][0] is None + assert result[5][0] is None + assert result[6][0] is None diff --git a/clouds/postgres/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py b/clouds/postgres/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py index 0589405c2..525d0387e 100644 --- a/clouds/postgres/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py +++ b/clouds/postgres/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py @@ -29,3 +29,11 @@ def test_quadbin_fromgeogpoint_other_srid(): """ ) assert result[0][0] == 5209574053332910079 + + +def test_quadbin_fromgeopoint_no_srid(): + """Computes quadbin for point with no SRID.""" + result = run_query( + 'SELECT @@PG_SCHEMA@@.QUADBIN_FROMGEOPOINT(ST_MAKEPOINT(40.4168, -3.7038), 4)' + ) + assert result[0][0] == 5209574053332910079 diff --git a/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md b/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md index 344f309d1..db16ae0cf 100644 --- a/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md +++ b/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ QUADBIN_FROMGEOGPOINT(point, resolution) **Description** -Returns the Quadbin of a given point at a given level of detail. +Returns the Quadbin of a given point at a given level of detail. This function is an alias for `QUADBIN_FROMGEOPOINT`. * `point`: `GEOMETRY` point to get the Quadbin from. * `resolution`: `INT` level of detail or zoom. diff --git a/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql b/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql index b936d4b8e..1c208255e 100644 --- a/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/redshift/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2022 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2022-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION @@RS_SCHEMA@@.QUADBIN_FROMGEOGPOINT (GEOMETRY, INT) @@ -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/redshift/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py b/clouds/redshift/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py index 0c16b71f2..eccd396a7 100644 --- a/clouds/redshift/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py +++ b/clouds/redshift/modules/test/quadbin/test_QUADBIN_FROMGEOGPOINT.py @@ -8,3 +8,12 @@ def test_quadbin_fromgeogpoint(): assert len(result[0]) == 1 assert result[0][0] == 5209574053332910079 + + +def test_quadbin_fromgeopoint(): + result = run_query( + 'SELECT @@RS_SCHEMA@@.QUADBIN_FROMGEOPOINT(ST_POINT(40.4168, -3.7038),4)' + ) + + assert len(result[0]) == 1 + assert result[0][0] == 5209574053332910079 \ No newline at end of file diff --git a/clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md b/clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md index 73ac27d77..f6c5f1686 100644 --- a/clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md +++ b/clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ H3_FROMGEOGPOINT(point, resolution) **Description** -Returns the H3 cell index that the point belongs to in the required `resolution`. It will return `null` on error (invalid geography type or resolution out of bounds). +Returns the H3 cell index that the point belongs to in the required `resolution`. It will return `null` on error (invalid geography type or resolution out of bounds). This function is an alias for `H3_FROMGEOPOINT`. * `point`: `GEOGRAPHY` point to get the H3 cell from. * `resolution`: `INT` number between 0 and 15 with the [H3 resolution](https://h3geo.org/docs/core-library/restable). diff --git a/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md b/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md index 55add4864..ea240aecb 100644 --- a/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md +++ b/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ QUADBIN_FROMGEOGPOINT(point, resolution) **Description** -Returns the Quadbin of a given point at a given level of detail. +Returns the Quadbin of a given point at a given level of detail. This function is an alias for `QUADBIN_FROMGEOPOINT`. * `point`: `GEOGRAPHY` point to get the Quadbin from. * `resolution`: `INT` level of detail or zoom. 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..4b6efa3c3 100644 --- a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql +++ b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMGEOGPOINT.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2022 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2022-2024 CARTO +-------------------------------- CREATE OR REPLACE SECURE FUNCTION @@SF_SCHEMA@@.QUADBIN_FROMGEOGPOINT (point GEOGRAPHY, resolution INT) @@ -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) +$$; diff --git a/clouds/snowflake/modules/test/h3/H3_FROMGEOGPOINT.spec.js b/clouds/snowflake/modules/test/h3/H3_FROMGEOGPOINT.test.js similarity index 62% rename from clouds/snowflake/modules/test/h3/H3_FROMGEOGPOINT.spec.js rename to clouds/snowflake/modules/test/h3/H3_FROMGEOGPOINT.test.js index 1864f6f9a..a7f87c809 100644 --- a/clouds/snowflake/modules/test/h3/H3_FROMGEOGPOINT.spec.js +++ b/clouds/snowflake/modules/test/h3/H3_FROMGEOGPOINT.test.js @@ -53,4 +53,37 @@ test('H3_FROMGEOGPOINT returns NULL with non POINT geographies', async () => { null, null ]); +}); + +test('H3_FROMGEOPOINT returns the proper INT64', async () => { + const query = ` + WITH inputs AS + ( + SELECT 1 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, 5 as resolution UNION ALL + SELECT 2 AS id, ST_POINT(-164.991559, 30.943387) as geom, 5 as resolution UNION ALL + SELECT 3 AS id, ST_POINT(71.52790329909925, 46.04189431883772) as geom, 15 as resolution UNION ALL + + -- null inputs + SELECT 4 AS id, TRY_TO_GEOGRAPHY(NULL) AS geom, 5 as resolution UNION ALL + SELECT 5 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, -1 as resolution UNION ALL + SELECT 6 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, 20 as resolution UNION ALL + SELECT 7 AS id, ST_POINT(-122.0553238, 37.3615593) as geom, NULL as resolution + ) + SELECT + CAST(H3_FROMGEOPOINT(geom, resolution) AS STRING) as h3_id + FROM inputs + ORDER BY id ASC + `; + + const rows = await runQuery(query); + expect(rows.length).toEqual(7); + expect(rows.map((r) => r.H3_ID)).toEqual([ + '85283473fffffff', + '8547732ffffffff', + '8f2000000000000', + null, + null, + null, + null + ]); }); \ No newline at end of file diff --git a/clouds/snowflake/modules/test/h3/H3_FROMLONGLAT.spec.js b/clouds/snowflake/modules/test/h3/H3_FROMLONGLAT.test.js similarity index 100% rename from clouds/snowflake/modules/test/h3/H3_FROMLONGLAT.spec.js rename to clouds/snowflake/modules/test/h3/H3_FROMLONGLAT.test.js diff --git a/clouds/snowflake/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js b/clouds/snowflake/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js index dc65b4adb..b90e2efd2 100644 --- a/clouds/snowflake/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js +++ b/clouds/snowflake/modules/test/quadbin/QUADBIN_FROMGEOGPOINT.test.js @@ -5,4 +5,11 @@ test('QUADBIN_FROMGEOGPOINT should work', async () => { const rows = await runQuery(query); expect(rows.length).toEqual(1); expect(rows[0].OUTPUT).toEqual('5209574053332910079'); +}); + +test('QUADBIN_FROMGEOPOINT should work', async () => { + const query = 'SELECT CAST(QUADBIN_FROMGEOPOINT(ST_POINT(40.4168, -3.7038), 4) AS STRING) AS OUTPUT'; + const rows = await runQuery(query); + expect(rows.length).toEqual(1); + expect(rows[0].OUTPUT).toEqual('5209574053332910079'); }); \ No newline at end of file