-
Notifications
You must be signed in to change notification settings - Fork 168
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
Support for ns #1188
Support for ns #1188
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1068,8 +1068,17 @@ def primitive(self, primitive: pa.DataType) -> PrimitiveType: | |
return StringType() | ||
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"): | ||
primitive = cast(pa.TimestampType, primitive) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if primitive.unit == "ns": | ||
if self._downcast_ns_timestamp_to_us: | ||
logger.warning("Iceberg does not yet support 'ns' timestamp precision. Downcasting to 'us'.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets add a test to verify that when |
||
else: | ||
raise TypeError( | ||
"Iceberg does not yet support 'ns' timestamp precision. Use 'downcast-ns-timestamp-to-us-on-write' configuration property to automatically downcast 'ns' to 'us' on write." | ||
) | ||
return TimeType() | ||
|
||
elif pa.types.is_timestamp(primitive): | ||
primitive = cast(pa.TimestampType, primitive) | ||
if primitive.unit in ("s", "ms", "us"): | ||
|
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.
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