The .unionAll(...) transformation

The .unionAll(...) transformation appends values from another DataFrame. An equivalent in SQL syntax is UNION ALL.

Look at the following code:

another_macBookPro = sc.parallelize([
(5, 'MacBook Pro', 2018, '15"', '16GB', '256GB SSD', 13.75, 9.48, 0.61, 4.02)
]).toDF(sample_data_schema.columns)

sample_data_schema.unionAll(another_macBookPro).show()

It produces the following result:

In SQL syntax, the preceding would read as:

SELECT *
FROM sample_data_schema

UNION ALL
SELECT *
FROM another_macBookPro
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset