alberttwong commented on issue #10696:
URL: https://github.com/apache/hudi/issues/10696#issuecomment-1951769685

   It looks like ts is the default for precombine.  You have to define 
PRECOMBINE_FIELD_OPT_KEY
   
   ```
   import org.apache.spark.sql.functions._
   import org.apache.spark.sql.types._
   import org.apache.spark.sql.Row
   import org.apache.spark.sql.SaveMode._
   import org.apache.hudi.DataSourceReadOptions._
   import org.apache.hudi.DataSourceWriteOptions._
   import org.apache.hudi.config.HoodieWriteConfig._
   import scala.collection.JavaConversions._
   
   val df = spark.read.parquet("s3://huditest/green_tripdata_2023-01.parquet")
   
   val databaseName = "hudi_sample"
   val tableName = "hudi_coders_hive"
   val basePath = "s3a://huditest/hudi_coders"
   
   df.write.format("hudi").
     option(org.apache.hudi.config.HoodieWriteConfig.TABLE_NAME, tableName).
     option(RECORDKEY_FIELD_OPT_KEY, "lpep_pickup_datetime").
     option(PRECOMBINE_FIELD_OPT_KEY, "lpep_pickup_datetime").
     option("hoodie.datasource.hive_sync.enable", "true").
     option("hoodie.datasource.hive_sync.mode", "hms").
     option("hoodie.datasource.hive_sync.database", databaseName).
     option("hoodie.datasource.hive_sync.table", tableName).
     option("hoodie.datasource.hive_sync.metastore.uris", 
"thrift://hive-metastore:9083").
     option("fs.defaultFS", "s3://huditest/").
     mode(Overwrite).
     save(basePath)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to