rangareddy commented on issue #13573:
URL: https://github.com/apache/hudi/issues/13573#issuecomment-3088214605

   Hi @Maplejw,
   
   I successfully replicated the issue you reported using the shared code. To 
resolve it, please set the **hoodie.spark.sql.insert.into.operation** value to 
**upsert**.
   
   **Note:** If a precombine field is not set, "insert" is chosen as the 
default. For a table with preCombine field set, "upsert" is chosen as the 
default operation.
   
   **Example code:**
   
   ```
   SET hoodie.spark.sql.insert.into.operation=upsert;
   
   CREATE TABLE hudi_table3 (
     ts BIGINT,
     uuid STRING,
     rider STRING,
     driver STRING,
     fare DOUBLE,
     city STRING
   ) USING HUDI
   LOCATION 's3a://warehouse/hudi_table3'
   TBLPROPERTIES (
     primaryKey = 'uuid', 
     hoodie.record.merge.mode='COMMIT_TIME_ORDERING'
   );
   
   INSERT INTO hudi_table3
   VALUES
   
(3,'334e26e9-8355-45cc-97c6-c31daf0df330','rider-A','driver-K',19.10,'san_francisco'),
   (2,'334e26e9-8355-45cc-97c6-c31daf0df330','rider-C','driver-M',27.70 
,'san_francisco');
   
   select * from hudi_table3;
   _hoodie_commit_time  _hoodie_commit_seqno    _hoodie_record_key      
_hoodie_partition_path  _hoodie_file_name       ts      uuid    rider   driver  
fare    city
   20250718080023731    20250718080023731_0_0   
334e26e9-8355-45cc-97c6-c31daf0df330            
ea109803-02e0-4b31-8313-6e811de7a369-0_0-144-238_20250718080023731.parquet      
2       334e26e9-8355-45cc-97c6-c31daf0df330    rider-C driver-M        27.7    
san_francisco
   ```
   
   **References:**
   
   * https://hudi.apache.org/blog/2025/03/03/record-mergers-in-hudi/
   * https://hudi.apache.org/docs/sql_dml/


-- 
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