V3: Fix invalid downcasting for nanos#2397
Merged
kevinjqliu merged 2 commits intoapache:mainfrom Aug 28, 2025
Merged
Conversation
raulcd
reviewed
Aug 28, 2025
tests/io/test_pyarrow.py
Outdated
|
|
||
| @pytest.mark.parametrize("format_version", [1, 2, 3]) | ||
| def test_task_to_record_batches_nanos(format_version: TableVersion, tmpdir: str) -> None: | ||
| from datetime import datetime |
Member
There was a problem hiding this comment.
this import seems unnecessary now.
Contributor
Author
There was a problem hiding this comment.
Good one, I expected the linter to clean that up 🚀
rambleraptor
approved these changes
Aug 28, 2025
Contributor
rambleraptor
left a comment
There was a problem hiding this comment.
One small question, but looks good to me otherwise.
| self._bound_row_filter = bind(table_metadata.schema(), row_filter, case_sensitive=case_sensitive) | ||
| self._case_sensitive = case_sensitive | ||
| self._limit = limit | ||
| self._downcast_ns_timestamp_to_us = Config().get_bool(DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE) |
Contributor
There was a problem hiding this comment.
Do we need to check the format version for downcasting? (We have the table_metadata already, so we have access to it)
raulcd
approved these changes
Aug 28, 2025
Member
raulcd
left a comment
There was a problem hiding this comment.
Approving as my previous comment has been fixed
Contributor
|
would be great to add an integration test showing spark writing V3 with nanos and reading with pyiceberg. We can do that as a follow up |
Contributor
|
Thanks for the PR @Fokko and thanks @rambleraptor and @raulcd for the review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
It looks like we downcast Arrow nanosecond types always to microseconds.
cc @sungwy @kevinjqliu
Are these changes tested?
Are there any user-facing changes?