Failing to decompress streaming data by using UDF on Azure Databricks - Python
Well, that was way simpler than I thought. I was basically, trying to display a byte-like data haha.
The code below solved the problem:
import zlib
def streamDecompress(val):
return str(zlib.decompress(val, 15+32))
func_udf = udf(lambda x: streamDecompress(x))
df = eventHubStream.withColumn("body", func_udf(eventHubStream["body"])).select('body')
display(df, truncate=False)