From e0fdd3f489590168b877a967687026d347b304c9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:44:11 +0200 Subject: [PATCH 01/14] Merge release into main branch (#517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dependabot[bot] Co-authored-by: Jesús Arroyo Torrens Co-authored-by: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Co-authored-by: Javier Goizueta Co-authored-by: Alberto Hernández Co-authored-by: Pedro-Juan Ferrer Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: vdelacruzb Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- CHANGELOG.md | 5 +++++ clouds/bigquery/CHANGELOG.md | 4 ++++ clouds/bigquery/version | 2 +- clouds/snowflake/CHANGELOG.md | 4 ++++ clouds/snowflake/libraries/javascript/package.json | 5 ++++- clouds/snowflake/version | 2 +- 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70682c788..f88bf367b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ CARTO Analytics Toolbox Core. All notable commits to this project will be documented in this file. +## 2024-06-27 + +- chore(sf): refactor at snowflake native app to an installer (#512) +- chore(bq|quadbin): optimize polyfill (#513) + ## 2024-05-21 - refactor(sf|h3): avoid memory limit exceeded in H3_POLYFILL_TABLE (#501) diff --git a/clouds/bigquery/CHANGELOG.md b/clouds/bigquery/CHANGELOG.md index 2e7b143db..d25171df8 100644 --- a/clouds/bigquery/CHANGELOG.md +++ b/clouds/bigquery/CHANGELOG.md @@ -4,6 +4,10 @@ CARTO Analytics Toolbox Core for BigQuery. All notable commits to this project will be documented in this file. +## [1.2.3] - 2024-06-27 + +- chore(quadbin): optimize polyfill (#513) + ## [1.2.2] - 2024-04-18 - docs(processing): update voronoi doc (#492) diff --git a/clouds/bigquery/version b/clouds/bigquery/version index 23aa83906..0495c4a88 100644 --- a/clouds/bigquery/version +++ b/clouds/bigquery/version @@ -1 +1 @@ -1.2.2 +1.2.3 diff --git a/clouds/snowflake/CHANGELOG.md b/clouds/snowflake/CHANGELOG.md index 31d31204c..176a981d9 100644 --- a/clouds/snowflake/CHANGELOG.md +++ b/clouds/snowflake/CHANGELOG.md @@ -4,6 +4,10 @@ CARTO Analytics Toolbox Core for Snowflake. All notable commits to this project will be documented in this file. +## [1.2.4] - 2024-06-27 + +- chore(sf): refactor at snowflake native app to an installer (#512) + ## [1.2.3] - 2024-05-21 - refactor(h3): avoid memory limit exceeded in H3_POLYFILL_TABLE (#501) diff --git a/clouds/snowflake/libraries/javascript/package.json b/clouds/snowflake/libraries/javascript/package.json index 86fbebf39..9fb6f405f 100644 --- a/clouds/snowflake/libraries/javascript/package.json +++ b/clouds/snowflake/libraries/javascript/package.json @@ -6,12 +6,15 @@ "license": "BSD-3-Clause", "private": true, "dependencies": { - "@math.gl/web-mercator": "^3.6.2", + "@math.gl/web-mercator": "3.6.3", "@mapbox/tile-cover": "3.0.2", "@mapbox/tilebelt": "1.0.2", "long": "4.0.0", "@turf/turf": "6.3.0", "h3-js": "3.7.2", "@placekey/placekey": "1.0.3" + }, + "resolutions": { + "@turf/bbox": "6.5.0" } } diff --git a/clouds/snowflake/version b/clouds/snowflake/version index 0495c4a88..e8ea05db8 100644 --- a/clouds/snowflake/version +++ b/clouds/snowflake/version @@ -1 +1 @@ -1.2.3 +1.2.4 From e1ab4b4128866f3d9e2b27363ba4846aec1f5d56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:51:11 +0200 Subject: [PATCH 02/14] chore(deps): bump scipy from 0.12.0 to 0.12.1 in /clouds/redshift/libraries/python (#518) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- clouds/redshift/libraries/python/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clouds/redshift/libraries/python/requirements.txt b/clouds/redshift/libraries/python/requirements.txt index cc61ca38d..da02dd9d3 100644 --- a/clouds/redshift/libraries/python/requirements.txt +++ b/clouds/redshift/libraries/python/requirements.txt @@ -2,6 +2,6 @@ quadbin==0.2.2 geojson==2.5.0 pygc==1.1.0 numpy==1.8.2 -scipy==0.12.0 +scipy==0.12.1 s2sphere==0.2.5 mercantile==1.2.1 From d63d5ff0f29a26286704a6214443c70b976df872 Mon Sep 17 00:00:00 2001 From: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:14:53 +0200 Subject: [PATCH 03/14] docs(sf): fix native apps installation doc (#519) --- clouds/snowflake/native_app/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clouds/snowflake/native_app/README.md b/clouds/snowflake/native_app/README.md index 4e2a27fca..36764875d 100644 --- a/clouds/snowflake/native_app/README.md +++ b/clouds/snowflake/native_app/README.md @@ -8,7 +8,7 @@ The CARTO Analytics Toolbox for Snowflake is composed of a set of user-defined f #### Install the Analytics Toolbox -This Native App is an installer so it does not contain the actual Analytics Toolbox functions and procedures. For the sake of documenting the process, we'll will assume a database named CARTO, as well as a schema named CARTO in that database, also we assume the app to be called CARTO_INSTALLER. The next guidelines and examples will assume that in order to simplify the onboarding process. +This Native App is an installer so it does not contain the actual Analytics Toolbox functions and procedures. For the sake of documenting the process, we'll will assume a database named CARTO, as well as a schema named CARTO in that database, also we assume the app to be called CARTO_ANALYTICS_TOOLBOX. The next guidelines and examples will assume that in order to simplify the onboarding process. All the database, schema and user can have a different name, but remember to adapt the code snippets accordingly. @@ -26,11 +26,11 @@ CREATE SCHEMA CARTO.CARTO; GRANT ALL ON SCHEMA CARTO.CARTO TO ROLE SYSADMIN; -- Set create function and procedure permissions -GRANT USAGE ON DATABASE CARTO TO APPLICATION CARTO; -GRANT USAGE, CREATE FUNCTION, CREATE PROCEDURE ON SCHEMA CARTO.CARTO TO APPLICATION CARTO; +GRANT USAGE ON DATABASE CARTO TO APPLICATION CARTO_ANALYTICS_TOOLBOX; +GRANT USAGE, CREATE FUNCTION, CREATE PROCEDURE ON SCHEMA CARTO.CARTO TO APPLICATION CARTO_ANALYTICS_TOOLBOX; -- Generate the installer procedure in the specified location -CALL CARTO_INSTALLER.CARTO.GENERATE_INSTALLER('CARTO.CARTO'); +CALL CARTO_ANALYTICS_TOOLBOX.CARTO.GENERATE_INSTALLER('CARTO.CARTO'); -- Update ownership of the install procedure GRANT OWNERSHIP ON PROCEDURE CARTO.CARTO.INSTALL(STRING, STRING) TO ROLE ACCOUNTADMIN REVOKE CURRENT GRANTS; @@ -44,7 +44,7 @@ GRANT USAGE ON FUTURE FUNCTIONS IN SCHEMA CARTO.CARTO TO ROLE PUBLIC; GRANT USAGE ON FUTURE PROCEDURES IN SCHEMA CARTO.CARTO TO ROLE PUBLIC; -- Install the Analytics Toolbox in CARTO.CARTO -CALL CARTO.CARTO.INSTALL('CARTO_INSTALLER', 'CARTO.CARTO'); +CALL CARTO.CARTO.INSTALL('CARTO_ANALYTICS_TOOLBOX', 'CARTO.CARTO'); ``` ### Usage Examples From 501e3730d32d58a2e948e86f9c17961e71bb14aa Mon Sep 17 00:00:00 2001 From: DeanSherwin Date: Tue, 20 Aug 2024 10:04:10 +0200 Subject: [PATCH 04/14] fix(pg): lock numpy to v1.24.4 until pandas supports 2.X.X (#520) --- clouds/postgres/common/python3_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clouds/postgres/common/python3_requirements.txt b/clouds/postgres/common/python3_requirements.txt index ab1c68abe..b97632d9f 100644 --- a/clouds/postgres/common/python3_requirements.txt +++ b/clouds/postgres/common/python3_requirements.txt @@ -14,4 +14,4 @@ pandas==1.3.2 SQLAlchemy==1.4.23 mapbox-vector-tile==1.2.1 sqlfluff==1.3.1 - +numpy==1.24.4 From 259895d5d78f10cb3a7d05ec39bab823fec22cee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 18:25:21 +0200 Subject: [PATCH 05/14] Merge release into main branch (#522) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f88bf367b..ad0ccff19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ CARTO Analytics Toolbox Core. All notable commits to this project will be documented in this file. +## 2024-08-22 + +- chore(rs): bump scipy from 0.12.0 to 0.12.1 in /clouds/redshift/libraries/python (#518) +- docs(sf): fix native apps installation doc (#519) +- fix(pg): lock numpy to v1.24.4 until pandas supports 2.X.X (#520) + ## 2024-06-27 - chore(sf): refactor at snowflake native app to an installer (#512) From 874ffae11631e46d921919e451b4233529eee937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Olaya?= Date: Tue, 3 Sep 2024 12:53:35 +0200 Subject: [PATCH 06/14] feat(sf): added warehouse option for SF (#524) --- clouds/snowflake/.env.template | 1 + clouds/snowflake/common/run-query.js | 3 ++- clouds/snowflake/common/run-script.js | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clouds/snowflake/.env.template b/clouds/snowflake/.env.template index 0bfa4262b..967be5aa0 100644 --- a/clouds/snowflake/.env.template +++ b/clouds/snowflake/.env.template @@ -13,3 +13,4 @@ SF_USER= SF_PASSWORD= SF_ROLE= # optional SF_SHARE= # optional +SF_WAREHOUSE= # optional diff --git a/clouds/snowflake/common/run-query.js b/clouds/snowflake/common/run-query.js index e5274e112..f51b92a62 100755 --- a/clouds/snowflake/common/run-query.js +++ b/clouds/snowflake/common/run-query.js @@ -8,7 +8,8 @@ const connection = snowflake.createConnection({ account: process.env.SF_ACCOUNT, username: process.env.SF_USER, password: process.env.SF_PASSWORD, - role: process.env.SF_ROLE + role: process.env.SF_ROLE, + warehouse: process.env.SF_WAREHOUSE, }); connection.connect((err) => { diff --git a/clouds/snowflake/common/run-script.js b/clouds/snowflake/common/run-script.js index 902808742..d3203d4ec 100755 --- a/clouds/snowflake/common/run-script.js +++ b/clouds/snowflake/common/run-script.js @@ -18,7 +18,8 @@ const connection = snowflake.createConnection({ account: process.env.SF_ACCOUNT, username: process.env.SF_USER, password: process.env.SF_PASSWORD, - role: process.env.SF_ROLE + role: process.env.SF_ROLE, + warehouse: process.env.SF_WAREHOUSE, }); connection.connect((err) => { From 775fb874e85e627aff0e92564c86ae691356a098 Mon Sep 17 00:00:00 2001 From: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:56:48 +0200 Subject: [PATCH 07/14] chore(bq): increse jest timeout to 30000 (#525) --- clouds/bigquery/modules/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clouds/bigquery/modules/Makefile b/clouds/bigquery/modules/Makefile index 521fe1ce2..61892d7b8 100644 --- a/clouds/bigquery/modules/Makefile +++ b/clouds/bigquery/modules/Makefile @@ -85,7 +85,7 @@ test: check $(NODE_MODULES_DEV) if [ ! -z "$$TESTS" ]; then \ GOOGLE_APPLICATION_CREDENTIALS=$(GOOGLE_APPLICATION_CREDENTIALS) \ PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \ - jest --testTimeout=250000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$TESTS \ + jest --testTimeout=300000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$TESTS \ --setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \ OLD_TEST=$(TEST_DIR)/$$m/old-test; \ if [ -d $$OLD_TEST ]; then \ From 4a2376e34933d7e5e1f415559894d58b0155cfab Mon Sep 17 00:00:00 2001 From: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:46:06 +0200 Subject: [PATCH 08/14] docs(sf): add docs on how to update the analytics toolbox from a native app (#527) --- clouds/snowflake/native_app/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/clouds/snowflake/native_app/README.md b/clouds/snowflake/native_app/README.md index 36764875d..2a35ba16b 100644 --- a/clouds/snowflake/native_app/README.md +++ b/clouds/snowflake/native_app/README.md @@ -47,6 +47,26 @@ GRANT USAGE ON FUTURE PROCEDURES IN SCHEMA CARTO.CARTO TO ROLE PUBLIC; CALL CARTO.CARTO.INSTALL('CARTO_ANALYTICS_TOOLBOX', 'CARTO.CARTO'); ``` +##### * Update the Analytics Toolbox + +When a new package of the Analytics Toolbox gets released, the Analytics Toolbox installer gets updated automatically. As in the first installation most of the required permissions were already set, only the next queries should be necessary in order to update the Analytics Toolbox. + +``` +-- Set admin permissions +USE ROLE ACCOUNTADMIN; + +-- Generate the installer procedure in the specified location +CALL CARTO_ANALYTICS_TOOLBOX.CARTO.GENERATE_INSTALLER('CARTO.CARTO'); + +-- Update ownership of the install procedure +GRANT OWNERSHIP ON PROCEDURE CARTO.CARTO.INSTALL(STRING, STRING) TO ROLE ACCOUNTADMIN REVOKE CURRENT GRANTS; + +-- Install the Analytics Toolbox in CARTO.CARTO +CALL CARTO.CARTO.INSTALL('CARTO_ANALYTICS_TOOLBOX', 'CARTO.CARTO'); +``` + +If your Analytics Toolbox doesn't get updated properly please try to drop the app, get it back from Snowflake Marketplace and follow the Step 1. + ### Usage Examples Please refer to CARTO's [SQL reference](https://docs.carto.com/data-and-analysis/analytics-toolbox-for-snowflake/sql-reference) to find the full list of available functions and procedures as well as examples. From 05a4bb14c04355764a78713fa690cf2b40ab47f2 Mon Sep 17 00:00:00 2001 From: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:02:50 +0200 Subject: [PATCH 09/14] chore(sf): update python version on stored procedures from 3.8 to 3.9 (#528) --- clouds/snowflake/native_app/SETUP_SCRIPT.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clouds/snowflake/native_app/SETUP_SCRIPT.sql b/clouds/snowflake/native_app/SETUP_SCRIPT.sql index 967e3204d..9983f186f 100644 --- a/clouds/snowflake/native_app/SETUP_SCRIPT.sql +++ b/clouds/snowflake/native_app/SETUP_SCRIPT.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE PROCEDURE @@SF_APP_SCHEMA@@.GET_MODULES_SQL_FROM_STAGE() returns string language python - runtime_version = '3.8' + RUNTIME_VERSION = '3.9' packages = ('snowflake-snowpark-python') imports = ( '/get_modules_sql_from_stage.py', From 1dfc364771d892000bf7b701576b99cceb123f10 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:03:25 +0200 Subject: [PATCH 10/14] Merge release into main branch (#530) --- CHANGELOG.md | 7 +++++++ clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql | 4 ++-- clouds/snowflake/CHANGELOG.md | 8 +++++++- clouds/snowflake/README.md | 1 + clouds/snowflake/common/run-query.js | 2 +- clouds/snowflake/common/run-script.js | 2 +- .../snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql | 1 - clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql | 2 +- clouds/snowflake/version | 2 +- 9 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad0ccff19..8000d888a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ CARTO Analytics Toolbox Core. All notable commits to this project will be documented in this file. +## 2024-09-23 + +- feat(sf): added warehouse option for SF (#524) +- chore(bq): increse jest timeout to 30000 (#525) +- docs(sf): add docs on how to update the analytics toolbox from a native app (#527) +- chore(sf): update python version on stored procedures from 3.8 to 3.9 (#528) + ## 2024-08-22 - chore(rs): bump scipy from 0.12.0 to 0.12.1 in /clouds/redshift/libraries/python (#518) diff --git a/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql b/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql index 93b69f8b9..9372273b8 100644 --- a/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql +++ b/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql @@ -76,9 +76,9 @@ RETURNS INT64 AS (( WITH __geog_area AS ( SELECT + 508164597540055.75 AS q0_area, ST_AREA(geog) AS geog_area, - COS(ST_Y(ST_CENTROID(geog)) * ACOS(-1) / 180) AS cos_geog_lat, - 508164597540055.75 AS q0_area + COS(ST_Y(ST_CENTROID(geog)) * ACOS(-1) / 180) AS cos_geog_lat ) -- compute the resolution of cells that match the geog area SELECT IF(geog_area > 0 AND cos_geog_lat > 0, diff --git a/clouds/snowflake/CHANGELOG.md b/clouds/snowflake/CHANGELOG.md index 176a981d9..cd3735e94 100644 --- a/clouds/snowflake/CHANGELOG.md +++ b/clouds/snowflake/CHANGELOG.md @@ -4,9 +4,15 @@ CARTO Analytics Toolbox Core for Snowflake. All notable commits to this project will be documented in this file. +## [1.2.5] - 2024-09-23 + +- feat: added warehouse option for SF (#524) +- docs: add docs on how to update the analytics toolbox from a native app (#527) +- chore: update python version on stored procedures from 3.8 to 3.9 (#528) + ## [1.2.4] - 2024-06-27 -- chore(sf): refactor at snowflake native app to an installer (#512) +- chore: refactor at snowflake native app to an installer (#512) ## [1.2.3] - 2024-05-21 diff --git a/clouds/snowflake/README.md b/clouds/snowflake/README.md index d87854d61..2cd72ac99 100644 --- a/clouds/snowflake/README.md +++ b/clouds/snowflake/README.md @@ -24,6 +24,7 @@ SF_USER= SF_PASSWORD= SF_ROLE= # optional SF_SHARE= # optional +SF_WAREHOUSE= # optional ``` ## Structure diff --git a/clouds/snowflake/common/run-query.js b/clouds/snowflake/common/run-query.js index f51b92a62..e9c0ef6eb 100755 --- a/clouds/snowflake/common/run-query.js +++ b/clouds/snowflake/common/run-query.js @@ -9,7 +9,7 @@ const connection = snowflake.createConnection({ username: process.env.SF_USER, password: process.env.SF_PASSWORD, role: process.env.SF_ROLE, - warehouse: process.env.SF_WAREHOUSE, + warehouse: process.env.SF_WAREHOUSE }); connection.connect((err) => { diff --git a/clouds/snowflake/common/run-script.js b/clouds/snowflake/common/run-script.js index d3203d4ec..55d015c93 100755 --- a/clouds/snowflake/common/run-script.js +++ b/clouds/snowflake/common/run-script.js @@ -19,7 +19,7 @@ const connection = snowflake.createConnection({ username: process.env.SF_USER, password: process.env.SF_PASSWORD, role: process.env.SF_ROLE, - warehouse: process.env.SF_WAREHOUSE, + warehouse: process.env.SF_WAREHOUSE }); connection.connect((err) => { diff --git a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql index e56c62d90..cf4b8ce49 100644 --- a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql +++ b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql @@ -53,4 +53,3 @@ AS $$ SELECT @@SF_SCHEMA@@._QUADBIN_STRING_TOINT(@@SF_SCHEMA@@._QUADBIN_FROMZXY(z, x, y)) FROM __zxy $$; - diff --git a/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql b/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql index 6e0dcf188..17bcf8990 100644 --- a/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql +++ b/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql @@ -47,4 +47,4 @@ AS $$ resolution * 2 ) ) -$$; \ No newline at end of file +$$; diff --git a/clouds/snowflake/version b/clouds/snowflake/version index e8ea05db8..c813fe116 100644 --- a/clouds/snowflake/version +++ b/clouds/snowflake/version @@ -1 +1 @@ -1.2.4 +1.2.5 From c0b02a72a813471ef7c27b20e9cd97960effcacb Mon Sep 17 00:00:00 2001 From: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:27:52 +0200 Subject: [PATCH 11/14] chore(bq): fix @google-cloud/bigquery to version 7.9.0 (#531) --- clouds/bigquery/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clouds/bigquery/common/package.json b/clouds/bigquery/common/package.json index cb669992e..0343e37c9 100644 --- a/clouds/bigquery/common/package.json +++ b/clouds/bigquery/common/package.json @@ -1,7 +1,7 @@ { "license": "BSD-3-Clause", "devDependencies": { - "@google-cloud/bigquery": "^7.3.0", + "@google-cloud/bigquery": "7.9.0", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.0.0", From 3bb797a3869b6a2658a37967d9bfc84d4fda1dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Olaya?= Date: Wed, 23 Oct 2024 15:03:51 +0200 Subject: [PATCH 12/14] chore(bq,sf,rs,pg|h3,quadbin): added "geo" aliases for certain functions (#526) --- .../modules/doc/h3/H3_FROMGEOGPOINT.md | 2 +- .../doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- .../modules/sql/h3/H3_FROMGEOGPOINT.sql | 15 +++++++-- .../sql/quadbin/QUADBIN_FROMGEOGPOINT.sql | 15 +++++++-- .../modules/test/h3/H3_FROMGEOGPOINT.test.js | 31 +++++++++++++++++ .../quadbin/QUADBIN_FROMGEOGPOINT.test.js | 7 ++++ .../modules/doc/h3/H3_FROMGEOGPOINT.md | 2 +- .../doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- .../modules/sql/h3/H3_FROMGEOGPOINT.sql | 17 ++++++++-- .../sql/quadbin/QUADBIN_FROMGEOGPOINT.sql | 17 ++++++++-- .../modules/test/h3/test_H3_FROMGEOGPOINT.py | 31 +++++++++++++++++ .../quadbin/test_QUADBIN_FROMGEOGPOINT.py | 8 +++++ .../doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- .../sql/quadbin/QUADBIN_FROMGEOGPOINT.sql | 15 +++++++-- .../quadbin/test_QUADBIN_FROMGEOGPOINT.py | 9 +++++ .../modules/doc/h3/H3_FROMGEOGPOINT.md | 2 +- .../doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- .../modules/sql/h3/H3_FROMGEOGPOINT.sql | 8 +++++ .../sql/quadbin/QUADBIN_FROMGEOGPOINT.sql | 14 ++++++-- ...POINT.spec.js => H3_FROMGEOGPOINT.test.js} | 33 +++++++++++++++++++ ...LONGLAT.spec.js => H3_FROMLONGLAT.test.js} | 0 .../quadbin/QUADBIN_FROMGEOGPOINT.test.js | 7 ++++ 22 files changed, 216 insertions(+), 25 deletions(-) rename clouds/snowflake/modules/test/h3/{H3_FROMGEOGPOINT.spec.js => H3_FROMGEOGPOINT.test.js} (62%) rename clouds/snowflake/modules/test/h3/{H3_FROMLONGLAT.spec.js => H3_FROMLONGLAT.test.js} (100%) 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 From aa87e639ec057dd950001e95769a5b91ca7957a3 Mon Sep 17 00:00:00 2001 From: vdelacruzb Date: Mon, 28 Oct 2024 11:43:52 +0100 Subject: [PATCH 13/14] update changelogs --- CHANGELOG.md | 5 +++++ clouds/bigquery/CHANGELOG.md | 5 +++++ clouds/bigquery/version | 2 +- clouds/postgres/CHANGELOG.md | 4 ++++ clouds/postgres/version | 2 +- clouds/redshift/CHANGELOG.md | 4 ++++ clouds/redshift/version | 2 +- clouds/snowflake/CHANGELOG.md | 4 ++++ clouds/snowflake/version | 2 +- 9 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8000d888a..70c97ee15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ CARTO Analytics Toolbox Core. All notable commits to this project will be documented in this file. +## 2024-10-28 + +- chore(bq): fix @google-cloud/bigquery to version 7.9.0 (#531) +- chore(bq,sf,rs,pg|h3,quadbin): added "geo" aliases for certain functions (#526) + ## 2024-09-23 - feat(sf): added warehouse option for SF (#524) diff --git a/clouds/bigquery/CHANGELOG.md b/clouds/bigquery/CHANGELOG.md index d25171df8..d82bac8e9 100644 --- a/clouds/bigquery/CHANGELOG.md +++ b/clouds/bigquery/CHANGELOG.md @@ -4,6 +4,11 @@ CARTO Analytics Toolbox Core for BigQuery. All notable commits to this project will be documented in this file. +## [1.2.4] - 2024-10-28 + +- chore: fix @google-cloud/bigquery to version 7.9.0 (#531) +- chore(h3,quadbin): added "geo" aliases for certain functions (#526) + ## [1.2.3] - 2024-06-27 - chore(quadbin): optimize polyfill (#513) diff --git a/clouds/bigquery/version b/clouds/bigquery/version index 0495c4a88..e8ea05db8 100644 --- a/clouds/bigquery/version +++ b/clouds/bigquery/version @@ -1 +1 @@ -1.2.3 +1.2.4 diff --git a/clouds/postgres/CHANGELOG.md b/clouds/postgres/CHANGELOG.md index c79ebd098..c7f3a0185 100644 --- a/clouds/postgres/CHANGELOG.md +++ b/clouds/postgres/CHANGELOG.md @@ -4,6 +4,10 @@ CARTO Analytics Toolbox Core for Postgres. All notable commits to this project will be documented in this file. +## [1.3.1] - 2024-10-28 + +- chore(h3,quadbin): added "geo" aliases for certain functions (#526) + ## [1.3.0] - 2024-01-17 - feat(quadbin): add function QUADBIN_DISTANCE (#457) diff --git a/clouds/postgres/version b/clouds/postgres/version index f0bb29e76..3a3cd8cc8 100644 --- a/clouds/postgres/version +++ b/clouds/postgres/version @@ -1 +1 @@ -1.3.0 +1.3.1 diff --git a/clouds/redshift/CHANGELOG.md b/clouds/redshift/CHANGELOG.md index 2bb8d7e69..86dd8ef25 100644 --- a/clouds/redshift/CHANGELOG.md +++ b/clouds/redshift/CHANGELOG.md @@ -4,6 +4,10 @@ CARTO Analytics Toolbox Core for Redshift. All notable commits to this project will be documented in this file. +## [1.1.2] - 2024-10-28 + +- chore(h3,quadbin): added "geo" aliases for certain functions (#526) + ## [1.1.1] - 2024-04-18 - docs(processing): update voronoi doc (#492) diff --git a/clouds/redshift/version b/clouds/redshift/version index 524cb5524..45a1b3f44 100644 --- a/clouds/redshift/version +++ b/clouds/redshift/version @@ -1 +1 @@ -1.1.1 +1.1.2 diff --git a/clouds/snowflake/CHANGELOG.md b/clouds/snowflake/CHANGELOG.md index cd3735e94..f0e703b58 100644 --- a/clouds/snowflake/CHANGELOG.md +++ b/clouds/snowflake/CHANGELOG.md @@ -4,6 +4,10 @@ CARTO Analytics Toolbox Core for Snowflake. All notable commits to this project will be documented in this file. +## [1.2.6] - 2024-10-28 + +- chore(h3,quadbin): added "geo" aliases for certain functions (#526) + ## [1.2.5] - 2024-09-23 - feat: added warehouse option for SF (#524) diff --git a/clouds/snowflake/version b/clouds/snowflake/version index c813fe116..3c43790f5 100644 --- a/clouds/snowflake/version +++ b/clouds/snowflake/version @@ -1 +1 @@ -1.2.5 +1.2.6 From 48296e428681400afad18ee780eab332326e7cdc Mon Sep 17 00:00:00 2001 From: vdelacruzb Date: Tue, 29 Oct 2024 10:59:09 +0100 Subject: [PATCH 14/14] update docs --- clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md | 2 +- clouds/bigquery/modules/doc/h3/H3_POLYFILL.md | 2 +- clouds/bigquery/modules/doc/h3/H3_POLYFILL_MODE.md | 2 +- clouds/bigquery/modules/doc/h3/H3_POLYFILL_TABLE.md | 2 +- clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md | 2 +- clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL.md | 2 +- clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_MODE.md | 2 +- clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_TABLE.md | 2 +- clouds/bigquery/modules/doc/s2/S2_FROMGEOGPOINT.md | 2 +- clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md | 2 +- clouds/postgres/modules/doc/h3/H3_POLYFILL.md | 2 +- clouds/postgres/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- clouds/postgres/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md | 2 +- clouds/postgres/modules/doc/quadbin/QUADBIN_POLYFILL.md | 2 +- clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- clouds/redshift/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md | 2 +- clouds/redshift/modules/doc/quadbin/QUADBIN_POLYFILL.md | 2 +- clouds/redshift/modules/doc/s2/S2_FROMGEOGPOINT.md | 2 +- clouds/redshift/modules/doc/s2/S2_FROMLONGLAT.md | 2 +- clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md | 2 +- clouds/snowflake/modules/doc/h3/H3_POLYFILL_TABLE.md | 2 +- clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md | 2 +- clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md | 2 +- clouds/snowflake/modules/doc/quadbin/QUADBIN_POLYFILL.md | 2 +- clouds/snowflake/modules/doc/s2/S2_FROMGEOGPOINT.md | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md b/clouds/bigquery/modules/doc/h3/H3_FROMGEOGPOINT.md index 58d018d52..5f92aaee1 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). This function is an alias for `H3_FROMGEOPOINT`. +Returns the H3 cell index that the point belongs to in the requested `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/h3/H3_POLYFILL.md b/clouds/bigquery/modules/doc/h3/H3_POLYFILL.md index 72067fd74..7ff458703 100644 --- a/clouds/bigquery/modules/doc/h3/H3_POLYFILL.md +++ b/clouds/bigquery/modules/doc/h3/H3_POLYFILL.md @@ -6,7 +6,7 @@ H3_POLYFILL(geog, resolution) **Description** -Returns an array of H3 cell indexes contained in the given geography (Polygon, MultiPolygon) at a given level of detail. Containment is determined by the cells' center. This function is equivalent to [`H3_POLYFILL_MODE`](h3#h3_polyfill_mode) with mode `center`. +Returns an array of H3 cell indexes contained in the given geography (Polygon, MultiPolygon) at a requested resolution. Containment is determined by the cells' center. This function is equivalent to [`H3_POLYFILL_MODE`](h3#h3_polyfill_mode) with mode `center`. * `geog`: `GEOGRAPHY` representing the shape to cover. * `resolution`: `INT64` level of detail. The value must be between 0 and 15 ([H3 resolution table](https://h3geo.org/docs/core-library/restable)). diff --git a/clouds/bigquery/modules/doc/h3/H3_POLYFILL_MODE.md b/clouds/bigquery/modules/doc/h3/H3_POLYFILL_MODE.md index da41d4e68..00f2f3891 100644 --- a/clouds/bigquery/modules/doc/h3/H3_POLYFILL_MODE.md +++ b/clouds/bigquery/modules/doc/h3/H3_POLYFILL_MODE.md @@ -6,7 +6,7 @@ H3_POLYFILL_MODE(geog, resolution, mode) **Description** -Returns an array of H3 cell indexes contained in the given geography at a given level of detail. Containment is determined by the mode: center, intersects, contains. +Returns an array of H3 cell indexes contained in the given geography at a requested resolution. Containment is determined by the mode: center, intersects, contains. * `geog`: `GEOGRAPHY` representing the shape to cover. * `resolution`: `INT64` level of detail. The value must be between 0 and 15 ([H3 resolution table](https://h3geo.org/docs/core-library/restable)). diff --git a/clouds/bigquery/modules/doc/h3/H3_POLYFILL_TABLE.md b/clouds/bigquery/modules/doc/h3/H3_POLYFILL_TABLE.md index 885c23b72..5491aabb9 100644 --- a/clouds/bigquery/modules/doc/h3/H3_POLYFILL_TABLE.md +++ b/clouds/bigquery/modules/doc/h3/H3_POLYFILL_TABLE.md @@ -6,7 +6,7 @@ H3_POLYFILL_TABLE(input_query, resolution, mode, output_table) **Description** -Returns a table with the H3 cell indexes contained in the given geography at a given level of detail. Containment is determined by the mode: center, intersects, contains. All the attributes except the geography will be included in the output table, clustered by the h3 column. +Returns a table with the H3 cell indexes contained in the given geography at a requested resolution. Containment is determined by the mode: center, intersects, contains. All the attributes except the geography will be included in the output table, clustered by the h3 column. * `input_query`: `STRING` input data to polyfill. It must contain a column `geom` with the shape to cover. Additionally, other columns can be included. * `resolution`: `INT64` level of detail. The value must be between 0 and 15 ([H3 resolution table](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 0f8496e6a..a72b28323 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. This function is an alias for `QUADBIN_FROMGEOPOINT`. +Returns the Quadbin of a given point at a requested resolution. 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/doc/quadbin/QUADBIN_FROMLONGLAT.md b/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md index e992b2bd1..4cddb420c 100644 --- a/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md +++ b/clouds/bigquery/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md @@ -6,7 +6,7 @@ QUADBIN_FROMLONGLAT(longitude, latitude, resolution) **Description** -Returns the Quadbin representation of a point for a given level of detail and geographic coordinates. +Returns the Quadbin representation of a point for a requested resolution and geographic coordinates. * `longitude`: `FLOAT64` longitude (WGS84) of the point. * `latitude`: `FLOAT64` latitude (WGS84) of the point. diff --git a/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL.md b/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL.md index 86dbb8407..4abbf4126 100644 --- a/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL.md +++ b/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL.md @@ -6,7 +6,7 @@ QUADBIN_POLYFILL(geog, resolution) **Description** -Returns an array of quadbin cell indexes contained in the given geography (Polygon, MultiPolygon) at a given level of detail. Containment is determined by the cells' center. This function is equivalent to [`QUADBIN_POLYFILL_MODE`](quadbin#quadbin_polyfill_mode) with mode `center`. +Returns an array of quadbin cell indexes contained in the given geography (Polygon, MultiPolygon) at a requested resolution. Containment is determined by the cells' center. This function is equivalent to [`QUADBIN_POLYFILL_MODE`](quadbin#quadbin_polyfill_mode) with mode `center`. * `geog`: `GEOGRAPHY` representing the shape to cover. * `resolution`: `INT64` level of detail. The value must be between 0 and 26. diff --git a/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_MODE.md b/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_MODE.md index a88990d71..80e10d6c4 100644 --- a/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_MODE.md +++ b/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_MODE.md @@ -6,7 +6,7 @@ QUADBIN_POLYFILL_MODE(geog, resolution, mode) **Description** -Returns an array of quadbin cell indexes contained in the given geography at a given level of detail. Containment is determined by the mode: center, intersects, contains. +Returns an array of quadbin cell indexes contained in the given geography at a requested resolution. Containment is determined by the mode: center, intersects, contains. * `geog`: `GEOGRAPHY` representing the shape to cover. * `resolution`: `INT64` level of detail. The value must be between 0 and 26. diff --git a/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_TABLE.md b/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_TABLE.md index f3f59728a..ccc695491 100644 --- a/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_TABLE.md +++ b/clouds/bigquery/modules/doc/quadbin/QUADBIN_POLYFILL_TABLE.md @@ -6,7 +6,7 @@ QUADBIN_POLYFILL_TABLE(input_query, resolution, mode, output_table) **Description** -Returns a table with the quadbin cell indexes contained in the given geography at a given level of detail. Containment is determined by the mode: center, intersects, contains. All the attributes except the geography will be included in the output table, clustered by the quadbin column. +Returns a table with the quadbin cell indexes contained in the given geography at a requested resolution. Containment is determined by the mode: center, intersects, contains. All the attributes except the geography will be included in the output table, clustered by the quadbin column. * `input_query`: `STRING` input data to polyfill. It must contain a column `geom` with the shape to cover. Additionally, other columns can be included. * `resolution`: `INT64` level of detail. The value must be between 0 and 26. diff --git a/clouds/bigquery/modules/doc/s2/S2_FROMGEOGPOINT.md b/clouds/bigquery/modules/doc/s2/S2_FROMGEOGPOINT.md index 9e4899640..f7e40ce5a 100644 --- a/clouds/bigquery/modules/doc/s2/S2_FROMGEOGPOINT.md +++ b/clouds/bigquery/modules/doc/s2/S2_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ S2_FROMGEOGPOINT(point, resolution) **Description** -Returns the S2 cell ID of a given point at a given level of detail. +Returns the S2 cell ID of a given point at a requested resolution. * `point`: `GEOGRAPHY` point to get the ID from. * `resolution`: `INT64` level of detail or zoom. diff --git a/clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md b/clouds/postgres/modules/doc/h3/H3_FROMGEOGPOINT.md index c5af10567..3972eebef 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). This function is an alias for `H3_FROMGEOPOINT`. +Returns the H3 cell index that the point belongs to in the requested `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/h3/H3_POLYFILL.md b/clouds/postgres/modules/doc/h3/H3_POLYFILL.md index f0d82c1a3..76b71f69f 100644 --- a/clouds/postgres/modules/doc/h3/H3_POLYFILL.md +++ b/clouds/postgres/modules/doc/h3/H3_POLYFILL.md @@ -6,7 +6,7 @@ H3_POLYFILL(geom, resolution [, mode]) **Description** -Returns an array of H3 cell indexes contained in the given geometry at a given level of detail. Containment is determined by the mode: center, intersects, contains. +Returns an array of H3 cell indexes contained in the given geometry at a requested resolution. Containment is determined by the mode: center, intersects, contains. * `geom`: `GEOMETRY` representing the shape to cover. * `resolution`: `INT` level of detail. The value must be between 0 and 15 ([H3 resolution table](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 b0cf5f192..d8d339541 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. This function is an alias for `QUADBIN_FROMGEOPOINT`. +Returns the Quadbin of a given point at a requested resolution. 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/doc/quadbin/QUADBIN_FROMLONGLAT.md b/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md index 459e6209a..c775c5e42 100644 --- a/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md +++ b/clouds/postgres/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md @@ -6,7 +6,7 @@ QUADBIN_FROMLONGLAT(longitude, latitude, resolution) **Description** -Returns the Quadbin representation of a point for a given level of detail and geographic coordinates. +Returns the Quadbin representation of a point for a requested resolution and geographic coordinates. * `longitude`: `DOUBLE PRECISION` longitude (WGS84) of the point. * `latitude`: `DOUBLE PRECISION` latitude (WGS84) of the point. diff --git a/clouds/postgres/modules/doc/quadbin/QUADBIN_POLYFILL.md b/clouds/postgres/modules/doc/quadbin/QUADBIN_POLYFILL.md index 5634f4200..a6ffed008 100644 --- a/clouds/postgres/modules/doc/quadbin/QUADBIN_POLYFILL.md +++ b/clouds/postgres/modules/doc/quadbin/QUADBIN_POLYFILL.md @@ -6,7 +6,7 @@ QUADBIN_POLYFILL(geom, resolution [, mode]) **Description** -Returns an array of quadbin cell indexes contained in the given geometry at a given level of detail. Containment is determined by the mode: center, intersects, contains. +Returns an array of quadbin cell indexes contained in the given geometry at a requested resolution. Containment is determined by the mode: center, intersects, contains. * `geom`: `GEOMETRY` representing the shape to cover. * `resolution`: `INT` level of detail. The value must be between 0 and 26. diff --git a/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md b/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMGEOGPOINT.md index db16ae0cf..9bceebc8f 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. This function is an alias for `QUADBIN_FROMGEOPOINT`. +Returns the Quadbin of a given point at a requested resolution. 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/doc/quadbin/QUADBIN_FROMLONGLAT.md b/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md index 64988427d..ee210792f 100644 --- a/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md +++ b/clouds/redshift/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md @@ -6,7 +6,7 @@ QUADBIN_FROMLONGLAT(longitude, latitude, resolution) **Description** -Returns the Quadbin representation of a point for a given level of detail and geographic coordinates. +Returns the Quadbin representation of a point for a requested resolution and geographic coordinates. * `longitude`: `FLOAT8` longitude (WGS84) of the point. * `latitude`: `FLOAT8` latitude (WGS84) of the point. diff --git a/clouds/redshift/modules/doc/quadbin/QUADBIN_POLYFILL.md b/clouds/redshift/modules/doc/quadbin/QUADBIN_POLYFILL.md index b639558d1..4a003d066 100644 --- a/clouds/redshift/modules/doc/quadbin/QUADBIN_POLYFILL.md +++ b/clouds/redshift/modules/doc/quadbin/QUADBIN_POLYFILL.md @@ -6,7 +6,7 @@ QUADBIN_POLYFILL(geography, resolution) **Description** -Returns an array of Quadbins that intersect with the given geography at a given level of detail. +Returns an array of Quadbins that intersect with the given geography at a requested resolution. * `geography`: `GEOMETRY` geography to extract the Quadbins from. * `resolution`: `INT` level of detail or zoom. diff --git a/clouds/redshift/modules/doc/s2/S2_FROMGEOGPOINT.md b/clouds/redshift/modules/doc/s2/S2_FROMGEOGPOINT.md index a62c6f5fb..b541d8084 100644 --- a/clouds/redshift/modules/doc/s2/S2_FROMGEOGPOINT.md +++ b/clouds/redshift/modules/doc/s2/S2_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ S2_FROMGEOGPOINT(point, resolution) **Description** -Returns the S2 cell ID of a given point at a given level of detail. +Returns the S2 cell ID of a given point at a requested resolution. * `point`: `GEOGRAPHY` vertical coordinate of the map. * `resolution`: `INT4` level of detail or zoom. diff --git a/clouds/redshift/modules/doc/s2/S2_FROMLONGLAT.md b/clouds/redshift/modules/doc/s2/S2_FROMLONGLAT.md index 6141521a0..958e53b53 100644 --- a/clouds/redshift/modules/doc/s2/S2_FROMLONGLAT.md +++ b/clouds/redshift/modules/doc/s2/S2_FROMLONGLAT.md @@ -6,7 +6,7 @@ S2_FROMLONGLAT(longitude, latitude, resolution) **Description** -Returns the S2 cell ID representation for a given level of detail and geographic coordinates. +Returns the S2 cell ID representation for a requested resolution and geographic coordinates. * `longitude`: `FLOAT8` horizontal coordinate of the map. * `latitude`: `FLOAT8` vertical coordinate of the map. diff --git a/clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md b/clouds/snowflake/modules/doc/h3/H3_FROMGEOGPOINT.md index f6c5f1686..c4cf090db 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). This function is an alias for `H3_FROMGEOPOINT`. +Returns the H3 cell index that the point belongs to in the requested `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/h3/H3_POLYFILL_TABLE.md b/clouds/snowflake/modules/doc/h3/H3_POLYFILL_TABLE.md index 4378802bf..60009de19 100644 --- a/clouds/snowflake/modules/doc/h3/H3_POLYFILL_TABLE.md +++ b/clouds/snowflake/modules/doc/h3/H3_POLYFILL_TABLE.md @@ -6,7 +6,7 @@ H3_POLYFILL_TABLE(input_query, resolution, mode, output_table) **Description** -Returns a table with the H3 cell indexes contained in the given geography at a given level of detail. Containment is determined by the mode: center, intersects, contains. All the attributes except the geography will be included in the output table, clustered by the h3 column. +Returns a table with the H3 cell indexes contained in the given geography at a requested resolution. Containment is determined by the mode: center, intersects, contains. All the attributes except the geography will be included in the output table, clustered by the h3 column. * `input_query`: `STRING` input data to polyfill. It must contain a column `geom` with the shape to cover. Additionally, other columns can be included. * `resolution`: `INT` level of detail. The value must be between 0 and 15 ([H3 resolution table](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 ea240aecb..ef1c01cc2 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. This function is an alias for `QUADBIN_FROMGEOPOINT`. +Returns the Quadbin of a given point at a requested resolution. 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/doc/quadbin/QUADBIN_FROMLONGLAT.md b/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md index d6e28cf3c..b57334cb3 100644 --- a/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md +++ b/clouds/snowflake/modules/doc/quadbin/QUADBIN_FROMLONGLAT.md @@ -6,7 +6,7 @@ QUADBIN_FROMLONGLAT(longitude, latitude, resolution) **Description** -Returns the Quadbin representation of a point for a given level of detail and geographic coordinates. +Returns the Quadbin representation of a point for a requested resolution and geographic coordinates. * `longitude`: `FLOAT64` longitude (WGS84) of the point. * `latitude`: `FLOAT64` latitude (WGS84) of the point. diff --git a/clouds/snowflake/modules/doc/quadbin/QUADBIN_POLYFILL.md b/clouds/snowflake/modules/doc/quadbin/QUADBIN_POLYFILL.md index 18f57a0e9..f8e54f0aa 100644 --- a/clouds/snowflake/modules/doc/quadbin/QUADBIN_POLYFILL.md +++ b/clouds/snowflake/modules/doc/quadbin/QUADBIN_POLYFILL.md @@ -6,7 +6,7 @@ QUADBIN_POLYFILL(geography, resolution) **Description** -Returns an array of Quadbins that intersect with the given geography at a given level of detail. +Returns an array of Quadbins that intersect with the given geography at a requested resolution. * `geography`: `GEOGRAPHY` geography to extract the Quadbins from. * `resolution`: `INT` level of detail or zoom. diff --git a/clouds/snowflake/modules/doc/s2/S2_FROMGEOGPOINT.md b/clouds/snowflake/modules/doc/s2/S2_FROMGEOGPOINT.md index aeb25feae..16d3bf577 100644 --- a/clouds/snowflake/modules/doc/s2/S2_FROMGEOGPOINT.md +++ b/clouds/snowflake/modules/doc/s2/S2_FROMGEOGPOINT.md @@ -6,7 +6,7 @@ S2_FROMGEOGPOINT(point, resolution) **Description** -Returns the S2 cell ID of a given point at a given level of detail. +Returns the S2 cell ID of a given point at a requested resolution. * `point`: `GEOGRAPHY` point to get the ID from. * `resolution`: `INT` level of detail or zoom.