paleolimbot commented on PR #20312:
URL: https://github.com/apache/datafusion/pull/20312#issuecomment-4084643547
> Do you already have a design in your mind? If not, I can familiarize
myself with the casting system and try to come up with something.
I will give this a go tonight or tomorrow...I spent some time going through
the cast system last week. I was thinking something like:
```rust
pub trait DFExtensionType: Debug + Send + Sync {
// ...
fn create_cast_extension(&self) -> Option<Box<dyn CastExtension>> { None
}
}
pub trait CastExtension {
fn can_cast(&self, to: &Field, <options, or at least bool implicit>) ->
bool;
fn can_cast_from(&self, to: &Field, <options, or at least bool implicit>)
-> bool;
fn cast(&self, value: ColumnarValue, to: &Field) -> Result<ArrayRef>;
fn cast_from(&self, value: ColumnarValue, to: &Field) -> Result<ArrayRef>;
}
```
...which might need some workshopping to plug in to operator planning (e.g.,
common castable type, implicit vs. explicit casts). Another approach would be
to register a `CastExtension` with both types (to/from)...happy to experiment.
--
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]