Zouxxyy commented on code in PR #5059:
URL: https://github.com/apache/paimon/pull/5059#discussion_r1951917067
##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/WriteIntoPaimonTable.scala:
##########
@@ -49,10 +51,25 @@ case class WriteIntoPaimonTable(
private lazy val mergeSchema =
options.get(SparkConnectorOptions.MERGE_SCHEMA)
override def run(sparkSession: SparkSession): Seq[Row] = {
+ var data = _data
if (mergeSchema) {
val dataSchema = SparkSystemColumns.filterSparkSystemColumns(data.schema)
val allowExplicitCast = options.get(SparkConnectorOptions.EXPLICIT_CAST)
mergeAndCommitSchema(dataSchema, allowExplicitCast)
+
+ // For case that some columns is absent in data, we still allow to write
once write.merge-schema is true.
+ val newTableSchema =
SparkTypeUtils.fromPaimonRowType(table.schema().logicalRowType())
+ if (!schemaEqualsIgnoreNullability(newTableSchema, data.schema)) {
Review Comment:
`dataSchema` is 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]