From 7d255be4714c291fa4c15bc01a9a764d6ae682ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20Zag=C3=B3rski?= Date: Wed, 2 Oct 2024 10:27:56 +0200 Subject: [PATCH 1/3] isRemoteCalculationSupported: dynamic aggregation of points to grid/h3 should be remote too --- packages/react-widgets/__tests__/models/utils.test.js | 10 ++++++++++ packages/react-widgets/src/models/utils.js | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/react-widgets/__tests__/models/utils.test.js b/packages/react-widgets/__tests__/models/utils.test.js index aadf9e4df..f61181e48 100644 --- a/packages/react-widgets/__tests__/models/utils.test.js +++ b/packages/react-widgets/__tests__/models/utils.test.js @@ -55,6 +55,16 @@ describe('utils', () => { { ...V3_SOURCE, geoColumn: 'h3', dataResolution: 5 }, true ], + [ + 'v3/h3-frompoint/without dataResolution', + { ...V3_SOURCE, geoColumn: 'h3:geom', spatialDataType: 'geo' }, + true + ], + [ + 'v3/quadbin-frompoint/without dataResolution', + { ...V3_SOURCE, geoColumn: 'quadbin:geom', spatialDataType: 'geo' }, + true + ], [ 'v3/quadbin/with dataResolution', { ...V3_SOURCE, geoColumn: 'quadbin:abc', spatialFiltersResolution: 5 }, diff --git a/packages/react-widgets/src/models/utils.js b/packages/react-widgets/src/models/utils.js index 67504ce68..6a15b80b3 100644 --- a/packages/react-widgets/src/models/utils.js +++ b/packages/react-widgets/src/models/utils.js @@ -21,8 +21,10 @@ export function isRemoteCalculationSupported(props) { return false; } - const isDynamicSpatialIndex = - source.geoColumn && getSpatialIndexFromGeoColumn(source.geoColumn); + const isDynamicSpatialIndex = source.spatialDataType + ? source.spatialDataType !== 'geo' + : source.geoColumn && getSpatialIndexFromGeoColumn(source.geoColumn); + if ( isDynamicSpatialIndex && !source.dataResolution && From 221618ac7f5ad5c731661bd73bdee706caf0c25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20Zag=C3=B3rski?= Date: Wed, 2 Oct 2024 11:12:27 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 2 ++ packages/react-widgets/src/models/utils.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81cf0a85b..076f235d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Not released +- isRemoteCalculationSupported: dynamic aggregation of points to grid/h3 should be remote [#917](https://github.com/CartoDB/carto-react/pull/917) + ## 3.0.0 ### 3.0.0-alpha.22 (2024-09-30) diff --git a/packages/react-widgets/src/models/utils.js b/packages/react-widgets/src/models/utils.js index 6a15b80b3..b8a1d48d4 100644 --- a/packages/react-widgets/src/models/utils.js +++ b/packages/react-widgets/src/models/utils.js @@ -21,6 +21,8 @@ export function isRemoteCalculationSupported(props) { return false; } + // If user specifies a spatialDataType, we assume it is _binding_ + // otherwise, try to deduce it from the geoColumn const isDynamicSpatialIndex = source.spatialDataType ? source.spatialDataType !== 'geo' : source.geoColumn && getSpatialIndexFromGeoColumn(source.geoColumn); From 0a13512c4c3feeb27571cdb788753b8b60ea949e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20Zag=C3=B3rski?= Date: Wed, 2 Oct 2024 11:47:57 +0200 Subject: [PATCH 3/3] isRemoteCalculationSupported: remove backwards compatbility check for spatial indices --- CHANGELOG.md | 2 +- .../react-widgets/__tests__/models/utils.test.js | 2 +- packages/react-widgets/src/models/utils.js | 14 -------------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 076f235d2..9b103b06c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Not released -- isRemoteCalculationSupported: dynamic aggregation of points to grid/h3 should be remote [#917](https://github.com/CartoDB/carto-react/pull/917) +- isRemoteCalculationSupported: remove backwards compatbility check for spatial indices [#917](https://github.com/CartoDB/carto-react/pull/917) ## 3.0.0 diff --git a/packages/react-widgets/__tests__/models/utils.test.js b/packages/react-widgets/__tests__/models/utils.test.js index f61181e48..61d114751 100644 --- a/packages/react-widgets/__tests__/models/utils.test.js +++ b/packages/react-widgets/__tests__/models/utils.test.js @@ -49,7 +49,7 @@ describe('utils', () => { ['v3', { ...V3_SOURCE, type: 'tileset' }, false], ['v3/databricks', { ...V3_SOURCE, provider: 'databricks' }, false], ['v3/databricksRest', { ...V3_SOURCE, provider: 'databricksRest' }, true], - ['v3/h3/no dataResolution', { ...V3_SOURCE, geoColumn: 'h3' }, false], + [ 'v3/h3/with dataResolution', { ...V3_SOURCE, geoColumn: 'h3', dataResolution: 5 }, diff --git a/packages/react-widgets/src/models/utils.js b/packages/react-widgets/src/models/utils.js index b8a1d48d4..a0b12b421 100644 --- a/packages/react-widgets/src/models/utils.js +++ b/packages/react-widgets/src/models/utils.js @@ -1,6 +1,5 @@ import { AggregationTypes, - getSpatialIndexFromGeoColumn, _filtersToSQL, Provider } from '@carto/react-core'; @@ -21,19 +20,6 @@ export function isRemoteCalculationSupported(props) { return false; } - // If user specifies a spatialDataType, we assume it is _binding_ - // otherwise, try to deduce it from the geoColumn - const isDynamicSpatialIndex = source.spatialDataType - ? source.spatialDataType !== 'geo' - : source.geoColumn && getSpatialIndexFromGeoColumn(source.geoColumn); - - if ( - isDynamicSpatialIndex && - !source.dataResolution && - !source.spatialFiltersResolution - ) { - return false; - } return true; }