Summer Certification Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: force70

Databricks Certified Data Engineer Associate Exam Databricks-Certified-Data-Engineer-Associate Question # 7 Topic 1 Discussion

Databricks Certified Data Engineer Associate Exam Databricks-Certified-Data-Engineer-Associate Question # 7 Topic 1 Discussion

Databricks-Certified-Data-Engineer-Associate Exam Topic 1 Question 7 Discussion:
Question #: 7
Topic #: 1

A data engineer has a PySpark DataFrame named events_df with the following schema:

event_id STRING,

device STRUCT <

id: STRING,

model: STRING,

location: STRUCT <

latitude: DOUBLE,

longitude: DOUBLE

>

> ,

event_ts TIMESTAMP

The engineer needs to flatten all nested device fields into root-level columns while retaining the event identifier and timestamp.

Which PySpark expression achieves this requirement?


A.

events_df.withColumn( " device_id " , events_df[ " device.id " ]).withColumn( " device_model " , events_df[ " device.model " ]).withColumn( " location " , events_df[ " device.location " ])


B.

events_df.select( " event_id " , " event_ts " , " device.* " )


C.

events_df.select( " event_id " , " event_ts " , " device.id " , " device.model " , " device.location.latitude " , " device.location.longitude " )


D.

events_df.select( " event_id " , " device[id] " , " device[model] " , " device.location[latitude] " , " device.location[longitude] " , " event_ts " )


Get Premium Databricks-Certified-Data-Engineer-Associate Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.