QuestionQ183

VerifiedData Processing & Transformations

A data engineer must apply custom logic to identify employees with more than 5 years of experience in the employees array column of the stores table. The logic should create a new exp_employees column containing, for each row, an array of every employee with more than 5 years of experience. To apply this custom logic at scale, the data engineer wants to use the FILTER higher-order function.

Which of the following code blocks successfully accomplishes this task?

Explanation

The FILTER higher-order function takes an array and a Boolean lambda predicate, returning an array of the elements for which the predicate is true. FILTER(employees, i -> i.years_exp > 5) evaluates years_exp for each employee struct and retains only employees whose value exceeds 5.

Learn more

Community Discussion

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