pyspark.sql.tvf.TableValuedFunction.inline_outer#
- TableValuedFunction.inline_outer(input)[source]#
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 4.0.0.
- Parameters
- input
Column
input column of values to explode.
- input
- Returns
DataFrame
See also
Examples
>>> import pyspark.sql.functions as sf >>> spark.tvf.inline_outer(sf.array( ... sf.named_struct(sf.lit("a"), sf.lit(1), sf.lit("b"), sf.lit(2)), ... sf.named_struct(sf.lit("a"), sf.lit(3), sf.lit("b"), sf.lit(4)) ... )).show() +---+---+ | a| b| +---+---+ | 1| 2| | 3| 4| +---+---+ >>> spark.tvf.inline_outer(sf.array().astype("array<struct<a:int,b:int>>")).show() +----+----+ | a| b| +----+----+ |NULL|NULL| +----+----+