Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //inputDataFrame
- +---+------+----------+
- |age| name|occupation|
- +---+------+----------+
- | []|Harish| developer|
- +---+------+----------+
- df.withColumn("age",explode(col("age")))
- //DataFrame with age column exploded
- +---+----+----------+
- |age|name|occupation|
- +---+----+----------+
- +---+----+----------+
- // expected DataFrame
- +---+------+----------+ +----+------+----------+
- |age| name|occupation| |age | name|occupation|
- +---+------+----------+ (or)+----+------+----------+
- | |Harish| developer| |null|Harish| developer|
- +---+------+----------+ +----+------+----------+
Add Comment
Please, Sign In to add comment