Skip to content

Conversation

@uros-db
Copy link
Contributor

@uros-db uros-db commented Oct 31, 2025

What changes were proposed in this pull request?

This PR disallows casting GEOGRAPHY and GEOMETRY to/from other data types in the system (such as BOOLEAN, BINARY, STRING, and others). Note that these types were recently introduced as part of: #52491.

Why are the changes needed?

GeographyType and GeometryType are not interoperable with any other non-geospatial data types, so we need to forbid such casts explicitly in order to avoid unexpected failures.

Does this PR introduce any user-facing change?

Yes, casts are disallowed for newly introduced geospatial types.

How was this patch tested?

Added new unit tests to verify the expected behaviour:

  • CastWithAnsiOffSuite
  • CastWithAnsiOnSuite

Added new appropriate end-to-end SQL tests:

  • st-functions

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Oct 31, 2025
Copy link
Contributor Author

@uros-db uros-db left a comment

Choose a reason for hiding this comment

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

@uros-db uros-db requested a review from cloud-fan October 31, 2025 08:57
@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 610bb52 Oct 31, 2025
huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
…er data types

### What changes were proposed in this pull request?
This PR disallows casting `GEOGRAPHY` and `GEOMETRY` to/from other data types in the system (such as `BOOLEAN`, `BINARY`, `STRING`, and others). Note that these types were recently introduced as part of: apache#52491.

### Why are the changes needed?
`GeographyType` and `GeometryType` are not interoperable with any other non-geospatial data types, so we need to forbid such casts explicitly in order to avoid unexpected failures.

### Does this PR introduce _any_ user-facing change?
Yes, casts are disallowed for newly introduced geospatial types.

### How was this patch tested?
Added new unit tests to verify the expected behaviour:
- `CastWithAnsiOffSuite`
- `CastWithAnsiOnSuite`

Added new appropriate end-to-end SQL tests:
- `st-functions`

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#52806 from uros-db/geo-cast-disallow.

Authored-by: Uros Bojanic <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants