You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "Aitozi (via GitHub)" <gi...@apache.org> on 2024/10/22 10:15:36 UTC

[PR] [spark] support to mark done for spark writer [paimon]

Aitozi opened a new pull request, #4363:
URL: https://github.com/apache/paimon/pull/4363

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #4361 4361
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [spark] support to mark done for spark writer [paimon]

Posted by "Aitozi (via GitHub)" <gi...@apache.org>.
Aitozi commented on code in PR #4363:
URL: https://github.com/apache/paimon/pull/4363#discussion_r1810591381


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/WriteIntoPaimonTable.scala:
##########
@@ -63,9 +67,28 @@ case class WriteIntoPaimonTable(
     val commitMessages = writer.write(data)
     writer.commit(commitMessages)
 
+    markDone(commitMessages)
     Seq.empty
   }
 
+  private def markDone(commitMessages: Seq[CommitMessage]): Unit = {

Review Comment:
   done



##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/WriteIntoPaimonTable.scala:
##########
@@ -63,9 +67,28 @@ case class WriteIntoPaimonTable(
     val commitMessages = writer.write(data)
     writer.commit(commitMessages)
 
+    markDone(commitMessages)
     Seq.empty
   }
 
+  private def markDone(commitMessages: Seq[CommitMessage]): Unit = {
+    val coreOptions = table.coreOptions()
+    if (coreOptions.toConfiguration.get(CoreOptions.PARTITION_MARK_DONE_WHEN_END_INPUT)) {
+      val actions = PartitionMarkDoneAction.createActions(originTable, table.coreOptions())
+      val partitionComputer = new InternalRowPartitionComputer(
+        coreOptions.partitionDefaultName,
+        TypeUtils.project(table.rowType(), table.partitionKeys()),
+        table.partitionKeys().asScala.toArray
+      )
+      val partitions = commitMessages
+        .map(c => c.partition())
+        .map(p => PartitionPathUtils.generatePartitionPath(partitionComputer.generatePartValues(p)))
+      for (elem <- partitions) {

Review Comment:
   done
   



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [spark] support to mark done for spark writer [paimon]

Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on code in PR #4363:
URL: https://github.com/apache/paimon/pull/4363#discussion_r1810583298


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/WriteIntoPaimonTable.scala:
##########
@@ -63,9 +67,28 @@ case class WriteIntoPaimonTable(
     val commitMessages = writer.write(data)
     writer.commit(commitMessages)
 
+    markDone(commitMessages)
     Seq.empty
   }
 
+  private def markDone(commitMessages: Seq[CommitMessage]): Unit = {

Review Comment:
   markPartitionDoneIfNeeded



##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/WriteIntoPaimonTable.scala:
##########
@@ -63,9 +67,28 @@ case class WriteIntoPaimonTable(
     val commitMessages = writer.write(data)
     writer.commit(commitMessages)
 
+    markDone(commitMessages)
     Seq.empty
   }
 
+  private def markDone(commitMessages: Seq[CommitMessage]): Unit = {
+    val coreOptions = table.coreOptions()
+    if (coreOptions.toConfiguration.get(CoreOptions.PARTITION_MARK_DONE_WHEN_END_INPUT)) {
+      val actions = PartitionMarkDoneAction.createActions(originTable, table.coreOptions())
+      val partitionComputer = new InternalRowPartitionComputer(
+        coreOptions.partitionDefaultName,
+        TypeUtils.project(table.rowType(), table.partitionKeys()),
+        table.partitionKeys().asScala.toArray
+      )
+      val partitions = commitMessages
+        .map(c => c.partition())
+        .map(p => PartitionPathUtils.generatePartitionPath(partitionComputer.generatePartValues(p)))
+      for (elem <- partitions) {

Review Comment:
   elem -> partition



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [spark] support to mark done for spark writer [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #4363:
URL: https://github.com/apache/paimon/pull/4363


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org