SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Data Operations and Support

Data Quality on AWS: Glue Data Quality, DataBrew and Skew Handling

16 min readDEA-C01 · Data Operations and SupportUpdated

Ensuring data quality on AWS means checking data against defined rules while it is being processed — not after bad records have already reached a warehouse. The two exam-critical services are AWS Glue Data Quality, which evaluates rulesets written in the Data Quality Definition Language (DQDL) against Data Catalog tables or inside Glue ETL jobs, and AWS Glue DataBrew, which profiles datasets visually and validates its own data quality rules during profile jobs. DEA-C01 task 3.4 also tests the supporting craft: the dimensions that define quality (completeness, accuracy, consistency and more), in-pipeline checks such as detecting empty fields, investigating consistency across systems, choosing a data sampling technique, and handling data skew so one oversized partition does not stall a distributed job. This lesson covers each skill with the trade-offs and failure modes the exam probes, including where quality results should route — quarantine paths, EventBridge events and Amazon SNS alerts.

What you’ll learn
  • Name the core data quality dimensions and map a described defect to the dimension it violates
  • Implement in-pipeline quality checks with row-level quarantine or fail-fast gating in the Glue Evaluate Data Quality transform
  • Author AWS Glue Data Quality rulesets in DQDL — completeness, blanks, uniqueness, thresholds, dynamic and multi-dataset rules
  • Alert on quality results with EventBridge events and CloudWatch metrics, and orchestrate gates with Step Functions
  • Use AWS Glue DataBrew profiling and rulesets to assess and validate datasets, and choose between DataBrew and Glue Data Quality
  • Investigate data consistency across sources using reconciliation counts, checksums and cross-dataset rules
  • Select appropriate data sampling techniques and apply mechanisms that mitigate data skew in distributed jobs

The dimensions of data quality

Data quality is measured along named dimensions, and the exam expects you to recognize which dimension a described defect violates. The core list:

  • Completeness — required values are present; null or empty customer_id fields fail it.
  • Accuracy — values reflect reality; a recorded temperature of 500 degrees fails it.
  • Consistency — the same fact agrees across datasets and systems; an order total that differs between the operational store and the warehouse fails it.
  • Validity (conformity) — values match the expected format, type or domain; a date stored as 31/02/2025 or a state code outside the allowed set fails it.
  • Uniqueness — entities appear once; duplicate primary keys fail it.
  • Timeliness (freshness) — data arrives within its expected window; yesterday's partition missing at 9 a.m. fails it.
  • Integrity — references resolve; an order row pointing at a nonexistent customer fails it.

These dimensions are not academic garnish — they are the vocabulary of the tooling. AWS Glue Data Quality rule types map almost one-to-one onto them (IsComplete and Completeness for completeness, IsUnique and IsPrimaryKey for uniqueness, ColumnValues for validity, DataFreshness for timeliness, ReferentialIntegrity for integrity, RowCountMatch and AggregateMatch for cross-dataset consistency), and DataBrew's profile output reports missing values, duplicates and type mismatches per column. When a question describes a symptom — "analysts report the same customer appears three times" — translate it to the dimension (uniqueness), then to the rule or check that enforces it. That two-step translation solves most quality questions on the exam.

Running quality checks while processing data

Quality checks belong inside the pipeline, at the point of processing, because a bad record caught mid-flight costs one branch decision, while the same record discovered in the warehouse costs a backfill and a credibility conversation. The simplest and most-tested check is empty-field detection: flag records whose required columns are null or blank. In a Glue job the managed way is the Evaluate Data Quality transform with a DQDL ruleset; in a Lambda-based stream processor it is a per-record guard clause; in SQL-based flows it is a WHERE clause separating good rows from bad.

What you do with failing records matters as much as detecting them, and there are three postures. Fail fast: stop the job when quality falls below threshold — right when downstream consumers must never see bad data, such as financial reporting. Quarantine: route failing records to a separate S3 prefix or table (a dead-letter pattern for data) and let the clean majority proceed in the same run — right for high-volume feeds where a fraction of bad rows should not block the whole load, and it preserves the evidence for debugging. Tag and continue: stamp each row with a quality flag and let consumers decide — right for exploratory or ML workloads.

