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

Remove sort-order constraint #349

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyiceberg/io/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,10 @@ def write_file(table: Table, tasks: Iterator[WriteTask]) -> Iterator[DataFile]:
file_format=FileFormat.PARQUET,
partition=Record(),
file_size_in_bytes=len(fo),
sort_order_id=task.sort_order_id,
# After this has been fixed:
# https://github.com/apache/iceberg-python/issues/271
# sort_order_id=task.sort_order_id,
sort_order_id=None,
# Just copy these from the table for now
spec_id=table.spec().spec_id,
equality_ids=None,
Expand Down
9 changes: 0 additions & 9 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,9 +943,6 @@ def append(self, df: pa.Table) -> None:
if len(self.spec().fields) > 0:
raise ValueError("Cannot write to partitioned tables")

if len(self.sort_order().fields) > 0:
raise ValueError("Cannot write to tables with a sort-order")

data_files = _dataframe_to_data_files(self, df=df)
merge = _MergingSnapshotProducer(operation=Operation.APPEND, table=self)
for data_file in data_files:
Expand Down Expand Up @@ -976,9 +973,6 @@ def overwrite(self, df: pa.Table, overwrite_filter: BooleanExpression = ALWAYS_T
if len(self.spec().fields) > 0:
raise ValueError("Cannot write to partitioned tables")

if len(self.sort_order().fields) > 0:
raise ValueError("Cannot write to tables with a sort-order")

data_files = _dataframe_to_data_files(self, df=df)
merge = _MergingSnapshotProducer(
operation=Operation.OVERWRITE if self.current_snapshot() is not None else Operation.APPEND,
Expand Down Expand Up @@ -2279,9 +2273,6 @@ def _dataframe_to_data_files(table: Table, df: pa.Table) -> Iterable[DataFile]:
if len(table.spec().fields) > 0:
raise ValueError("Cannot write to partitioned tables")

if len(table.sort_order().fields) > 0:
raise ValueError("Cannot write to tables with a sort-order")

write_uuid = uuid.uuid4()
counter = itertools.count(0)

Expand Down