pyspark.sql.functions.inline

pyspark.sql.functions.inline(col: ColumnOrName) → pyspark.sql.column.Column[source]

Explodes an array of structs into a table.

New in version 3.4.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colColumn or str

input column of values to explode.

Returns
Column

generator expression with the inline exploded result.

See also

explode()

Examples

>>> from pyspark.sql import Row
>>> df = spark.createDataFrame([Row(structlist=[Row(a=1, b=2), Row(a=3, b=4)])])
>>> df.select(inline(df.structlist)).show()
+---+---+
|  a|  b|
+---+---+
|  1|  2|
|  3|  4|
+---+---+