PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice question 6 of 35

You want to rebuild your ML pipeline for structured data on Google Cloud. You are using PySpark to conduct data transformations at scale, but your…

Full set: 283 questions
You want to rebuild your ML pipeline for structured data on Google Cloud. You are using PySpark to conduct data transformations at scale, but your pipelines are taking over 12 hours to run. To speed up development and pipeline run time, you want to use a serverless tool and SQL syntax. You have already moved your raw data into Cloud Storage. How should you build the pipeline on Google Cloud while meeting the speed and processing requirements?
Answer options
A: Use Data Fusion's GUI to build the transformation pipelines, and then write the data into BigQuery
B: Convert your PySpark into SparkSQL queries to transform the data and then run your pipeline on Dataproc to write the data into BigQuery.
C: Ingest your data into Cloud SQL convert your PySpark commands into SQL queries to transform the data, and then use federated queries from BigQuery for machine learning
D: Ingest your data into BigQuery using BigQuery Load, convert your PySpark commands into BigQuery SQL queries to transform the data, and then write the transformations to a new table Correct answer
Correct Answer:
D. Ingest your data into BigQuery using BigQuery Load, convert your PySpark commands into BigQuery SQL queries to transform the data, and then write the transformations to a new table
Explanation

The optimal solution is to leverage BigQuery, a fully managed, serverless, petabyte-scale data warehouse designed for high-speed analytics using SQL. This approach directly meets all requirements:
1. Serverless: BigQuery is serverless, eliminating infrastructure management.
2. SQL Syntax: PySpark transformation logic can be converted to standard SQL for use in BigQuery.
3. Speed: BigQuery's massively parallel processing engine is designed to execute complex queries on large datasets far faster than a typical PySpark job on a long-running cluster. Loading data from Cloud Storage into BigQuery is a standard, efficient pattern, and materializing the transformed data into a new table is best practice for subsequent ML model training.

Why Incorrect

A. Data Fusion is primarily a GUI-based data integration service, which does not meet the specific requirement to use and convert existing logic to SQL syntax.
B. Dataproc is not serverless; it requires provisioning and managing a Spark cluster, which contradicts a core requirement of the desired solution.
C. Cloud SQL is a relational database designed for transactional (OLTP) workloads, not large-scale analytical transformations. It would be a performance bottleneck.

References

1. Google Cloud Documentation, "What is BigQuery?": "BigQuery is a serverless, highly scalable, and cost-effective cloud data warehouse... BigQuery provides a SQL interface for querying and managing data." This source confirms that BigQuery is serverless, scalable, and uses SQL, directly addressing the core requirements.

2. Google Cloud Documentation, "Introduction to loading data from Cloud Storage": "You can load data into BigQuery from Cloud Storage in batch." This supports the first step of the proposed pipeline in the correct answer (D).

3. Google Cloud Documentation, "What is Dataproc?": "Dataproc is a fully managed and highly scalable service for running Apache Spark... You can easily create and delete Dataproc clusters..." This reference confirms that Dataproc is cluster-based, making it an incorrect choice for the serverless requirement.

4. Google Cloud Documentation, "Choosing a database option": This documentation page positions Cloud SQL for "OLTP workloads" and BigQuery for "OLAP workloads" and "Big data analytics," clarifying why Cloud SQL (Option C) is inappropriate for large-scale data transformation.

5. Stanford University, CS229: Machine Learning, "Lecture Notes 13: Recommender Systems & Large-Scale ML": Course materials often discuss the architectural pattern of using a scalable data warehouse like BigQuery for pre-processing and feature engineering at scale before ML model training, which aligns with the logic in answer D. The notes emphasize using scalable, parallel systems for large data transformations.

Scroll to Top