andre-cc-natzka opened a new pull request, #4156:
URL: https://github.com/apache/arrow-datafusion/pull/4156

   # Which issue does this PR close?
   
   To my knowledge, this PR does not tackle an existing issue.
   
   Closes #.
   
   # Rationale for this change
   
   Time coercion did not support `Time` types, while it did support `Date` and 
`Timestamp`. It would be useful to support both `Time32` and `Time64` for type 
coercion as well, thus ensuring that, for instance, a pair composed by a `Utf8` 
and a `Time32` is coerced to a `Time32`. The implementation has to take into 
account the valid `TimeUnit` for both `Time32` and `Time64` and implement them 
consistently throughout the code. Additionally, it would also be useful to 
implement support for `Time32` and `Time64` in `hash_join` and `hash_utils`.
   
   # What changes are included in this PR?
   
   A series of adaptations were implemented throughout the code as to 
consistently support `Time32(TimeUnit::Second)`, 
`Time32(TimeUnit::Millisecond)`, `Time64(TimeUnit::Microsecond)` and 
`Time64(TimeUnit::Nanosecond)`. The changes are mostly localized in the 
`binary.rs` file from `type_coercion`, but support for time types also included 
numerous changes to `scalar.rs` from the `common` crate and some modules from 
the `physical_expr` crate. 
   
   Although most changes are straightforward, some non-trivial modifications 
were added in the proto crate. The `datafusion.proto` file is not changed, so 
it keeps supporting only a generic `Time64` type, with no unit specification, 
interpreting it to nanosecond accuracy. The `datafusion/proto/src/to_proto.rs` 
and `datafusion/proto/src/from_proto.rs` files are adapted consistently, as the 
proto `Time64` translates into a `Time64Nanosecond`. On the other hand, a proto 
`Time64` can be obtained from all four `Time64Nanosecond`, `Time64Microsecond`, 
`Time32Millisecond` and `Time32Second` scalar value types, as implemented in 
`datafusion/proto/src/to_proto.rs`.
   
   # Are these changes tested?
   
   Yes, the changes in `type_coercion` are tested in the `binary.rs` module, 
where the existing tests have been extended to account for the cases of type 
coercion involving `Time32` and `Time64` types, and tests are passing.
   
   # Are there any user-facing changes?
   
   No.


-- 
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]

Reply via email to