PROFESSIONAL-DATA-ENGINEER practice question 2 of 10

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

Full set: 401 questions
You want to rebuild your batch pipeline for structured data on Google Cloud You are using PySpark to conduct data transformations at scale, but your pipelines are taking over twelve hours to run. To expedite 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 speed and processing requirements?
Answer options
A: Convert your PySpark commands into SparkSQL queries to transform the data; and then run your pipeline on Dataproc to write the data into BigQuery
B: Ingest your data into Cloud SQL, convert your PySpark commands into SparkSQL queries to transform the data, and then use federated queries from BigQuery for machine learning.
C: Ingest your data into BigQuery from Cloud Storage, convert your PySpark commands into BigQuery SQL queries to transform the data, and then write the transformations to a new table Correct answer
D: Use Apache Beam Python SDK to build the transformation pipelines, and write the data into BigQuery
Correct Answer:
C. Ingest your data into BigQuery from Cloud Storage, convert your PySpark commands into BigQuery SQL queries to transform the data, and then write the transformations to a new table
Explanation

The most effective solution is to adopt a serverless Extract-Load-Transform (ELT) pattern using Cloud Storage and BigQuery. First, load the raw structured data from Cloud Storage directly into a staging table in BigQuery. BigQuery is a fully-managed, serverless data warehouse designed for petabyte-scale analytics. Then, convert the PySpark transformation logic into BigQuery Standard SQL queries. Executing these SQL queries within BigQuery leverages its massively parallel processing engine to perform the transformations far more quickly than the original Spark job. The final results are then written to a new, permanent table in BigQuery. This approach meets all requirements: it is serverless, uses SQL, and significantly expedites both development and execution time.

Why Incorrect

A: Dataproc is a managed service for Spark/Hadoop, but it is not fully serverless as it requires cluster configuration and management, which does not meet the "serverless tool" and "expedite development" requirements as effectively as BigQuery. B: Cloud SQL is a relational database service (OLTP) and is not designed or optimized for large-scale analytical data transformations. Ingesting and processing large batch data in Cloud SQL would be inefficient and slow. D: This option suggests using the Apache Beam Python SDK. While this can be run on the serverless Dataflow service, it contradicts the user's explicit requirement to move from a programmatic tool (PySpark) to SQL syntax.

References

1. BigQuery as a Serverless Data Warehouse: "BigQuery is Google's fully managed, petabyte-scale, and cost-effective analytics data warehouse that lets you run analytics over vast amounts of data in near real time. With BigQuery, there’s no infrastructure to manage..."

Source: Google Cloud Documentation, "What is BigQuery?", Introduction.

2. ELT Pattern with BigQuery: "A common pattern is to load data from a transactional data source into Cloud Storage, and then use a batch load job to load the data into BigQuery. You can then use BigQuery to transform the data."

Source: Google Cloud Documentation, "Introduction to designing data processing systems", Section: "Batch data processing".

3. Dataproc vs. BigQuery: Dataproc provides a managed environment for open-source tools like Apache Spark. In contrast, "BigQuery is a serverless, highly scalable, and cost-effective cloud data warehouse... You don't need to deploy or manage any clusters." This highlights why BigQuery is the superior choice for the "serverless" requirement.

Source: Google Cloud Documentation, "BigQuery for data warehouse practitioners", Section: "BigQuery and other technologies".

4. Cloud SQL Use Case: "Cloud SQL is a fully managed relational database service for MySQL, PostgreSQL, and SQL Server." It is optimized for online transaction processing (OLTP), not the large-scale batch analytics (OLAP) described in the scenario.

Source: Google Cloud Documentation, "Cloud SQL", Product overview.

Scroll to Top