yutannihilation commented on code in PR #275:
URL: https://github.com/apache/sedona-db/pull/275#discussion_r2504391484
##########
rust/sedona-testing/src/testers.rs:
##########
@@ -192,21 +194,84 @@ impl ScalarUdfTester {
/// Compute the return type
pub fn return_type(&self) -> Result<SedonaType> {
+ let scalar_arguments: Vec<Option<&ScalarValue>> = vec![None;
self.arg_types.len()];
+ self.return_type_from_args(&scalar_arguments, false)
+ }
+
+ fn return_type_from_args(
+ &self,
+ scalar_arguments: &[Option<&ScalarValue>],
+ from_scalar: bool,
+ ) -> Result<SedonaType> {
let arg_fields = self
.arg_types
.iter()
.map(|sedona_type| sedona_type.to_storage_field("",
true).map(Arc::new))
.collect::<Result<Vec<_>>>()?;
- let scalar_arguments = (0..arg_fields.len()).map(|_|
None).collect::<Vec<_>>();
let args = ReturnFieldArgs {
arg_fields: &arg_fields,
- scalar_arguments: &scalar_arguments,
+ scalar_arguments,
};
- let return_field = self.udf.return_field_from_args(args)?;
+ let return_field = if from_scalar {
+ let scalar_udf: ScalarUDF = self.udf.clone().into();
+ scalar_udf.return_field_from_args(args)
+ } else {
+ self.udf.return_field_from_args(args)
+ }?;
Review Comment:
`ScalarUDF::return_field_from_args()` uses `return_type()` while
`SedonaScalarUDF::return_field_from_args()` uses
`return_type_from_args_and_scalars()`. So, in theory, something like should
would fix the problem, but I'm not sure if I can finish this. This change broke
benchmark_utils.rs...
--
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]