Databricks Certified Associate Developer for Apache Spark — Question 85
The code block shown below contains an error. The code block is intended to return a new DataFrame that is the result of a position-wise union between DataFrame storesDF and DataFrame acquiredStoresDF.
Answer options
- A. concat(storesDF, acquiredStoresDF)
- B. storesDF.unionByName(acquiredStoresDF)
- C. union(storesDF, acquiredStoresDF)
- D. unionAll(storesDF, acquiredStoresDF)
- E. storesDF.union(acquiredStoresDF)
Correct answer: E
Explanation
The correct answer is E because the union method is specifically designed for combining DataFrames in a compatible way. The other options either do not exist or do not perform the intended position-wise union as required.