You can use following hudi options when you write:
hudi_options = {
"hoodie.table.name": "<YOUR TABLE NAME>",
"hoodie.datasource.write.table.type": "MERGE_ON_READ",
"hoodie.datasource.write.recordkey.field": "<YOUR UNIQUE KEY>",
"hoodie.datasource.write.precombine.field": "<YOUR PRECOMBINE FIELD>",
"hoodie.datasource.write.hive_style_partitioning": "true",
"hoodie.index.type": "BLOOM",
"hoodie.bloom.index.filter.type": "DYNAMIC_V0",
"hoodie.compact.inline": "true",
"hoodie.compact.inline.max.delta.commits": 10 <YOU CAN PROVIDE SEP VAL BASED ON YOUR NEED>
}
inputDF.write.format('org.apache.hudi').option('hoodie.datasource.write.operation', 'upsert').options(**hudi_options).mode('append').save('<YOUR OUTPUTPATH>')
hoodie.compact.inline and 'hoodie.compact.inline.max.delta.commits' helps hudi to perform the merge. Once the value mentioned in the hoodie.compact.inline.max.delta.commits reaches hudi performs merge operation
Please let me know if it helps.