notfilippo commented on code in PR #12793:
URL: https://github.com/apache/datafusion/pull/12793#discussion_r1793371258
##########
datafusion/expr-common/src/scalar.rs:
##########
@@ -116,6 +143,10 @@ impl Scalar {
ScalarValue::iter_to_array_of_type(scalars.map(|scalar| scalar.value),
&data_type)
}
+ pub fn cast_to(&self, data_type: &DataType) -> Result<Self> {
Review Comment:
I think this function is useful to keep here because we can then enforce the
same constraints introduced in the construction of the struct and potentially
support logic like
`data_type.is_logically_equivalent_to(self.data_type)` => `self.data_type =
data_type` (skipping the cast)
--
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]