Associate-Developer-Apache-Spark-3.5 Exam Question 6

A data engineer wants to create a Streaming DataFrame that reads from a Kafka topic called feed.

Which code fragment should be inserted in line 5 to meet the requirement?
Code context:
spark \
.readStream \
.format("kafka") \
.option("kafka.bootstrap.servers", "host1:port1,host2:port2") \
.[LINE 5] \
.load()
Options:
  • Associate-Developer-Apache-Spark-3.5 Exam Question 7

    A data scientist is analyzing a large dataset and has written a PySpark script that includes several transformations and actions on a DataFrame. The script ends with a collect() action to retrieve the results.
    How does Apache Spark™'s execution hierarchy process the operations when the data scientist runs this script?
  • Associate-Developer-Apache-Spark-3.5 Exam Question 8

    A developer is trying to join two tables, sales.purchases_fct and sales.customer_dim, using the following code:

    fact_df = purch_df.join(cust_df, F.col('customer_id') == F.col('custid')) The developer has discovered that customers in the purchases_fct table that do not exist in the customer_dim table are being dropped from the joined table.
    Which change should be made to the code to stop these customer records from being dropped?
  • Associate-Developer-Apache-Spark-3.5 Exam Question 9

    42 of 55.
    A developer needs to write the output of a complex chain of Spark transformations to a Parquet table called events.liveLatest.
    Consumers of this table query it frequently with filters on both year and month of the event_ts column (a timestamp).
    The current code:
    from pyspark.sql import functions as F
    final = df.withColumn("event_year", F.year("event_ts")) \
    .withColumn("event_month", F.month("event_ts")) \
    .bucketBy(42, ["event_year", "event_month"]) \
    .saveAsTable("events.liveLatest")
    However, consumers report poor query performance.
    Which change will enable efficient querying by year and month?
  • Associate-Developer-Apache-Spark-3.5 Exam Question 10

    28 of 55.
    A data analyst builds a Spark application to analyze finance data and performs the following operations:
    filter, select, groupBy, and coalesce.
    Which operation results in a shuffle?