Skip to content

fix: correct UUIDType partition representation for BucketTransform #2003

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/iceberg_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ body:
description: What Apache Iceberg version are you using?
multiple: false
options:
- "0.9.0 (latest release)"
- "0.9.1 (latest release)"
- "0.9.0"
- "0.8.1"
- "0.8.0"
- "0.7.1"
Expand Down
12 changes: 12 additions & 0 deletions mkdocs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Iceberg works with the concept of a FileIO which is a pluggable module for readi
- **hdfs**: `PyArrowFileIO`
- **abfs**, **abfss**: `FsspecFileIO`
- **oss**: `PyArrowFileIO`
- **hf**: `FsspecFileIO`

You can also set the FileIO explicitly:

Expand Down Expand Up @@ -193,6 +194,17 @@ PyIceberg uses [S3FileSystem](https://arrow.apache.org/docs/python/generated/pya

<!-- markdown-link-check-enable-->

### Hugging Face

<!-- markdown-link-check-disable -->

| Key | Example | Description |
| ----------- | ------------------------ | --------------------------------------------------------- |
| hf.endpoint | <https://huggingface.co> | Configure the endpoint for Hugging Face |
| hf.token | hf_xxx | The Hugging Face token to access HF Datasets repositories |

<!-- markdown-link-check-enable-->

### PyArrow

<!-- markdown-link-check-disable -->
Expand Down
76 changes: 57 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions pyiceberg/avro/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
List,
Optional,
Tuple,
Union,
)
from uuid import UUID

Expand Down Expand Up @@ -121,8 +122,23 @@ def write(self, encoder: BinaryEncoder, val: Any) -> None:

@dataclass(frozen=True)
class UUIDWriter(Writer):
def write(self, encoder: BinaryEncoder, val: UUID) -> None:
encoder.write(val.bytes)
def write(self, encoder: BinaryEncoder, val: Union[UUID, str, bytes]) -> None:
if isinstance(val, UUID):
encoder.write(val.bytes)
elif isinstance(val, bytes):
encoder.write(val)
elif isinstance(val, str):
print(f"UUID string: {val=}")
if val.startswith("b'") and val.endswith("'"):
# Handle string representation of bytes
# Convert the escaped string to actual bytes
byte_string = val[2:-1].encode("utf-8").decode("unicode_escape").encode("latin1")
encoder.write(UUID(bytes=byte_string).bytes)
else:
# Regular UUID string
encoder.write(UUID(val).bytes)
else:
raise TypeError(f"Expected UUID, bytes, or string, got {type(val)}")


@dataclass(frozen=True)
Expand Down
Loading
Loading