comphead commented on code in PR #9069:
URL: https://github.com/apache/arrow-datafusion/pull/9069#discussion_r1474723294
##########
datafusion/sql/src/expr/function.rs:
##########
@@ -70,6 +70,50 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
return Ok(Expr::ScalarFunction(ScalarFunction::new_udf(fm, args)));
}
+ // Build Unnest expression
+ if name.eq("unnest") {
+ let exprs =
+ self.function_args_to_expr(args.clone(), schema,
planner_context)?;
+
+ match exprs.len() {
+ 0 => {
+ return exec_err!("unnest() requires at least one
argument");
+ }
+ 1 => {
+ if let Expr::ScalarFunction(ScalarFunction {
+ func_def:
+ ScalarFunctionDefinition::BuiltIn(
+ BuiltinScalarFunction::MakeArray,
+ ),
+ ..
+ }) = exprs[0]
+ {
+ // valid
+ } else if let Expr::Column(_) = exprs[0] {
+ // valid
+ } else if let Expr::ScalarFunction(ScalarFunction {
+ func_def:
+
ScalarFunctionDefinition::BuiltIn(BuiltinScalarFunction::Struct),
+ ..
+ }) = exprs[0]
+ {
+ return not_impl_err!("unnest() does not support struct
yet");
+ } else {
+ return plan_err!(
+ "unnest() can only be applied to array and structs
and null"
Review Comment:
this line says unnest supports struct but line above says the opposite
--
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]