Skip to content

Commit 146976c

Browse files
committed
refactor: do one thing at a time
1 parent 1eab3b3 commit 146976c

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

host/src/lib.rs

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -387,40 +387,38 @@ impl WasmScalarUdf {
387387
)?;
388388

389389
let store2: &mut Store<WasmStateImpl> = &mut store_guard;
390-
let (signature, return_type) = {
391-
let s: Signature = bindings
392-
.datafusion_udf_wasm_udf_types()
393-
.scalar_udf()
394-
.call_signature(store2, resource)
395-
.await
396-
.context(
397-
"call ScalarUdf::signature",
398-
Some(&store_guard.data().stderr.contents()),
399-
)?
400-
.try_into()?;
401-
402-
match &s.type_signature {
403-
TypeSignature::Exact(t) => {
404-
let store2: &mut Store<WasmStateImpl> = &mut store_guard;
405-
let r = bindings
406-
.datafusion_udf_wasm_udf_types()
407-
.scalar_udf()
408-
.call_return_type(
409-
store2,
410-
resource,
411-
&t.iter()
412-
.map(|dt| wit_types::DataType::from(dt.clone()))
413-
.collect::<Vec<_>>(),
414-
)
415-
.await
416-
.context(
417-
"call ScalarUdf::return_type",
418-
Some(&store_guard.data().stderr.contents()),
419-
)??;
420-
(s, Some(r.try_into()?))
421-
}
422-
_ => (s, None),
390+
let signature: Signature = bindings
391+
.datafusion_udf_wasm_udf_types()
392+
.scalar_udf()
393+
.call_signature(store2, resource)
394+
.await
395+
.context(
396+
"call ScalarUdf::signature",
397+
Some(&store_guard.data().stderr.contents()),
398+
)?
399+
.try_into()?;
400+
401+
let return_type = match &signature.type_signature {
402+
TypeSignature::Exact(t) => {
403+
let store2: &mut Store<WasmStateImpl> = &mut store_guard;
404+
let r = bindings
405+
.datafusion_udf_wasm_udf_types()
406+
.scalar_udf()
407+
.call_return_type(
408+
store2,
409+
resource,
410+
&t.iter()
411+
.map(|dt| wit_types::DataType::from(dt.clone()))
412+
.collect::<Vec<_>>(),
413+
)
414+
.await
415+
.context(
416+
"call ScalarUdf::return_type",
417+
Some(&store_guard.data().stderr.contents()),
418+
)??;
419+
Some(r.try_into()?)
423420
}
421+
_ => None,
424422
};
425423

426424
udfs.push(Self {

0 commit comments

Comments
 (0)