Configure a Hudi Copy-on-Write table and perform an upsert using record key and precombine field

domain: hudi.apache.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add the Hudi Spark bundle JAR to your Spark session and configure: spark.serializer=org.apache.spark.serializer.KryoSerializer and spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension.
  2. Write a DataFrame to a new CoW table: df.write.format('hudi').option('hoodie.table.name', 'events').option('hoodie.datasource.write.recordkey.field', 'id').option('hoodie.datasource.write.precombine.field', 'updated_at').option('hoodie.datasource.write.operation', 'upsert').mode('append').save('/path/to/hudi/events').
  3. On subsequent writes, use the same upsert operation; Hudi deduplicates by record key, keeping the record with the highest precombine field value when duplicates exist in the incoming batch.
  4. Verify the table was created with the correct key configuration by reading back: spark.read.format('hudi').load('/path/to/hudi/events').show().
  5. Inspect the Hudi timeline with spark.read.format('hudi').load('/path/to/hudi/events').select('_hoodie_commit_time', '_hoodie_record_key').show() to confirm the metadata fields are present.

Known gotchas

Related routes

Configure a Hudi Record-Level Index (RLI) to accelerate upsert lookup performance on large tables
hudi.apache.org · 5 steps · unrated
Configure a Hudi Merge-on-Read table and understand the read path differences from Copy-on-Write
hudi.apache.org · 5 steps · unrated
Configure Apache Hudi COW table, perform upserts, and understand file layout
hudi.apache.org · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans