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

[SEDONA-522] Add ST_Union with array of Geometry as input #1294

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

furqaankhan
Copy link
Contributor

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

  • Add ST_Union with Array input
  • Port ST_Union with 2 geometry input to Flink

How was this patch tested?

  • Passed new and existing tests

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation update.

Introduction: Return the union of geometry A and B
Introduction:

Variant 1: Return the union of geometry A and B.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can you also update the ST_H3toGeom and ST_S2toGeom doc to explain how this ST_Union works in conjunction with these functions?

  2. What happens to polygons that could not be unioned (polygons that share no boundaries)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Sure.
  2. It returns a MultiPolygon with each set of boundaries. See here:
    it("Passed ST_Union - array variant") {
    val polyDf = sparkSession.sql("select array(ST_GeomFromWKT('POLYGON ((-3 -3, 3 -3, 3 3, -3 3, -3 -3))'),ST_GeomFromWKT('POLYGON ((5 -3, 7 -3, 7 -1, 5 -1, 5 -3))'), ST_GeomFromWKT('POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))')) as polys")
    val actual = polyDf.selectExpr("ST_Union(polys)").take(1)(0).get(0).asInstanceOf[Geometry].toText
    val expected = "MULTIPOLYGON (((5 -3, 5 -1, 7 -1, 7 -3, 5 -3)), ((-3 -3, -3 3, 3 3, 3 -3, -3 -3)), ((4 4, 4 6, 6 6, 6 4, 4 4)))"
    assert(expected.equals(actual))
    }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@furqaankhan Cool. Can you also explain this in the doc?

Introduction: Return the union of geometry A and B
Introduction:

Variant 1: Return the union of geometry A and B.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@furqaankhan Cool. Can you also explain this in the doc?

@jiayuasu jiayuasu added this to the sedona-1.6.0 milestone Mar 26, 2024
@jiayuasu jiayuasu merged commit d53f3e2 into apache:master Mar 26, 2024
49 checks passed
@furqaankhan furqaankhan deleted the st-union-array-variant branch July 16, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants