GitHub user geruh added a comment to the discussion: `PrimitiveLiteral` of of
`Decimal`
I've opened PR #2093 to address this for the Python bindings.
The PR adds three methods to `PyPrimitiveLiteral`:
- `decimal_value(scale: int) -> decimal.Decimal` - converts the raw `Int128` to
a properly scaled Python `Decimal`
- `uuid_value() -> uuid.UUID` - converts `UInt128` to a Python UUID
- `literal_type() -> str` - returns the type name for runtime dispatch
This allows pyiceberg to handle partition values correctly when using the Rust
bindings for manifest parsing (pyiceberg PR #2004).
Example usage:
```python
literal = entry.data_file.partition[i]
if literal.literal_type() == "int128":
value = literal.decimal_value(partition_type.scale)
elif literal.literal_type() == "uint128":
value = literal.uuid_value()
else:
value = literal.value()
```
GitHub link:
https://github.com/apache/iceberg-rust/discussions/2062#discussioncomment-15645434
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]