Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
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.
Syntax
spark.tvf.inline_outer(input)
Parameters
| Parameter | Type | Description |
|---|---|---|
input |
pyspark.sql.Column |
Input column of values to explode. |
Returns
pyspark.sql.DataFrame: A DataFrame with exploded struct rows, or null values if the array is empty or null.
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|
+---+---+
import pyspark.sql.functions as sf
spark.tvf.inline_outer(sf.array().astype("array<struct<a:int,b:int>>")).show()
+----+----+
| a| b|
+----+----+
|NULL|NULL|
+----+----+