Row-level outcomes: how quarantine works in Glue

When the Evaluate Data Quality transform outputs the original data with row-level results enabled, it appends four columns to every row: DataQualityRulesPass, DataQualityRulesFail, DataQualityRulesSkip (arrays of rule names) and DataQualityEvaluationResult (Passed or Failed). Route on that last column — for example with a Conditional Router transform — so passed rows go to the curated target and failed rows go to a quarantine location, in the same run. Only rules that can be judged per row (IsComplete, ColumnValues and similar) flag individual rows. Dataset-level rules such as RowCount, Sum or RowCountMatch describe the whole batch, so at row level they land in DataQualityRulesSkip and can never quarantine a row; act on them through the job-level result instead.

Fail-fast gating: the On ruleset failure action

The transform's On ruleset failure setting decides what a failed ruleset does to the job:

OptionWhat happensUse when
None (the default)Results are recorded; the job continues and finishes SucceededQuarantine or tag-and-continue designs
Fail job after loading data to targetThe job is marked failed once the run reaches its target writeYou want a failed run as the signal but are not relying on the gate to keep data out
Fail job without loading to target dataThe job fails before writing, so nothing reaches the targetA true gate: consumers must never see a failing batch

For a gate, place the evaluation before the target write and choose fail without loading. Because the default is None, a ruleset can fail on every run while the job stays green — which is why the next section on alerting matters.

AWS Glue Data Quality and DQDL rules

AWS Glue Data Quality is the purpose-built rules engine for the Glue ecosystem: you define a ruleset in the Data Quality Definition Language (DQDL), evaluate it, and get a per-rule pass or fail plus an overall score. It runs in two modes. Against a Data Catalog table, it checks data at rest on demand or on a schedule. Inside a Glue ETL job, the Evaluate Data Quality transform checks data in motion and can produce row-level results for quarantine, as described above.

Rules you should be able to read

RuleWhat it checks
IsComplete "customer_id"Zero nulls in the column
Completeness "email" > 0.95More than 95% of values are non-null — a tolerated fraction
IsUnique "order_id"No duplicate values
IsPrimaryKey "order_id" "line_no"Complete and unique; several columns form a composite key
ColumnValues "age" between 0 and 120Values in a range (validity)
ColumnValues "status" in ["NEW","SHIPPED"] with threshold > 0.98Allowed set, tolerating fewer than 2% exceptions
ColumnValues "name" not in [NULL, EMPTY, WHITESPACES_ONLY]No nulls, empty strings or blank-only strings
DistinctValuesCount "region" > 3Cardinality of a column
RowCount between 1000 and 50000Static volume sanity
RowCount > avg(last(10)) * 0.8Dynamic: at least 80% of the average of the last 10 runs
DataFreshness "order_date" <= 24 hoursTimeliness of the newest records

Null is not the same as blank. IsComplete and Completeness count only nulls. A blank field in a CSV file read into a String column arrives as an empty string, not null, so it passes both rules. To catch blanks, use the ColumnValues keywords EMPTY and WHITESPACES_ONLY (with NULL) as shown above.

Dynamic rules compare a metric with its own history using last(k) and functions such as avg, min and max — the right tool for "alert if today's load is far smaller than usual" without hard-coding a number. They are supported in Glue ETL jobs only, not in Data Catalog rulesets. Glue Data Quality also offers analyzers with anomaly detection for the same purpose when you do not want to pick thresholds yourself.

Recommendations versus column statistics

Rule recommendations scan a table and draft a DQDL ruleset from observed statistics (this column was never null, these values were always in this range). They are a starting point you review and edit before saving — they encode what the data has been, not what it must be. Do not confuse them with Data Catalog column statistics, which compute descriptive numbers for a table (null counts, distinct values, minimum and maximum, lengths) for query planning and discovery but propose no rules.

One scoping note: the official guide names DataBrew as its example service, but Glue Data Quality with DQDL is AWS's main quality offering and appears in practice; know both, and tell them apart by workflow — DataBrew is visual and analyst-friendly, Glue Data Quality is DQDL-driven and pipeline-native.

Alerting and orchestrating on quality results

