findepi commented on code in PR #13756:
URL: https://github.com/apache/datafusion/pull/13756#discussion_r1888459710
##########
datafusion/functions-nested/src/extract.rs:
##########
@@ -993,3 +993,84 @@ where
let data = mutable.freeze();
Ok(arrow::array::make_array(data))
}
+
+#[cfg(test)]
+mod tests {
+ use super::array_element_udf;
+ use arrow_schema::{DataType, Field};
+ use datafusion_common::{Column, DFSchema, ScalarValue};
+ use datafusion_expr::expr::ScalarFunction;
+ use datafusion_expr::{cast, Expr, ExprSchemable};
+ use std::collections::HashMap;
+
+ #[test]
+ fn test_array_element_return_type() {
+ let complex_type = DataType::FixedSizeList(
Review Comment:
> Is there example about the difference of this two, especially for function.
the difference is more apparent for duplicate syntax (such is IS NULL vs IS
UNKNOWN), syntax sugar (order by 1, order by all, select *)
for function call the difference is about function being resolved (typed and
inputs coerced) or not.
> > since they are not to be used once the plan is constructed.
>
> Why `get_type` is not supposed to be available after plan is constructed
from Expr.
for a fully resolved logical plan it's fair question to ask what is the type
of an expression (and this may or may not be O(1) available answer)
however, there is no point to ask a UDF what is its type, since we already
asked it
think of this as engine and UDF being implemented by independent parties,
with UDF being a contract layer.
you go over a contract layer when you have to (analysis time), but going
over contract layer multiple times with the same question should be avoided.
--
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]