xanderbailey opened a new pull request, #2477:
URL: https://github.com/apache/iceberg-rust/pull/2477
## Which issue does this PR close?
When writing to an iceberg table with an arrow-batch that has timestamp UTC
we fail with the following error.
```
ArrowError(
"Incompatible type. Field 'timestamp' has type Timestamp(µs,
\"+00:00\"), array has type Timestamp(µs, \"UTC\")",
),
```
`+00:00` and `UTC` are semantically identical so we should just arrow cast
(essentially a no-op) before we write.
I've tried to make this as cheap as possible without introducing the
invariant that we assume all incoming arrow batches have the same schema. If we
did make that assumption we could store the index that need to be cast and make
this a little cheaper but in reality this is an O(n_cols) per batch which I
think.. is okay?
[DataFusion](https://github.com/apache/datafusion/blob/70caf372a54a088b4bcfd3b4479490f3388971d8/datafusion/expr-common/src/type_coercion/binary.rs#L1909-L1941)
has a similar mechanism for semantically identical timestamps but at the
planning phase they do the cast which is a little cheaper
Opened a [PR](https://github.com/apache/arrow-rs/pull/9994) in arrow-rs to
fix this lower in the stack but it was suggested that this should be handled by
the application code so I'm open a PR here to open up that discussion.
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
- Closes #.
## What changes are included in this PR?
<!--
Provide a summary of the modifications in this PR. List the main changes
such as new features, bug fixes, refactoring, or any other updates.
-->
## Are these changes tested?
Yes
<!--
Specify what test covers (unit test, integration test, etc.).
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]