Zouxxyy commented on code in PR #5023:
URL: https://github.com/apache/paimon/pull/5023#discussion_r1945877191


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/PaimonSparkWriter.scala:
##########
@@ -66,12 +67,30 @@ case class PaimonSparkWriter(table: FileStoreTable) {
     val sparkSession = data.sparkSession
     import sparkSession.implicits._
 
+    var defaultValueData: DataFrame = data // 初始时直接将 data 赋值给 defaultValueData
+
+    // 1. init defaultValueAssigner
+    val defaultValueAssigner = DefaultValueAssigner.create(tableSchema)
+
+    // 2. judge need assign default value
+    if (defaultValueAssigner.needToAssign()) {
+      // 3. set default value for null
+      defaultValueAssigner.getDefaultValues.forEach(
+        (fieldName, defaultValue) => {
+          // 使用 isNull 来检查是否为 null 值

Review Comment:
   Please do not use Chinese



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