Skip to content

[SPARK-48302][PYTHON] Preserve nulls in map columns in PyArrow Tables - #46837

Closed
ianmcook wants to merge 2 commits into
apache:masterfrom
ianmcook:SPARK-48302
Closed

[SPARK-48302][PYTHON] Preserve nulls in map columns in PyArrow Tables#46837
ianmcook wants to merge 2 commits into
apache:masterfrom
ianmcook:SPARK-48302

Conversation

@ianmcook

@ianmcookianmcook commented Jun 2, 2024

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This is a small follow-up to #46529. It fixes a known issue affecting PyArrow Tables passed to spark.createDataFrame(). After this PR, if the user is running PyArrow 17.0.0 or higher, null values in MapArray columns containing nested fields or timestamps will be preserved.

Why are the changes needed?

Before this PR, null values in MapArray columns containing nested fields or timestamps are replaced by empty lists when a PyArrow Table is passed to spark.createDataFrame().

Does this PR introduce any user-facing change?

It prevents loss of nulls in the case described above. There are no other user-facing changes.

How was this patch tested?

A test is included.

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

No

@ianmcook

Copy link
Copy Markdown
MemberAuthor

@jorisvandenbossche does this look OK to you?

@jorisvandenbosschejorisvandenbossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@HyukjinKwon

Copy link
Copy Markdown
Member

@ianmcook let's just merge this. I think it's fine

@ianmcook
ianmcook marked this pull request as ready for review June 7, 2024 02:24
@ianmcook

Copy link
Copy Markdown
MemberAuthor

On the PyArrow side there were some issues with the initial implementation of this, but they are fixed now in apache/arrow#41956 and will be released in version 17.0.0. So I think this PR is good to merge.

@HyukjinKwon

Copy link
Copy Markdown
Member

Merged to master.

Sign up for freeto 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.

3 participants

@ianmcook@HyukjinKwon@jorisvandenbossche