Skip to content

IO: Absorb upsert PyArrow logic into io/pyarrow.py - #3813

Open
qzyu999 wants to merge 1 commit into
apache:mainfrom
qzyu999:consolidate-upsert-pyarrow-logic
Open

IO: Absorb upsert PyArrow logic into io/pyarrow.py#3813
qzyu999 wants to merge 1 commit into
apache:mainfrom
qzyu999:consolidate-upsert-pyarrow-logic

Conversation

@qzyu999

@qzyu999 qzyu999 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Move PyArrow-specific table operations (joins, group_by, duplicate detection, row comparison) from table/upsert_util.py into pyiceberg/io/pyarrow.py. The upsert_util module now delegates to helpers in io/pyarrow rather than importing pyarrow directly.

Changes

  • New functions in pyiceberg/io/pyarrow.py: _upsert_unique_keys, _upsert_has_duplicate_rows, _upsert_get_rows_to_update
  • Modified pyiceberg/table/upsert_util.py: removed direct import pyarrow / from pyarrow import compute, now imports helpers from pyiceberg.io.pyarrow

What stays the same

  • All existing from pyiceberg.table.upsert_util import ... imports continue to work
  • Zero behavior change, pure code movement
  • No new dependencies

Why

This consolidates PyArrow logic behind the io/pyarrow module boundary. table/upsert_util.py was the only file in pyiceberg/table/ with a top-level import pyarrow and inline PyArrow compute operations (joins, aggregations, etc.). Moving these operations into io/pyarrow.py means all runtime PyArrow usage routes through one module, which is a precondition for the decomposition proposed in #3737.

See #3812 for the full audit and tracking.

Related

Move PyArrow-specific table operations (joins, group_by, duplicate
detection, row comparison) from table/upsert_util.py into
pyiceberg/io/pyarrow.py. The upsert_util module now delegates to
helpers in io/pyarrow rather than importing pyarrow directly.

This consolidates PyArrow logic behind the io/pyarrow module boundary,
which is a precondition for the decomposition proposed in apache#3737.

Fixes apache#3812 (PR A)

@rambleraptor rambleraptor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is just a simple code reorg, so it looks fine.

I think it's good to consolidate our PyArrow logic, especially since PyArrow is an optional dependency.

Or,
)
from pyiceberg.io.pyarrow import (
_upsert_get_rows_to_update,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These shouldn't be private if we're importing them elsewhere.

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.

2 participants