Skip to content
Advertisement

Pandas UDF throws error not of required length

I have a delta table which has thrift data from kafka and I am using a UDF to deserialize it. I have no issues when I use regular UDF, but I get an error when I try to use Pandas UDF.

This runs fine i.e. ruglar UDF

JavaScript

But when I use Pandas UDF

JavaScript

I get an error PythonException: 'RuntimeError: Result vector from pandas_udf was not the required length: expected 5000, got 651'.

Advertisement

Answer

Figured out the solution, we have to return the output as a series

Advertisement