Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with st_dump? #1523

Closed
JimShady opened this issue Jul 15, 2024 · 2 comments
Closed

Issue with st_dump? #1523

JimShady opened this issue Jul 15, 2024 · 2 comments

Comments

@JimShady
Copy link
Contributor

Two (almost identical) queries below. One in PostGIS returns 78 features, the same one in apache-sedona returns 1 feature. I don't understand why - can anyone help/advise please?

PostGIS query - returns 78 features

WITH a_table AS (
SELECT st_boundary(geom) geom
FROM    emea_eu_seu.albania_prefectures_2021
UNION ALL
SELECT st_boundary(geom) geom
FROM    emea_eu_seu.albania_municipalities_2021
UNION ALL
SELECT st_boundary(geom) geom
FROM    emea_eu_seu.albania_2_digit_postcode_areas_2021
),
b_table AS (
SELECT   geom
FROM     a_table
GROUP BY geom
),
c_table AS (
SELECT   ST_Union(geom) geom
FROM     b_table
),
d_table AS (
SELECT ST_Polygonize(geom) AS geom 
FROM c_table
),
e_table AS (
SELECT st_dump(geom) geom
FROM   d_table
)
SELECT  COUNT(*) FROM e_table

Sedona query - returns 1 feature

%sql

WITH a_table AS (
SELECT st_boundary(st_geomfromwkb(geom_wkb)) geom
FROM   hive_metastore.gfk_bronze.albania_prefectures_2021
UNION ALL
SELECT st_boundary(st_geomfromwkb(geom_wkb)) geom
FROM   hive_metastore.gfk_bronze.albania_municipalities_2021
UNION ALL
SELECT st_boundary(st_geomfromwkb(geom_wkb)) geom
FROM   hive_metastore.gfk_bronze.albania_2_digit_postcode_areas_2021
),
b_table AS (
SELECT   geom
FROM     a_table
GROUP BY geom
),
c_table AS (
SELECT   ST_Union_Aggr(geom) geom
FROM     b_table
),
d_table AS (
SELECT ST_Polygonize(geom) AS geom 
FROM c_table
),
e_table AS (
SELECT st_dump(geom) geom
FROM   d_table
)
SELECT  COUNT(*) FROM e_table
@JimShady JimShady changed the title Issue with st_polygonize and/or st_dump? Issue with st_dump? Jul 15, 2024
@JimShady
Copy link
Contributor Author

After some more digging it appears that the issue is with st_dump. In apache-sedona it is not creating 78 rows (I think?) it might be returning an array of 78 items in one record? So perhaps I need to explode it?

@JimShady
Copy link
Contributor Author

Figured it out - I need to run the explode() function after st_dump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant