You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "Aiden-Dong (via GitHub)" <gi...@apache.org> on 2025/07/22 06:32:22 UTC
[PR] [spark] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Aiden-Dong opened a new pull request, #5933:
URL: https://github.com/apache/paimon/pull/5933
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: https://github.com/apache/paimon/issues/5932
<!-- What is the purpose of the change -->
fix bug with Spark 3.3 throws write exceptions during partial-update engine operations
```
CREATE TABLE T(
f1 int,
f2 string,
f3 string,
f4 string)
TBLPROPERTIES (
'bucket'='1',
'primary-key'='f1',
'write-only'='true',
'merge-engine'='partial-update',
'file.format'='parquet',
'file.compression' = 'zstd'
)
```
```
INSERT INTO T(f1, f4) VALUES(1, 'test')
```
### Tests
```
spark.sql(
"CREATE TABLE T( f1 int, f2 string, f3 string, f4 string)\n" +
"TBLPROPERTIES (\n" + " 'bucket'='1',\n" +
" 'primary-key'='f1',\n" +
" 'write-only'='true',\n" +
" 'merge-engine'='partial-update',\n" + "" +
" 'file.format'='parquet',\n" +
" 'file.compression' = 'zstd'\n" + ")")
spark.sql("INSERT INTO T(f1, f4) VALUES(1, 'test')")
checkAnswer(
spark.sql("SELECT * FROM T"),
Row(1, null, null, "test")
)
```
### 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] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi closed pull request #5933: [spark] Spark 3.3 throws write exceptions during partial-update engine operations
URL: https://github.com/apache/paimon/pull/5933
--
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] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Posted by "cxzl25 (via GitHub)" <gi...@apache.org>.
cxzl25 commented on code in PR #5933:
URL: https://github.com/apache/paimon/pull/5933#discussion_r2253945342
##########
paimon-spark/paimon-spark-3.3/src/main/scala/org/apache/paimon/spark/catalyst/analysis/Spark3ResolutionRules.scala:
##########
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.spark.catalyst.analysis
+
+import org.apache.paimon.CoreOptions
+import org.apache.paimon.CoreOptions.MergeEngine
+import org.apache.paimon.spark.SparkTable
+import org.apache.paimon.spark.catalyst.Compatibility
+import org.apache.paimon.spark.commands.{PaimonShowTablePartitionCommand, PaimonShowTablesExtendedCommand}
+
+import org.apache.spark.sql.SparkSession
+import org.apache.spark.sql.catalyst.SQLConfHelper
+import org.apache.spark.sql.catalyst.analysis.{NamedRelation, PartitionSpec, ResolvedNamespace, UnresolvedPartitionSpec}
+import org.apache.spark.sql.catalyst.expressions.{Alias, ArrayTransform, Attribute, CreateStruct, Expression, GetArrayItem, GetStructField, If, IsNull, LambdaFunction, Literal, NamedExpression, NamedLambdaVariable}
+import org.apache.spark.sql.catalyst.plans.logical.{InsertIntoStatement, LogicalPlan, Project, ShowTableExtended}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.catalyst.util.CharVarcharUtils
+import org.apache.spark.sql.connector.catalog.Identifier
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
+import org.apache.spark.sql.types.{ArrayType, DataType, IntegerType, Metadata, StructField, StructType}
+
+import scala.collection.JavaConverters._
+import scala.collection.mutable
+
+case class Spark3ResolutionRules(session: SparkSession)
+ extends Rule[LogicalPlan]
+ with SQLConfHelper {
+
+ import org.apache.spark.sql.connector.catalog.PaimonCatalogImplicits._
+
+ override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsDown {
+ case ShowTableExtended(
+ ResolvedNamespace(catalog, ns),
+ pattern,
+ partitionSpec @ (None | Some(UnresolvedPartitionSpec(_, _))),
+ output) =>
+ partitionSpec
+ .map {
+ spec: PartitionSpec =>
+ val table = Identifier.of(ns.toArray, pattern)
+ val resolvedSpec =
+ PaimonResolvePartitionSpec.resolve(catalog.asTableCatalog, table, spec)
+ PaimonShowTablePartitionCommand(output, catalog.asTableCatalog, table, resolvedSpec)
+ }
+ .getOrElse {
+ PaimonShowTablesExtendedCommand(catalog.asTableCatalog, ns, pattern, output)
+ }
+
+ case insertPlan @ InsertIntoStatement(
Review Comment:
Interesting function, so that we don't need a higher version of Spark and we can only specify some columns to update.
---
[SPARK-38795][SQL] Support INSERT INTO user specified column lists with DEFAULT values
https://issues.apache.org/jira/browse/SPARK-38795
--
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] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Posted by "Aiden-Dong (via GitHub)" <gi...@apache.org>.
Aiden-Dong closed pull request #5933: [spark] Spark 3.3 throws write exceptions during partial-update engine operations
URL: https://github.com/apache/paimon/pull/5933
--
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] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi closed pull request #5933: [spark] Spark 3.3 throws write exceptions during partial-update engine operations
URL: https://github.com/apache/paimon/pull/5933
--
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] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Posted by "Aiden-Dong (via GitHub)" <gi...@apache.org>.
Aiden-Dong commented on PR #5933:
URL: https://github.com/apache/paimon/pull/5933#issuecomment-3203904833
> Hi @Aiden-Dong , I ran this test in current master, works fine. Can you just add this test?
Hi, to confirm - this partial column update test works fine for you on master/spark-3.3? I encountered issues with it on master recently, so just double-checking before I add the test.
--
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] Spark 3.3 throws write exceptions during partial-update engine operations [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #5933:
URL: https://github.com/apache/paimon/pull/5933#issuecomment-3199251338
Hi @Aiden-Dong , I ran this test in current master, works fine. Can you just add this test?
--
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