Skip to content

SNOW-2454707: Type error when writing a udf using @udf #3944

@aliasgar55

Description

@aliasgar55

Here is the error we get when we write a udf using @F.udf

@F.udf(name="BETA_INV_UDF", is_permanent=False, packages=['scipy', 'pandas'], return_type=FloatType(), input_types=[FloatType(), FloatType(), FloatType()])
        def beta_inv_udf(p: pd.Series, a: pd.Series, b: pd.Series) -> pd.Series:
            return betaincinv(p, a, b)

Argument of type "(p: Series[Unknown], a: Series[Unknown], b: Series[Unknown]) -> Series[Unknown]" cannot be assigned to parameter "cols" of type "ColumnOrName | Iterable[ColumnOrName]" in function "call"
Type "(p: Series[Unknown], a: Series[Unknown], b: Series[Unknown]) -> Series[Unknown]" is not assignable to type "ColumnOrName | Iterable[ColumnOrName]"
"FunctionType" is not assignable to "Column"
"FunctionType" is not assignable to "str"
"FunctionType" is incompatible with protocol "Iterable[ColumnOrName]"
"iter" is not presentPylancereportArgumentType

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageInitial RCA is required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions