pyspark.sql.functions.
inline_outer
Explodes an array of structs into a table. Unlike inline, if the array is null or empty then null is produced for each nested column.
New in version 3.4.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
input column of values to explode.
generator expression with the inline exploded result.
See also
explode_outer()
inline()
Examples
>>> from pyspark.sql import Row >>> df = spark.createDataFrame([ ... Row(id=1, structlist=[Row(a=1, b=2), Row(a=3, b=4)]), ... Row(id=2, structlist=[]) ... ]) >>> df.select('id', inline_outer(df.structlist)).show() +---+----+----+ | id| a| b| +---+----+----+ | 1| 1| 2| | 1| 3| 4| | 2|null|null| +---+----+----+