Certified Data Engineer Associate Exam QuestionsBrowse all questions from this exam

Certified Data Engineer Associate Exam - Question 62


A data engineer needs to apply custom logic to identify employees with more than 5 years of experience in array column employees in table stores. The custom logic should create a new column exp_employees that is an array of all of the employees with more than 5 years of experience for each row. In order 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 completes this task?

Show Answer
Correct Answer: A

The FILTER higher-order function is used to filter elements of an array based on a specified condition. In this context, we need to filter the 'employees' array to retain only those employees with more than 5 years of experience. The appropriate code block to achieve this uses the FILTER function correctly by specifying the array 'employees' and the lambda function to apply the condition 'i -> i.years_exp > 5'. This will create a new column 'exp_employees' with the filtered array for each row. Therefore, the code block in option A is correct.

Discussion

5 comments
Sign in to comment
meow_akkOption: A
Oct 22, 2023

A is correct.

55f31c8Option: A
Nov 29, 2023

https://docs.databricks.com/en/sql/language-manual/functions/filter.html

kz_dataOption: A
Dec 6, 2023

A is correct

AndreFROption: A
Dec 20, 2023

B & E incorrect : source is employees not exp_employees D incorrect : does not use FILTER higher-order function) C incorrect : syntax errror A : correct by elimination & based on https://docs.databricks.com/en/sql/language-manual/functions/filter.html#examples

benni_aleOption: A
Apr 29, 2024

A is correct