MLA-C01 Data Preparation for Machine Learning Practice Question
Exhibit
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
args = getResolvedOptions(sys.argv, ['JOB_NAME'])
sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)
raw = glueContext.create_dynamic_frame.from_options(
connection_type="s3",
connection_options={"paths": ["s3://bucket/input/year=2023/month=01/"]},
format="json")
transformed = raw.select_fields(["col1", "col2"]).rename_field("col1", "new_col")
glueContext.write_dynamic_frame.from_options(
frame=transformed,
connection_type="s3",
connection_options={"path": "s3://bucket/output/transformed"},
format="parquet")
job.commit()Refer to the exhibit. A data engineer runs an AWS Glue ETL job with the following script portion. The job fails with an error: 'An error occurred while calling o113.pyWriteDynamicFrame. No such file or directory'. What is the most likely cause?
⚠ Common exam trap
The trap here is that candidates often focus on data format or schema issues, overlooking the subtle file system requirement for a trailing slash in the output path, which is a common source of runtime errors in Spark-based ETL jobs.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The output S3 path is missing a trailing slash
The error 'No such file or directory' when calling `pyWriteDynamicFrame` typically occurs because AWS Glue expects the output S3 path to end with a trailing slash to denote a directory. Without it, Glue may interpret the path as a file name rather than a directory, leading to a failure when attempting to write the Parquet files. Adding a trailing slash (e.g., `s3://bucket/output/`) resolves the issue.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The output format 'parquet' is not supported by Glue
Why it's wrong here
Parquet is supported.
- ✗
The input partition path is incorrect because it includes the partition key
Why it's wrong here
Including partition key in path is acceptable.
- ✓
The output S3 path is missing a trailing slash
Why this is correct
Glue DynamicFrame write expects a directory path ending with '/'.
- ✗
The schema contains a column with a reserved name
Why it's wrong here
Error message does not indicate schema issue.
Visual reference
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
This MLA-C01 question is part of Courseiva's 835-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLA-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLA-C01 exam.