Skip to content

[GH-3351][Python] Preserve generated GeoArrow column names - #3354

Merged
jiayuasu merged 1 commit into
apache:masterfrom
akashchamp:fix/geoarrow-unaliased-expression
Sep 12, 2026
Merged

[GH-3351][Python] Preserve generated GeoArrow column names#3354
jiayuasu merged 1 commit into
apache:masterfrom
akashchamp:fix/geoarrow-unaliased-expression

Conversation

@akashchamp

Copy link
Copy Markdown
Contributor

Did you read the Contributor Guide?

Yes, I have read the Contributor Rules and Contributor Development Guide.

Is this PR related to a ticket?

Yes. Closes #3351.

What changes were proposed in this PR?

dataframe_to_arrow() previously used list(df) to build its input expressions. Spark resolves a generated geometry name such as st_point(1.0, 2.0) as a dotted path, so conversion fails before GeoArrow encoding runs.

Build explicit, backtick-quoted Spark column expressions from the schema names, escaping embedded backticks, before applying ST_AsEWKB. The original field name is still restored with alias, so generated geometry expressions retain their expected Arrow column name.

How was this patch tested?

  • Added a regression using SELECT ST_Point(1.0, 2.0) without an alias.
  • Manually reproduced the issue: the unchanged path raised Spark's dotted-name AnalysisException; with this patch the input and Arrow table both reported ['st_point(1.0, 2.0)'] and one row.
  • python/tests/utils/test_geoarrow.py: 7 passed, 1 optional GeoArrow-types test skipped.
  • Black formatting check, compileall, and git diff --check passed.

Did this PR include necessary documentation updates?

No documentation changes are needed. This restores conversion for an existing DataFrame shape without changing the public API.

Quote Spark column references before converting geometry fields to EWKB.
@jiayuasu jiayuasu added this to the sedona-2.0.0 milestone Sep 12, 2026
@jiayuasu
jiayuasu merged commit 1335a1e into apache:master Sep 12, 2026
34 checks passed
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

Successfully merging this pull request may close these issues.

Python: dataframe_to_arrow fails on un-aliased geometry expressions (generated column names contain dots)

2 participants