|
17 | 17 |
|
18 | 18 | use crate::{ReturnFieldArgs, ScalarFunctionArgs, ScalarUDF, ScalarUDFImpl};
|
19 | 19 | use arrow::array::ArrayRef;
|
20 |
| -use arrow::datatypes::{DataType, Field, SchemaRef}; |
| 20 | +use arrow::datatypes::{DataType, Field, FieldRef, SchemaRef}; |
21 | 21 | use async_trait::async_trait;
|
22 | 22 | use datafusion_common::config::ConfigOptions;
|
23 | 23 | use datafusion_common::error::Result;
|
@@ -52,15 +52,15 @@ pub trait AsyncScalarUDFImpl: Debug + Send + Sync {
|
52 | 52 | ///
|
53 | 53 | /// By default, this function calls [`Self::return_type`] with the
|
54 | 54 | /// types of each argument.
|
55 |
| - fn return_field_from_args(&self, args: ReturnFieldArgs) -> Result<Field> { |
| 55 | + fn return_field_from_args(&self, args: ReturnFieldArgs) -> Result<FieldRef> { |
56 | 56 | let data_types = args
|
57 | 57 | .arg_fields
|
58 | 58 | .iter()
|
59 | 59 | .map(|f| f.data_type())
|
60 | 60 | .cloned()
|
61 | 61 | .collect::<Vec<_>>();
|
62 | 62 | let return_type = self.return_type(&data_types)?;
|
63 |
| - Ok(Field::new(self.name(), return_type, true)) |
| 63 | + Ok(Arc::new(Field::new(self.name(), return_type, true))) |
64 | 64 | }
|
65 | 65 |
|
66 | 66 | /// The ideal batch size for this function.
|
@@ -131,7 +131,7 @@ impl ScalarUDFImpl for AsyncScalarUDF {
|
131 | 131 | self.inner.return_type(arg_types)
|
132 | 132 | }
|
133 | 133 |
|
134 |
| - fn return_field_from_args(&self, args: ReturnFieldArgs) -> Result<Field> { |
| 134 | + fn return_field_from_args(&self, args: ReturnFieldArgs) -> Result<FieldRef> { |
135 | 135 | self.inner.return_field_from_args(args)
|
136 | 136 | }
|
137 | 137 |
|
|
0 commit comments