alamb commented on code in PR #9775:
URL: https://github.com/apache/arrow-datafusion/pull/9775#discussion_r1536799094
##########
datafusion/functions/src/core/struct.rs:
##########
@@ -47,17 +47,10 @@ fn array_struct(args: &[ArrayRef]) -> Result<ArrayRef> {
Ok(Arc::new(StructArray::from(vec)))
}
+
/// put values in a struct array.
fn struct_expr(args: &[ColumnarValue]) -> Result<ColumnarValue> {
- let arrays = args
- .iter()
- .map(|x| {
- Ok(match x {
- ColumnarValue::Array(array) => array.clone(),
- ColumnarValue::Scalar(scalar) => scalar.to_array()?.clone(),
- })
- })
- .collect::<Result<Vec<ArrayRef>>>()?;
+ let arrays = ColumnarValue::values_to_arrays(args)?;
Review Comment:
I also filed
I also filed https://github.com/apache/arrow-datafusion/pull/9774 to improve
the documentation
--
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]