-
Notifications
You must be signed in to change notification settings - Fork 3k
add VoidTransform #4727
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
add VoidTransform #4727
Conversation
e91b73a to
bcaa0ce
Compare
Fokko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments, but looks good in general 👍🏻
python/src/iceberg/transforms.py
Outdated
| def __init__(self): | ||
| super().__init__("void", "transforms.always_null()") | ||
|
|
||
| def apply(self, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #4728
| def apply(self, value): | |
| def apply(self, value: Optional[S]) -> Optional[int]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment. Updated.
|
|
||
| _instance = None | ||
|
|
||
| def __new__(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a test for this:
def test_check_if_identical():
assert transforms.always_null() is transforms.always_null()There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Updated the test.
python/src/iceberg/transforms.py
Outdated
| def result_type(self, source: IcebergType) -> IcebergType: | ||
| return source | ||
|
|
||
| def to_human_string(self, value) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def to_human_string(self, value) -> str: | |
| def to_human_string(self, Optional[value]) -> str: |
bcaa0ce to
7e13846
Compare
|
Thanks, @jun-he! |
To split the PR #3450, open a new PR for void transform here.