xiarixiaoyao opened a new pull request #3182:
URL: https://github.com/apache/hudi/pull/3182


   ## *Tips*
   - *Thank you very much for contributing to Apache Hudi.*
   - *Please review https://hudi.apache.org/contributing.html before opening a 
pull request.*
   
   ## What is the purpose of the pull request
   
   fix the bug that metatable cannot support non_partition table
   
   now, we found that when we enable metable for non_partition hudi table,  the 
follow  error occur:
   org.apache.hudi.exception.HoodieMetadataException: Error syncing to metadata 
table.org.apache.hudi.exception.HoodieMetadataException: Error syncing to 
metadata table.
   at 
org.apache.hudi.client.SparkRDDWriteClient.syncTableMetadata(SparkRDDWriteClient.java:447)
 at 
org.apache.hudi.client.AbstractHoodieWriteClient.postCommit(AbstractHoodieWriteClient.java:433)
 at 
org.apache.hudi.client.AbstractHoodieWriteClient.commitStats(AbstractHoodieWriteClient.java:187)
   
   test step
   
       val df = spark.range(0, 1000).toDF("keyid")
         .withColumn("col3", expr("keyid"))
   
       df.write.format("hudi").
         option(DataSourceWriteOptions.TABLE_TYPE_OPT_KEY, 
DataSourceWriteOptions.MOR_TABLE_TYPE_OPT_VAL).
         option(DataSourceWriteOptions.PRECOMBINE_FIELD_OPT_KEY, "col3").
         option(DataSourceWriteOptions.RECORDKEY_FIELD_OPT_KEY, "keyid").
         option(DataSourceWriteOptions.PARTITIONPATH_FIELD_OPT_KEY, "").
         option(DataSourceWriteOptions.KEYGENERATOR_CLASS_OPT_KEY, 
"org.apache.hudi.keygen.NonpartitionedKeyGenerator").
         option(DataSourceWriteOptions.OPERATION_OPT_KEY, "insert").
         option("hoodie.insert.shuffle.parallelism", "4").
         option("hoodie.metadata.enable", "true").
         option(HoodieWriteConfig.TABLE_NAME, "hoodie_test")
         .mode(SaveMode.Overwrite).save(basePath)
   
       // upsert same record again
       df.write.format("hudi").
         option(DataSourceWriteOptions.TABLE_TYPE_OPT_KEY, 
DataSourceWriteOptions.MOR_TABLE_TYPE_OPT_VAL).
         option(DataSourceWriteOptions.PRECOMBINE_FIELD_OPT_KEY, "col3").
         option(DataSourceWriteOptions.RECORDKEY_FIELD_OPT_KEY, "keyid").
         option(DataSourceWriteOptions.PARTITIONPATH_FIELD_OPT_KEY, "").
         option(DataSourceWriteOptions.KEYGENERATOR_CLASS_OPT_KEY, 
"org.apache.hudi.keygen.NonpartitionedKeyGenerator").
         option(DataSourceWriteOptions.OPERATION_OPT_KEY, "upsert").
         option("hoodie.insert.shuffle.parallelism", "4").
         option("hoodie.metadata.enable", "true").
         option(HoodieWriteConfig.TABLE_NAME, "hoodie_test")
         .mode(SaveMode.Append).save(basePath)
   
   org.apache.hudi.exception.HoodieMetadataException: Error syncing to metadata 
table.org.apache.hudi.exception.HoodieMetadataException: Error syncing to 
metadata table.
   at 
org.apache.hudi.client.SparkRDDWriteClient.syncTableMetadata(SparkRDDWriteClient.java:447)
 at 
org.apache.hudi.client.AbstractHoodieWriteClient.postCommit(AbstractHoodieWriteClient.java:433)
 at 
org.apache.hudi.client.AbstractHoodieWriteClient.commitStats(AbstractHoodieWriteClient.java:187)
 at 
org.apache.hudi.client.SparkRDDWriteClient.commit(SparkRDDWriteClient.java:121) 
at 
org.apache.hudi.HoodieSparkSqlWriter$.commitAndPerformPostOperations(HoodieSparkSqlWriter.scala:564)
 at org.apache.hudi.HoodieSparkSqlWriter$.write(HoodieSparkSqlWriter.scala:230) 
at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:162) at 
org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:45)
 at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
 at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
 at org.apache.spark.sql.execution.command.Ex
 ecutedCommandExec.doExecute(commands.scala:86) at 
org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:131)
 at 
org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:127)
   
   
   
   ## Brief change log
   
   
   ## Verify this pull request
   new UT added
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under 
an umbrella JIRA.


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