Associate-Developer-Apache-Spark Exam Question 46

The code block displayed below contains an error. The code block should save DataFrame transactionsDf at path path as a parquet file, appending to any existing parquet file. Find the error.
Code block:
  • Associate-Developer-Apache-Spark Exam Question 47

    Which of the following code blocks reorders the values inside the arrays in column attributes of DataFrame itemsDf from last to first one in the alphabet?
    1.+------+-----------------------------+-------------------+
    2.|itemId|attributes |supplier |
    3.+------+-----------------------------+-------------------+
    4.|1 |[blue, winter, cozy] |Sports Company Inc.|
    5.|2 |[red, summer, fresh, cooling]|YetiX |
    6.|3 |[green, summer, travel] |Sports Company Inc.|
    7.+------+-----------------------------+-------------------+
  • Associate-Developer-Apache-Spark Exam Question 48

    Which of the following code blocks reads in the JSON file stored at filePath, enforcing the schema expressed in JSON format in variable json_schema, shown in the code block below?
    Code block:
    1.json_schema = """
    2.{"type": "struct",
    3. "fields": [
    4. {
    5. "name": "itemId",
    6. "type": "integer",
    7. "nullable": true,
    8. "metadata": {}
    9. },
    10. {
    11. "name": "supplier",
    12. "type": "string",
    13. "nullable": true,
    14. "metadata": {}
    15. }
    16. ]
    17.}
    18."""
  • Associate-Developer-Apache-Spark Exam Question 49

    The code block displayed below contains an error. The code block should return all rows of DataFrame transactionsDf, but including only columns storeId and predError. Find the error.
    Code block:
    spark.collect(transactionsDf.select("storeId", "predError"))
  • Associate-Developer-Apache-Spark Exam Question 50

    Which of the following describes Spark's standalone deployment mode?