From 006c30d00f1538f2d6933063a7bb23346552d725 Mon Sep 17 00:00:00 2001 From: vdelacruzb Date: Tue, 9 Jan 2024 18:53:43 +0100 Subject: [PATCH] update internal function used by st_tileenvelope --- .../bigquery/modules/sql/constructors/ST_TILEENVELOPE.sql | 4 ++-- .../modules/test/constructors/ST_TILEENVELOPE.test.js | 6 ++++-- .../modules/test/constructors/ST_TILEENVELOPE.test.js | 8 +++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/clouds/bigquery/modules/sql/constructors/ST_TILEENVELOPE.sql b/clouds/bigquery/modules/sql/constructors/ST_TILEENVELOPE.sql index e736abb7c..d1e699e8f 100644 --- a/clouds/bigquery/modules/sql/constructors/ST_TILEENVELOPE.sql +++ b/clouds/bigquery/modules/sql/constructors/ST_TILEENVELOPE.sql @@ -6,8 +6,8 @@ CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.ST_TILEENVELOPE` (zoomLevel INT64, xTile INT64, yTile INT64) RETURNS GEOGRAPHY AS ( - `@@BQ_DATASET@@.QUADINT_BOUNDARY`( - `@@BQ_DATASET@@.QUADINT_FROMZXY`( + `@@BQ_DATASET@@.QUADBIN_BOUNDARY`( + `@@BQ_DATASET@@.QUADBIN_FROMZXY`( zoomlevel, xtile, ytile ) ) diff --git a/clouds/bigquery/modules/test/constructors/ST_TILEENVELOPE.test.js b/clouds/bigquery/modules/test/constructors/ST_TILEENVELOPE.test.js index 19a460d99..bd0e5de83 100644 --- a/clouds/bigquery/modules/test/constructors/ST_TILEENVELOPE.test.js +++ b/clouds/bigquery/modules/test/constructors/ST_TILEENVELOPE.test.js @@ -15,7 +15,9 @@ test('ST_TILEENVELOPE should work', async () => { test('ST_TILEENVELOPE should fail if any NULL argument', async () => { const query = ` - SELECT \`@@BQ_DATASET@@.ST_TILEENVELOPE\`(10, 384, null) + SELECT \`@@BQ_DATASET@@.ST_TILEENVELOPE\`(10, 384, null) AS geog `; - await expect(runQuery(query)).rejects.toThrow(); + const rows = await runQuery(query); + expect(rows.length).toEqual(1); + expect(rows[0].geog).toEqual(null); }); \ No newline at end of file diff --git a/clouds/snowflake/modules/test/constructors/ST_TILEENVELOPE.test.js b/clouds/snowflake/modules/test/constructors/ST_TILEENVELOPE.test.js index 6b37e520c..1b48fea56 100644 --- a/clouds/snowflake/modules/test/constructors/ST_TILEENVELOPE.test.js +++ b/clouds/snowflake/modules/test/constructors/ST_TILEENVELOPE.test.js @@ -13,9 +13,11 @@ test('ST_TILEENVELOPE should work', async () => { expect(JSON.stringify(rows[0].GEOG3)).toEqual('{"coordinates":[[[-44.99998927116395,45.000002199069606],[-44.99998927116395,44.99999461263666],[-45,44.99999461263666],[-45,45.000002199069606],[-44.99998927116395,45.000002199069606]]],"type":"Polygon"}'); }); -test('ST_TILEENVELOPE should fail if any NULL argument', async () => { +test('ST_TILEENVELOPE should return NULL if any NULL argument', async () => { const query = ` - SELECT ST_TILEENVELOPE(10, 384, null) + SELECT ST_TILEENVELOPE(10, 384, null) as geog `; - await expect(runQuery(query)).rejects.toThrow(); + const rows = await runQuery(query); + expect(rows.length).toEqual(1); + expect(rows[0].GEOG).toEqual(null); }); \ No newline at end of file