Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Unsafe overlap in pandas_udf #269

Closed
zero323 opened this issue Oct 8, 2019 · 1 comment
Closed

Unsafe overlap in pandas_udf #269

zero323 opened this issue Oct 8, 2019 · 1 comment

Comments

@zero323
Copy link
Owner

zero323 commented Oct 8, 2019

Unfortunately decorators for Pandas scalar udf overlap unsafely between scalar-to-scalar and scalar-to-struct variants. The culprit is return type:

  • scalar-to-scalar uses Union[AtomicDataTypeOrString, ArrayType]
  • scalar-to-struct uses Union[StructType, str]

and OrString (in AtomicDataTypeOrString) ans str cause overlap.

One possible solution is to disallow str schema for on of these, preferably scalar-to-scalar:

def pandas_udf(f: Union[AtomicType, ArrayType], returnType: PandasScalarUDFType) -> Callable[[PandasScalarToScalarFunction], UserDefinedFunctionLike]: ...
@zero323
Copy link
Owner Author

zero323 commented Jan 19, 2020

We can revisit this later but for now, we'll just ignore[misc] overlaps. Quoting JukkaL

Some potentially useful overloaded signatures can't be represented without making them overlapping.

@zero323 zero323 closed this as completed Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant