[ 
https://issues.apache.org/jira/browse/HUDI-9605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18008156#comment-18008156
 ] 

Y Ethan Guo commented on HUDI-9605:
-----------------------------------

The merge mode write configs, "hoodie.write.record.merge.mode", 
"hoodie.write.record.merge.strategy.id", should be used instead of the table 
configs when writing to the table, see 
https://hudi.apache.org/docs/record_merger#record-merge-configs

> Cannot use merge mode to create event time based table
> ------------------------------------------------------
>
>                 Key: HUDI-9605
>                 URL: https://issues.apache.org/jira/browse/HUDI-9605
>             Project: Apache Hudi
>          Issue Type: Bug
>            Reporter: Lin Liu
>            Priority: Major
>
> How to reproduce:
>  
> {code:java}
> export SPARK_VERSION=3.5
> spark-shell --packages 
> org.apache.hudi:hudi-spark$SPARK_VERSION-bundle_2.12:1.0.2 \
> --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer' \
> --conf 
> 'spark.sql.catalog.spark_catalog=org.apache.spark.sql.hudi.catalog.HoodieCatalog'
>  \
> --conf 
> 'spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension' \
> --conf 
> 'spark.kryo.registrator=org.apache.spark.HoodieSparkKryoRegistrar'import 
> scala.collection.JavaConversions._
> import org.apache.spark.sql.SaveMode._
> import org.apache.hudi.DataSourceReadOptions._
> import org.apache.hudi.DataSourceWriteOptions._
> import org.apache.hudi.common.table.HoodieTableConfig._
> import org.apache.hudi.config.HoodieWriteConfig._
> import org.apache.hudi.keygen.constant.KeyGeneratorOptions._
> import org.apache.hudi.common.model.HoodieRecord
> import spark.implicits._val tableName = "trips_table"
> val basePath = "file:///tmp/trips_table112"val columns = 
> Seq("ts","uuid","rider","driver","fare","city")
> val data =
>   
> Seq((1695159649087L,"334e26e9-8355-45cc-97c6-c31daf0df330","rider-A","driver-K",19.10,"san_francisco"),
>     
> (1695091554788L,"e96c4396-3fad-413a-a942-4cb36106d721","rider-C","driver-M",27.70
>  ,"san_francisco"),
>     
> (1695046462179L,"9909a8b1-2d15-4d3d-8ec9-efc48c536a00","rider-D","driver-L",33.90
>  ,"san_francisco"),
>     
> (1695516137016L,"e3cf430c-889d-4015-bc98-59bdce1e530c","rider-F","driver-P",34.15,"sao_paulo"
>     ),
>     
> (1695115999911L,"c8abbe79-8d89-47ea-b4ce-4d224bae5bfa","rider-J","driver-T",17.85,"chennai"));var
>  inserts = spark.createDataFrame(data).toDF(columns:_*)
> inserts.write.format("hudi").
>   option("hoodie.datasource.write.partitionpath.field", "city").
>   option("hoodie.table.name", tableName).
>   option("hoodie.table.precombine.field", "ts").
>   option("hoodie.record.merge.strategy.id", 
> "eeb8d96f-b1e4-49fd-bbf8-28ac514178e5").
>   option("hoodie.record.merge.mode", "EVENT_TIME_ORDERING")
>   mode(Overwrite).
>   save(basePath) {code}
> {code:java}
> #Updated at 2025-07-18T20:13:53.267Z
> #Fri Jul 18 13:13:53 PDT 2025
> hoodie.table.timeline.timezone=LOCAL
> hoodie.table.version=8
> hoodie.table.index.defs.path=.hoodie/.index_defs/index.json
> hoodie.table.initial.version=8
> hoodie.datasource.write.hive_style_partitioning=false
> hoodie.table.metadata.partitions.inflight=
> hoodie.table.checksum=2052134141
> hoodie.table.keygenerator.type=SIMPLE
> hoodie.partition.metafile.use.base.format=false
> hoodie.table.cdc.enabled=false
> hoodie.archivelog.folder=history
> hoodie.table.name=trips_table
> hoodie.record.merge.strategy.id=ce9acb64-bde0-424c-9b91-f6ebba25356d
> hoodie.timeline.history.path=history
> hoodie.compaction.payload.class=org.apache.hudi.common.model.OverwriteWithLatestAvroPayload
> hoodie.populate.meta.fields=true
> hoodie.table.type=COPY_ON_WRITE
> hoodie.datasource.write.partitionpath.urlencode=false
> hoodie.table.base.file.format=PARQUET
> hoodie.datasource.write.drop.partition.columns=false
> hoodie.table.metadata.partitions=column_stats,files,partition_stats
> hoodie.timeline.layout.version=2
> hoodie.record.merge.mode=COMMIT_TIME_ORDERING
> hoodie.table.multiple.base.file.formats.enable=false
> hoodie.table.partition.fields=city
> hoodie.timeline.path=timeline
> ~ {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to