A while back I wrote about a service that handles deletion requests for a large data lake, and how we kept a MySQL table from falling over under the weight of its own status updates. I left one thread deliberately unplugged at the end of that piece: how do you actually delete a record from a Hive table when the underlying files are plain Parquet or JSON, formats with no Delete DML to lean on? That's the question I want to answer here.

The problem underneath the problem

This isn't specific to Hive or Parquet. It applies to any storage format that doesn't support row-level DELETE natively, whatever that format happens to be in your environment. Parquet on Hive is simply the concrete case I'm going to walk through, because it's the one we actually run, and it's still extremely common. Delta and Iceberg solve this problem at the table-format level for anyone already on them, but most data lakes that have grown organically over years are sitting on something older: plain Parquet or JSON files in S3, organized into Hive partitions, with no transaction log and no built-in concept of deleting a row. A file is a file. If a record in it needs to go, something has to produce a new file without that record and make it take the old one's place.

The naive version of this is to rewrite the whole partition, or worse, the whole table, every time a deletion needs to happen. That works, technically, but it means touching enormous amounts of data you never needed to touch just to remove a handful of rows, and doing it on a timeline that doesn't scale as the volume of deletion requests grows. The real problem isn't deleting a row. It's deleting a row without turning every request into a full-table rewrite.

It's worth being upfront about where this sits relative to Delta and Iceberg, since that's the first thing anyone on those formats will ask. InMobi's engineering team wrote a good piece on this which covers the same underlying problem on plain Parquet, and lands on the same conclusion most writing on this topic does: move to a format with native delete support. That's sound advice, and if you're starting fresh or dealing with a handful of tables, it's probably the right call.

It stops being the right call, the moment "move to Delta" means migrating thousands of tables owned by dozens of different teams across a large organization. That's not a setting you flip, it's a coordination problem: every team has to schedule the work, validate that downstream consumers still function against the new format, and prioritize it against everything else on their roadmap.

For a data lake with tens of thousands of existing assets, that migration is realistically a multi-year effort, and deletion requests don't pause for multi-year efforts. What follows is what we built for the tables that are in neither format today, and have no realistic path to being migrated any time soon.

There's also a second, more technical reason the deletion-vector approach isn't a full substitute even once you are migrated: a deletion vector only marks a row as deleted, the physical bytes stay in the old file until a separate compaction step runs later, which means the data isn't actually gone the moment the deletion request completes. For a regulatory deletion obligation, that gap matters on its own, independent of the migration question.

What we actually need before any deletion can happen

Before a table can have anything deleted from it, the team that owns it has to onboard it, and onboarding means answering two questions.

First, which column in this table maps to an index we can search by? A request comes in as something like a customer ID, and the table might store that same value under a completely different column name, customer_account_id instead of customerId, say. Every onboarded table declares that mapping up front, against a known list of valid index types we support.

Second, is the table append-only? Some tables are classic mutable datasets where existing rows can be updated or removed. Others are immutable by design, think hourly partitions of streamed event data that are written once and never touched again after that. This distinction matters enormously for how we go about finding what to delete, which is the next problem.

Finding the right files without scanning everything, every time

Parquet has no index. There's no structure telling you "the row with customerId X lives in file Y." For a mutable table, we still have to scan, there's no way around that, but we scan smart: using input_file_name(), we identify exactly which physical files within the table actually contain a matching record, rather than assuming we need to touch every file in every partition.

Immutable tables get a different treatment, because scanning the same ever-growing pile of historical partitions every single week doesn't hold up over time. For these, we run a pre-processing step we call indexing: a separate, lightweight table that just maps index_column_value to partition. Instead of scanning the whole table on every deletion cycle, we check this small index table first, get back a short list of partitions that actually matter, and only look there.

The indexing job runs as a pre-step before every deletion cycle, so it's always catching the new partitions that have accumulated since the last run. The index stays current without ever needing a full historical re-scan.

The actual deletion: targeted, not wholesale

Once we know which files contain matching records, the deletion itself is narrow by design. For each affected file, we read it, filter out the rows that need to go, and write the result as a new file, abcd.parquet produces abcd_filtered.parquet. Once that filtered file is fully written, it takes over the original file's name and location, overwriting the S3 object the table actually reads from.

This is the part that makes the whole scheme safe to run without taking the table offline. An S3 object write is atomic. A reader querying the table mid-operation either sees the complete original file or the complete replacement, never anything in between. There's no partition-level lock, no window where a dashboard or another job sees a half-written or missing file. Other jobs and queries keep reading the table normally for the entire duration of the deletion run, because from their point of view, nothing is happening until the moment a file's contents change atomically underneath them.

For tables with a lot of partitions, we also parallelize the work itself. If a table has 220 partitions needing attention, we don't process them one at a time. We split the partition list into batches of fifty and run up to five parallel processes against them, four handling fifty partitions each and one picking up the remaining twenty. The targeted, file-level nature of the deletion is what makes this kind of parallel split straightforward: each batch only ever touches its own set of files, so there's no coordination needed between the parallel workers.

What happens when something goes wrong mid-run

A deletion job that touches hundreds of partitions across parallel workers is going to fail partway through sometimes, a worker crashes, a cluster gets preempted, whatever the reason. The failure mode here is about as gentle as it gets: since the original file is never touched until the filtered replacement is completely written and ready to swap in, a crash before that point leaves the original table exactly as it was. Nothing is lost, nothing is corrupted, nothing is half-deleted.

The one cleanup responsibility we do take seriously is the staging area. Every table or partition split being processed gets its own staging location for the filtered files it's producing, and a finally block guarantees that location gets cleaned up whether the run succeeds or fails. Without that, a crashed run would leave orphaned _filtered files sitting around in S3 indefinitely, harmless to the table itself, but a quiet, creeping mess that nobody notices until someone goes looking for why a staging bucket is larger than it should be.

Why this is worth the design effort

None of this complexity exists for its own sake. The alternative, rewriting entire partitions or whole tables on every deletion request, works at a small scale and becomes untenable at a large one. The targeted, file-level approach keeps the amount of data touched proportional to the amount of data actually changing, not to the size of the table it lives in. The indexing step for immutable tables exists for the same reason: avoiding a full historical scan every week is the difference between a deletion cycle that stays fast as the table grows, and one that gets slower every single week, forever.

The atomic swap and the finally-block cleanup are what let this run unattended, at scale, without anyone needing to watch it. Readers never see a bad state. A crash never corrupts anything. Those two guarantees are what actually make it possible to trust this as infrastructure other teams' compliance obligations depend on, not just a script that happens to work when nothing goes wrong.

One more thing worth naming directly: because the filtered file fully replaces the original in the same pass, the data is physically gone the moment a deletion run completes. There's no separate compaction or purge step waiting to happen later before the obligation is actually satisfied. For a regulatory deletion request, that's not a minor detail.

Closing

Deleting a single record from a table that was never designed to support deletion is a deceptively hard problem once you're operating at the scale of a real data lake, hundreds of partitions, formats with no native delete support, and tables that fall into genuinely different shapes depending on how they're written. The solution here isn't exotic, and it isn't a replacement for what Delta or Iceberg already do well if you're on them. It's what we built for the much larger set of tables that aren't, and won't be for a long time: know exactly which files are affected before touching anything, replace files atomically instead of in place, physically remove the data in the same pass rather than deferring it to a later compaction step, and make sure a crash leaves you with nothing worse than some cleanup work. If you've solved a similar problem on a different format or storage layer, I'd like to hear how the constraints changed your approach.