cbg-wx opened a new issue, #18330:
URL: https://github.com/apache/hudi/issues/18330

   ### Bug Description
   
   **What happened:**
   when I use spark create a hudi table, When I performing a second delete 
operation on an empty Hudi table,A HoodieIOException was encountered,then I 
turn off the empty to resolve this problem,but hive sync empty table 
HoodieMetaSyncException appear.
   **What you expected:**
   
   delete empty & hive sync empty table successful
   
   **Steps to reproduce:**
   1.use sparksql create a hudi table
   
   ```sql
   CREATE TABLE hudi_table (
       ts BIGINT,
       id BIGINT,
       rider STRING,
       driver STRING,
       fare DOUBLE,
       city STRING
   ) USING HUDI
   PARTITIONED BY (city);
   ```
   
   2.use sparksql delete from above empty table(HoodieIOException:Latest commit 
does not have any schema in commit metadata)
   
   ```sql
   delete from hudi_table where id = 1;
   delete from hudi_table where id = 2;
   ```
   
   3.turn off empty commit before delete(resolve delete exception,but caused 
HoodieMetaSyncException)
   
   ```sql
   set hoodie.allow.empty.commit=false;
   ```
   
   
   ### Environment
   
   Hudi version: hudi-0.14.1
   Sink engine: spark-3.4.2
   Relevant configs: hive sync strategy RT
   
   ### Logs and Stack Trace
   
   2.When performing a second delete operation on an empty Hudi table, the 
following exception occurs:
   
   ```java
   Exception in thread "main" 
org.apache.hudi.exception.HoodieIOException:Latest commit does not have any 
schema in commit metadata
       at 
org.apache.hudi.client.BaseHoodieWriteClient.setWriteSchemaForDeletes(BaseHoodieWriteClient.java:1342)
       at 
org.apache.hudi.client.BaseHoodieWriteClient.initTable(BaseHoodieWriteClient.java:1294)
   ```
   
   3.When turn off the empty commit(set hoodie.allow.empty.commit=false;):
   
   ```
   Exception in thread "main" 
org.apache.hudi.exception.HoodieMetaSyncException:Could not sync using the meta 
sync class org.apache.hudi.hive.HiveSyncTool
       at 
org.apache.hudi.sync.common.util.SyncHelpers.runHoodieSync(SyncHelpers.java:81)
       ...
   Caused by: org.apache.hudi.exception.HodoieException:Got runtime execption 
when hive syncing hudi_table
       at 
org.apache.hudi.sync.hive.HoodieSyncTool.syncHoodieTable(HoodieSyncTool.java:171)
       ...
   Caused by: java.lang.IllegalArgumentException:-1
        at java.util.stream.ReferencePipline.skip(ReferencePipline.java: 474) 
       at  
org.apache.hudi.hive.HoodieHiveSyncClient.updateLastCommitTimeSynClient(updateLastCommitTimeSynClient.java:360)
   ```


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