waynexia commented on code in PR #6840:
URL: https://github.com/apache/arrow-datafusion/pull/6840#discussion_r1260683571
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -1342,3 +1285,67 @@ fn from_substrait_null(null_type: &Type) ->
Result<ScalarValue> {
))
}
}
+
+async fn make_datafusion_like(
+ case_insensitive: bool,
+ f: &ScalarFunction,
+ input_schema: &DFSchema,
+ extensions: &HashMap<u32, &String>,
+) -> Result<Arc<Expr>> {
+ let fn_name = if case_insensitive { "ILIKE" } else { "LIKE" };
+ if f.arguments.len() != 3 {
+ return Err(DataFusionError::NotImplemented(format!(
+ "Expect three arguments for `{fn_name}` expr"
+ )));
+ }
+
+ let Some(ArgType::Value(expr_substrait)) = &f.arguments[0].arg_type else {
+ return Err(DataFusionError::NotImplemented(
+ format!("Invalid arguments type for `{}` expr", fn_name)
+ ))
+ };
Review Comment:
Okay 👍
BTW, clippy has a lint about this style
[`uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/index.html#/uninlined_format_args).
(but maybe it's unnecessary to enable it?
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -1342,3 +1285,67 @@ fn from_substrait_null(null_type: &Type) ->
Result<ScalarValue> {
))
}
}
+
+async fn make_datafusion_like(
+ case_insensitive: bool,
+ f: &ScalarFunction,
+ input_schema: &DFSchema,
+ extensions: &HashMap<u32, &String>,
+) -> Result<Arc<Expr>> {
+ let fn_name = if case_insensitive { "ILIKE" } else { "LIKE" };
+ if f.arguments.len() != 3 {
+ return Err(DataFusionError::NotImplemented(format!(
+ "Expect three arguments for `{fn_name}` expr"
+ )));
+ }
+
+ let Some(ArgType::Value(expr_substrait)) = &f.arguments[0].arg_type else {
+ return Err(DataFusionError::NotImplemented(
+ format!("Invalid arguments type for `{}` expr", fn_name)
+ ))
+ };
Review Comment:
Okay 👍
BTW, clippy has a lint about this style
[`uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/index.html#/uninlined_format_args).
(but maybe it's unnecessary to enable it?
--
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]