KnightChess commented on code in PR #8967:
URL: https://github.com/apache/hudi/pull/8967#discussion_r1229633398


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -1248,8 +1247,7 @@ protected void 
setWriteSchemaForDeletes(HoodieTableMetaClient metaClient) {
       if (lastInstant.isPresent()) {
         HoodieCommitMetadata commitMetadata = HoodieCommitMetadata.fromBytes(
             activeTimeline.getInstantDetails(lastInstant.get()).get(), 
HoodieCommitMetadata.class);
-        String extraSchema = commitMetadata.getExtraMetadata().get(SCHEMA_KEY);
-        if (!StringUtils.isNullOrEmpty(extraSchema)) {
+        if (commitMetadata.getExtraMetadata().containsKey(SCHEMA_KEY)) {

Review Comment:
   this will cause other issue, you can check the relevant unit test based on 
git history



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestDeleteFromTable.scala:
##########
@@ -80,4 +82,36 @@ class TestDeleteFromTable extends HoodieSparkSqlTestBase {
       }
     })
   }
+
+  test("Test deleting from empty table") {
+    withRecordType()(withTempDir { tmp =>
+      Seq("cow", "mor").foreach { tableType =>
+        val tableName = generateTableName
+        spark.sql(
+          s"""
+             |CREATE TABLE $tableName (
+             |  id int,
+             |  dt string,
+             |  name string,
+             |  price double,
+             |  ts long
+             |) USING hudi
+             | tblproperties (
+             |    primaryKey = 'id',
+             |    tableType = '$tableType'
+             | )
+             | PARTITIONED BY (dt)
+             | LOCATION '${tmp.getCanonicalPath}'
+         """.stripMargin)
+
+
+        // Delete single row
+        spark.sql(s"DELETE FROM $tableName WHERE id = 1")

Review Comment:
   What I think should be fixed is why does this op can not create a instance 
file with schema. I think fix it will better



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