Support for ns#1188
Closed
zaryab-ali wants to merge 3 commits into
Closed
Conversation
Author
|
@kevinjqliu can you please review my PR and let me know if i made a mistake (please check with extra caution as it is my first contribution to any open source project) |
kevinjqliu
reviewed
Sep 20, 2024
kevinjqliu
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution! Left a few comments
| return DateType() | ||
| elif isinstance(primitive, pa.Time64Type) and primitive.unit == "us": | ||
| elif isinstance(primitive, pa.Time64Type) and (primitive.unit == "us" or primitive.unit == "ns"): | ||
| primitive = cast(pa.TimestampType, primitive) |
Contributor
There was a problem hiding this comment.
Time64Type and TimestampType and different, dont need to cast here
Contributor
There was a problem hiding this comment.
| elif pa.types.is_date32(primitive): | ||
| return DateType() | ||
| elif isinstance(primitive, pa.Time64Type) and primitive.unit == "us": | ||
| elif isinstance(primitive, pa.Time64Type) and (primitive.unit == "us" or primitive.unit == "ns"): |
Contributor
There was a problem hiding this comment.
i think we can get rid fo the us/ns check here, since Time64Type only supports those 2 https://arrow.apache.org/docs/python/generated/pyarrow.Time64Type.html
| primitive = cast(pa.TimestampType, primitive) | ||
| if primitive.unit == "ns": | ||
| if self._downcast_ns_timestamp_to_us: | ||
| logger.warning("Iceberg does not yet support 'ns' timestamp precision. Downcasting to 'us'.") |
Contributor
There was a problem hiding this comment.
lets add a test to verify that when _downcast_ns_timestamp_to_us is True, the downcasting happens
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.
added support for ns and enabled downcasting similar to the similar to the
pa.types.is_timestamp(primitive):, didn't enable upcasting as it wasn't mentioned in the issue