alamb commented on code in PR #8985:
URL: https://github.com/apache/arrow-datafusion/pull/8985#discussion_r1486869222
##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -35,24 +35,24 @@ use std::collections::HashMap;
use std::sync::Arc;
/// trait to allow expr to typable with respect to a schema
-pub trait ExprSchemable {
+pub trait ExprSchemable<S: ExprSchema> {
/// given a schema, return the type of the expr
- fn get_type<S: ExprSchema>(&self, schema: &S) -> Result<DataType>;
+ fn get_type(&self, schema: &S) -> Result<DataType>;
/// given a schema, return the nullability of the expr
- fn nullable<S: ExprSchema>(&self, input_schema: &S) -> Result<bool>;
+ fn nullable(&self, input_schema: &S) -> Result<bool>;
/// given a schema, return the expr's optional metadata
- fn metadata<S: ExprSchema>(&self, schema: &S) -> Result<HashMap<String,
String>>;
+ fn metadata(&self, schema: &S) -> Result<HashMap<String, String>>;
/// convert to a field with respect to a schema
fn to_field(&self, input_schema: &DFSchema) -> Result<DFField>;
/// cast to a type with respect to a schema
- fn cast_to<S: ExprSchema>(self, cast_to_type: &DataType, schema: &S) ->
Result<Expr>;
+ fn cast_to(self, cast_to_type: &DataType, schema: &S) -> Result<Expr>;
}
-impl ExprSchemable for Expr {
+impl ExprSchemable<DFSchema> for Expr {
Review Comment:
I think this means the only way to use Expr::get_type is now if you have a
DFSchema with requires bringing in the entire core crate
I think the reason this trait was the way it was orginally was to allow
things like dask-sql to use just the logical expr parts.
I am looking into this more carefully
--
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]