Skip to content

Commit

Permalink
return error when finding multiple udf impls
Browse files Browse the repository at this point in the history
Signed-off-by: Runji Wang <[email protected]>
  • Loading branch information
wangrunji0408 committed May 20, 2024
1 parent f13b617 commit 801ad00
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/expr/core/src/sig/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//!
//! See expr/impl/src/udf for the implementations.
use anyhow::{Context, Result};
use anyhow::{bail, Context, Result};
use arrow_array::RecordBatch;
use futures::stream::BoxStream;
use risingwave_common::types::DataType;
Expand All @@ -40,12 +40,16 @@ pub fn find_udf_impl(
runtime: Option<&str>,
link: Option<&str>,
) -> Result<&'static UdfImplDescriptor> {
UDF_IMPLS
let mut impls = UDF_IMPLS
.iter()
.find(|desc| (desc.match_fn)(language, runtime, link))
.context(
"language not found.\nHINT: UDF feature flag may not be enabled during compilation",
)
.filter(|desc| (desc.match_fn)(language, runtime, link));
let impl_ = impls.next().context(
"language not found.\nHINT: UDF feature flag may not be enabled during compilation",
)?;
if impls.next().is_some() {
bail!("multiple UDF implementations found for language: {language}");
}
Ok(impl_)
}

/// UDF implementation descriptor.
Expand Down

0 comments on commit 801ad00

Please sign in to comment.