Quality results reach people through Amazon EventBridge and Amazon CloudWatch, not through job failure. When the Publish metrics to Amazon CloudWatch option (on by default) stays selected, each evaluation emits CloudWatch metrics in the Glue Data Quality namespace — such as glue.data.quality.rules.passed and glue.data.quality.rules.failed — and an EventBridge event from source aws.glue-dataquality with detail-type Data Quality Evaluation Results Available. Clear that option and neither is emitted.

Two practical patterns: an EventBridge rule matching that detail-type with state FAILED, targeting an Amazon SNS topic; or a CloudWatch alarm on glue.data.quality.rules.failed greater than zero. Keep the two job-related signals apart:

SignalFires when
Glue Job State Change event, state FAILED (source aws.glue)The job run itself fails
Data Quality Evaluation Results Available, state FAILEDA ruleset evaluation fails, whether or not the job fails

This distinction catches many designs: a quarantining job (On ruleset failure = None) succeeds even when rules fail, so job-failure events and alarms never fire. Alert on the data quality event or metric instead. DataBrew has its own equivalent, the DataBrew Ruleset Validation Result event.

Orchestration. If AWS Step Functions runs the job and must react to a failed gate, call Glue with the startJobRun.sync (run a job) integration so the state waits for the run to finish and fails when the job fails; add a Catch that routes to an SNS notification or cleanup state. The plain request-response integration returns as soon as the run starts, so the workflow never sees the failure. A failure only exists to catch if the gate actually fails the job — that is, the On ruleset failure action is not None.

AWS Glue DataBrew: profiling and quality rules

AWS Glue DataBrew approaches quality from the analyst's side: a visual, no-code service for profiling and preparing data. A profile job runs against a dataset and produces per-column statistics — missing value counts, distinct and duplicate counts, type distribution, min, max, percentiles, correlations and outliers. Profiling is the reconnaissance step of any quality effort: before you can write sensible rules, you need to know what the data actually looks like.

DataBrew also has its own data quality rules: you define a ruleset — column X has no missing values, column Y is unique, values in column Z fall within a range or match a pattern — and associate it with a dataset. Rulesets are validated only when a profile job runs, not by recipe jobs, and each validation emits a DataBrew Ruleset Validation Result event to EventBridge as well as a per-rule pass or fail report. DataBrew can also suggest rules from a profile. Downstream of assessment, DataBrew recipes fix what profiling found — over 250 built-in transformations to fill or drop missing values, deduplicate, standardize formats and split columns — applied at scale by recipe jobs without writing Spark. Recipes clean; profile jobs and rulesets measure.

AWS Glue Data QualityAWS Glue DataBrew
Main userData engineers building pipelinesAnalysts and data stewards
How rules are writtenDQDL rulesets (recommendations to review)Visual rulesets attached to a dataset
Where rules runData Catalog tables, or inside Glue ETL jobsProfile jobs
Row-level routingYes, in ETL jobsNo — reports per rule
Result eventData Quality Evaluation Results AvailableDataBrew Ruleset Validation Result

The gotcha to remember: a DataBrew project (the interactive session) works on a sample — first n rows, last n rows or a random selection, up to 5,000 rows — and a profile job by default reads a custom row count (20,000 rows) unless you choose the full dataset. A session or default profile can therefore look clean while rare defects hide in the rows it never read, which is why sampling technique is on the exam.

Investigating data consistency

Investigating consistency means proving that data agrees with itself across hops — source to landing zone, landing zone to warehouse, warehouse to report. Start with reconciliation counts: row counts per table and per partition at each stage, compared automatically after every load. A count mismatch localizes the loss to a hop, which is most of the diagnosis. But counts only prove the number of rows agrees: a load that changes values — truncated decimals, a shifted currency, a wrong join — keeps the count identical. Catch value drift with aggregate checksums: sums of numeric measures, hashes over sorted keys or rows, or column aggregates compared source to target per partition.

