jonahgao commented on code in PR #10640:
URL: https://github.com/apache/datafusion/pull/10640#discussion_r1613097509
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -1175,6 +1180,47 @@ pub(crate) fn from_substrait_type(dt:
&substrait::proto::Type) -> Result<DataTyp
}
}
+fn is_substrait_type_nullable(dtype: &Type) -> Result<bool> {
+ fn is_nullable(nullability: i32) -> bool {
+ nullability != substrait::proto::r#type::Nullability::Required as i32
+ }
+
+ let nullable = match dtype
+ .clone()
+ .kind
+ .ok_or(substrait_datafusion_err!("Type must contain Kind"))?
Review Comment:
```suggestion
let nullable = match dtype
.kind
.as_ref()
.ok_or_else(|| substrait_datafusion_err!("Type must contain Kind"))?
```
Avoid cloning and creating DataFusionError.
--
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]