QuestionQ257

VerifiedData Processing & Transformations

A data engineer has two DataFrames: orders_df (containing all orders) and customers_df (containing only active customers). The data engineer needs to filter out orders that were placed by inactive customers.

Which operation should the data engineer use?

Explanation

Performing an inner join between orders_df and customers_df returns only the rows where the join key matches in both DataFrames. Since customers_df contains only active customers, the inner join naturally excludes any orders associated with customers not present in customers_df — i.e., inactive customers — leaving only orders placed by active customers. This is the standard approach in Spark/DataFrame APIs for filtering one dataset based on membership in another.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!