Within a dataset, consistency questions become rule checks: cross-field logic (ship date not before order date), referential integrity (every fact row's foreign key resolves to a dimension row) and cross-dataset agreement. When both datasets can be read in one Glue job, DQDL has multi-dataset rules that use a reference alias: RowCountMatch (row counts agree within a ratio), AggregateMatch (for example, the sum of a column matches between primary and reference), DatasetMatch (rows match on key columns) and ReferentialIntegrity (values exist in the reference dataset). Profiling both sides with DataBrew and comparing the reports — distributions, distinct counts, null rates — also reveals quickly where two supposedly identical datasets diverge.

Two recurring causes deserve names. At-least-once duplicates: streaming and retrying pipelines may deliver a record more than once, and append-only writes then leave the target with more rows than the source. Fix the write, not the report: make it idempotent with a merge (upsert) on a unique event id — MERGE INTO on an Apache Iceberg table, for example — and add a uniqueness rule. Timing skew: comparing a source at 9:00 against a target loaded at 8:00 manufactures phantom inconsistency — reconcile against a common watermark or partition boundary, not wall-clock now.

Uniqueness across incremental loads. An IsUnique or IsPrimaryKey rule evaluated only on each new micro-batch proves the batch has no internal duplicates; it cannot see a row that repeats one loaded yesterday. Evaluate uniqueness on the target table after the load (or deduplicate with MERGE so the target cannot hold repeats). When a scenario says "the dashboard does not match the source system," the systematic answer walks the pipeline hop by hop with counts and checksums, rather than re-running the load and hoping.

Data sampling techniques

Sampling trades completeness of inspection for speed and cost, and the right technique is the one whose bias fits the goal. Random sampling selects every record with equal probability — the default for estimating overall quality metrics because it is unbiased, though small subpopulations may be missed entirely. Stratified sampling divides data into groups (by region, event type, customer tier) and samples each group — often oversampling the small ones — guaranteeing rare-but-important segments are represented. Systematic sampling takes every nth record — cheap, but biased when the data has a period that lines up with the interval. Cluster sampling picks whole groups (for example, a few complete partitions or files) and inspects everything in them — cheap to read, but only representative if the clusters resemble each other. First-n or last-n (head or tail) sampling grabs rows from one end — fastest of all and the most biased, since files are usually ordered by time or key; fine for checking schema, wrong for measuring quality.

These choices are concrete in AWS tooling. A DataBrew project samples FIRST_N, LAST_N or RANDOM rows, up to 5,000. A DataBrew profile job reads either the full dataset or a custom number of rows (20,000 by default). Athena offers TABLESAMPLE (BERNOULLI or SYSTEM) for quick approximate exploration of large tables.

The key judgment: samples estimate; they cannot certify. A random sample can estimate a ratio rule such as "about 3% of emails are missing" with known error. It cannot prove uniqueness: a duplicate is only visible if both copies land in the sample, which at a 10% sample happens for about 1 in 100 pairs — so a handful of duplicates in millions of rows will almost always be missed. The same goes for any rare defect. Sample for profiling, distribution analysis and quick investigation; run gate rules such as IsUnique, IsPrimaryKey or IsComplete against the full batch, as Glue Data Quality does inside an ETL job.

Handling data skew in distributed processing

Data skew is an uneven distribution of records across partitions in a distributed job, and its signature is clear: in Spark on Glue or EMR, 199 of 200 tasks finish in seconds while one grinds for an hour, holding the whole stage up — or dies with an executor out-of-memory error. The cause is a hot key: a null-heavy join column, one customer generating half the events, or a partition key where one value dominates. Skew is also a quality concern because it usually reflects a data property (unexpected nulls, default values, runaway duplicates).

Why more partitions do not help. A shuffle sends every row with the same key to the same partition. Raising spark.sql.shuffle.partitions or repartitioning on the hot key spreads the other keys more thinly, but the hot key still lands, whole, in one task. To split it you must change the key (salting) or avoid the shuffle (broadcast).

MitigationHow it worksFits
Adaptive Query Execution (AQE) skew joinSpark detects oversized shuffle partitions at runtime and splits them for sort-merge joins; on by default in Glue 4.0 and laterSkewed joins — the low-effort first step
Broadcast joinCopies the small side to every executor so the large side is never shuffled; automatic only below spark.sql.autoBroadcastJoinThreshold (10 MB by default), otherwise add a broadcast() hintLarge fact joined to a small dimension
Isolate null or hot keysHandle the degenerate key in a separate path — null keys never match in a join, so in a left join pass them straight through and union them backNull-heavy join keys
SaltingAppend a random suffix (0–N) to the hot key, replicate the other join side N times, or aggregate in two stages (salted key, then original key)Hot keys AQE does not handle, such as a skewed groupBy
Repartition on a better keyRepartition on a higher-cardinality or composite keyUneven input or output partitioning, not a single hot key

Null keys. All null join keys hash to the same partition, so a column that is 40% null produces one giant task even though nulls never match anything. Filter them out of the join and add them back afterwards for a left join.

Aggregations differ from joins. AQE's skew handling applies to joins. Built-in aggregations such as sum and count are partially aggregated on each executor before the shuffle, so a hot key sends only one partial result per task and rarely hurts. Skew bites when per-group work cannot be combined early — for example a grouped pandas function (applyInPandas), which loads a whole group into one task's memory and can run out of memory on a hot key. Prefer built-in aggregations where they express the logic; salt with a two-stage aggregation only when per-key work cannot be partially aggregated.

Scenario to remember: a Glue join of clickstream events to sessions runs forever; the Spark UI shows one task shuffling far more data than the rest, and profiling reveals 40% of events carry a null session ID from a broken mobile client. The complete answer spans both halves of this lesson — isolate or quarantine the nulls (a completeness rule would have caught them at ingestion), then let AQE or salting handle any remaining hot keys. Fixing skew without fixing the defect that caused it treats the symptom only.

Tip. Expect symptom-to-dimension questions (duplicates mean uniqueness, nulls mean completeness, stale partitions mean timeliness) and DQDL rule selection, including blanks versus nulls, IsPrimaryKey, thresholds and dynamic RowCount rules. In-pipeline handling is tested through the Evaluate Data Quality transform: row-level columns routed to quarantine, dataset-level rules being skipped per row, and the On ruleset failure options. Alerting questions hinge on the Data Quality Evaluation Results Available event and CloudWatch metrics versus job-failure alarms that never fire, and on Step Functions .sync integration. Tool selection contrasts Glue Data Quality with DataBrew profile jobs and rulesets. Consistency questions expect checksums beyond row counts, multi-dataset rules and MERGE for at-least-once duplicates. Sampling questions hinge on bias and on never certifying uniqueness from a sample; skew questions describe one straggler task or executor OOM and expect AQE, broadcast, null-key isolation or salting — not more partitions.

Key takeaways
  • Memorize the quality dimensions — completeness, accuracy, consistency, validity, uniqueness, timeliness, integrity — and translate a symptom into a dimension, then into the rule that enforces it.
  • The Evaluate Data Quality transform adds DataQualityRulesPass/Fail/Skip and DataQualityEvaluationResult columns; route on the result to quarantine failing rows. Dataset-level rules such as RowCount are skipped at row level.
  • On ruleset failure defaults to None, so failing rules leave the job Succeeded; use Fail job without loading to target data, placed before the write, for a true gate.
  • IsComplete and Completeness count nulls only — CSV blanks in String columns are empty strings; catch them with ColumnValues not in [NULL, EMPTY, WHITESPACES_ONLY]. IsPrimaryKey means complete plus unique, across one or more columns.
  • Dynamic rules such as RowCount > avg(last(10)) * 0.8 run in Glue ETL only; rule recommendations draft rules to review, while Data Catalog column statistics only describe data.
  • Alert on the Data Quality Evaluation Results Available event (state FAILED) or the glue.data.quality.rules.failed metric — Publish metrics to CloudWatch must stay on — not on Glue job failure, which a quarantining job never triggers.
  • DataBrew rulesets are validated only by profile jobs (emitting a DataBrew Ruleset Validation Result event); recipes clean data. Projects sample up to 5,000 rows (first n, last n, random); profile jobs default to 20,000 rows unless set to the full dataset.
  • Row counts miss changed values — reconcile with sums or hashes and DQDL multi-dataset rules; fix at-least-once duplicates with MERGE on a unique id and check uniqueness on the target, not just the new batch.
  • Samples estimate but cannot certify: run uniqueness and completeness gates on the full batch.
  • More shuffle partitions never split a hot key. Use AQE skew joins (default in Glue 4.0+), a broadcast hint above the 10 MB threshold, separate handling of null keys, and salting with two-stage aggregation for hot groupBy keys.

Frequently asked questions

What is the difference between AWS Glue Data Quality and AWS Glue DataBrew for quality checks?

Glue Data Quality is rule-engine-first: you write DQDL rulesets (or start from recommended rules) and evaluate them against Data Catalog tables or inside Glue ETL jobs, where row-level results let you quarantine failing rows — built for automated pipeline gates. DataBrew is visual-first: profile jobs compute per-column statistics and validate DataBrew rulesets, and recipes clean the data — built for analysts and data stewards. Pipelines gate with Glue Data Quality; people explore and clean with DataBrew.

What is DQDL and what do its rules look like?

DQDL is the Data Quality Definition Language, the declarative syntax AWS Glue Data Quality uses for rulesets. Rules read like assertions: IsComplete "customer_id" requires no nulls, IsPrimaryKey "order_id" requires complete and unique values, ColumnValues "age" between 0 and 120 bounds a range, ColumnValues "status" in [...] with threshold > 0.98 tolerates a few exceptions, RowCount > avg(last(10)) * 0.8 compares volume with recent runs, and DataFreshness "order_date" <= 24 hours checks timeliness. An evaluation reports per-rule pass or fail plus an overall score.

Why does a blank CSV field pass IsComplete in AWS Glue Data Quality?

IsComplete and Completeness count only null values. When a CSV file is read into a String column, a blank field becomes an empty string, which is not null, so it passes. To reject blanks, add a rule such as ColumnValues "name" not in [NULL, EMPTY, WHITESPACES_ONLY], which treats nulls, empty strings and whitespace-only strings as failures.

How do I quarantine bad rows with the Glue Evaluate Data Quality transform?

Output the original data with row-level results, which adds DataQualityRulesPass, DataQualityRulesFail, DataQualityRulesSkip and DataQualityEvaluationResult columns to each row. Route on DataQualityEvaluationResult (for example with a Conditional Router) so passed rows go to the target and failed rows to a quarantine location. Leave On ruleset failure at None so the run continues. Dataset-level rules such as RowCount are skipped per row and cannot quarantine anything.

How do I get alerted when a Glue Data Quality check fails?

Keep "Publish metrics to Amazon CloudWatch" selected, then either create an EventBridge rule for source aws.glue-dataquality, detail-type "Data Quality Evaluation Results Available" and state FAILED, targeting an SNS topic, or alarm on the glue.data.quality.rules.failed metric. Do not rely on Glue job failure events: with the default On ruleset failure setting of None, the job succeeds even when rules fail.

When should I use stratified sampling instead of random sampling?

Use stratified sampling when the dataset contains small subgroups that must be represented — rare event types, minority customer segments, low-volume regions. Pure random sampling can miss them entirely. Stratifying divides the data into groups and samples each one, often oversampling the small groups, guaranteeing coverage. If no such segments matter, random sampling is simpler and unbiased overall.

How do I recognize and fix data skew in a Glue or EMR Spark job?

Recognize it by stragglers: most tasks in a stage finish quickly while one runs far longer or fails with an executor out-of-memory error, visible in the Spark UI. Raising shuffle partitions does not help because one key always goes to one task. For skewed joins rely on Adaptive Query Execution (on by default in Glue 4.0 and later), broadcast a small side (with a hint above the 10 MB auto-broadcast threshold), and handle null keys separately. For a hot key in per-group work that cannot be partially aggregated, salt the key and aggregate in two stages.

Can I rely on a DataBrew session or a sampled profile to confirm a dataset is clean?

No. DataBrew projects work on at most 5,000 sampled rows and profile jobs read 20,000 rows by default, so rare defects such as a few duplicates in millions of rows can be invisible. A duplicate only shows if both copies are sampled. Run a full-dataset profile, and evaluate gate rules such as uniqueness against the full data, for example with Glue Data Quality inside the production job. Samples estimate quality; they cannot certify it.

Source

This lesson covers the "Data Operations and Support" domain of the official DEA-C01 exam guide. Vendors revise their guides — check the source for the current version.

Test yourself on this topic
Practice now

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?