You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "kerwin-zk (via GitHub)" <gi...@apache.org> on 2026/03/25 02:16:36 UTC
[PR] [spark] Add OVERWRITE_BY_FILTER capabilities to PartitionedFormatTable for Spark 4 compatibility [paimon]
kerwin-zk opened a new pull request, #7517:
URL: https://github.com/apache/paimon/pull/7517
### Purpose
Spark 4 changed ReplaceTableAsSelect to use OverwriteByExpression instead of AppendData,
which requires TRUNCATE or OVERWRITE_BY_FILTER capability.
External format tables (with location) go through PartitionedCSVTable (Spark FileTable),
whose default capabilities {BATCH_READ, BATCH_WRITE} don't include OVERWRITE_BY_FILTER.
The fix adds OVERWRITE_BY_FILTER to PartitionedFormatTable trait.
### Tests
CI
--
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] Add OVERWRITE_BY_FILTER capabilities to PartitionedFormatTable for Spark 4 compatibility [paimon]
Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron merged PR #7517:
URL: https://github.com/apache/paimon/pull/7517
--
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] Add OVERWRITE_BY_FILTER capabilities to PartitionedFormatTable for Spark 4 compatibility [paimon]
Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron commented on code in PR #7517:
URL: https://github.com/apache/paimon/pull/7517#discussion_r2985390618
##########
paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/table/PaimonFormatTableTest.scala:
##########
@@ -367,6 +368,64 @@ class PaimonFormatTableTest extends PaimonSparkTestWithRestCatalogBase {
}
}
+ test("PartitionedFormatTable: external table saveAsTable overwrite should support truncate") {
+ val tableName = "paimon_format_external_overwrite_test"
+ withTable(tableName) {
+ val location = s"${tempDBDir.getCanonicalPath}/external_overwrite_test"
+
+ sql(s"""CREATE TABLE $tableName (a INT, b STRING, pt STRING)
+ |USING CSV PARTITIONED BY (pt) LOCATION '$location'
+ |""".stripMargin)
+
+ spark
+ .createDataFrame(Seq((1, "x1", "p1"), (2, "x2", "p2")))
+ .toDF("a", "b", "pt")
+ .write
+ .format("csv")
+ .mode("append")
+ .saveAsTable(tableName)
+ checkAnswer(
+ sql(s"SELECT a, b, pt FROM $tableName ORDER BY a"),
+ Seq(Row(1, "x1", "p1"), Row(2, "x2", "p2")))
+
+ spark
+ .createDataFrame(Seq((5, "x5", "p1")))
+ .toDF("a", "b", "pt")
+ .write
+ .format("csv")
+ .option("path", location)
+ .partitionBy("pt")
+ .mode("overwrite")
+ .saveAsTable(tableName)
+
+ checkAnswer(
+ sql(s"SELECT a, b, pt FROM $tableName ORDER BY a"),
+ Seq(Row(1, "x1", "p1"), Row(2, "x2", "p2"), Row(5, "x5", "p1")))
+ }
+ }
+
+ test("PartitionedFormatTable: external table capabilities include OVERWRITE_BY_FILTER") {
+
+ import org.apache.spark.sql.connector.catalog.TableCapability
+ val tableName = "paimon_format_capabilities_test"
+ withTable(tableName) {
+ val location = s"${tempDBDir.getCanonicalPath}/capabilities_test"
+ sql(s"""CREATE TABLE $tableName (a INT, b STRING)
+ |USING CSV LOCATION '$location'
+ |""".stripMargin)
+
+ val catalog = spark.sessionState.catalogManager.currentCatalog
+ .asInstanceOf[TableCatalog]
+ val table = catalog.loadTable(
+ org.apache.spark.sql.connector.catalog.Identifier.of(Array("test_db"), tableName))
+
+ val caps = table.capabilities()
+ assert(
Review Comment:
Is it possible to incorporate this part of the assertion into the previous UT?
--
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] Add OVERWRITE_BY_FILTER capabilities to PartitionedFormatTable for Spark 4 compatibility [paimon]
Posted by "kerwin-zk (via GitHub)" <gi...@apache.org>.
kerwin-zk closed pull request #7517: [spark] Add OVERWRITE_BY_FILTER capabilities to PartitionedFormatTable for Spark 4 compatibility
URL: https://github.com/apache/paimon/pull/7517
--
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] Add OVERWRITE_BY_FILTER capabilities to PartitionedFormatTable for Spark 4 compatibility [paimon]
Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron commented on PR #7517:
URL: https://github.com/apache/paimon/pull/7517#issuecomment-4125745305
+1
--
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