JingsongLi commented on code in PR #11246:
URL: https://github.com/apache/paimon/pull/11246#discussion_r4623811001
##########
paimon-spark/paimon-spark4-common/src/main/scala/org/apache/spark/sql/paimon/shims/Spark4Shim.scala:
##########
@@ -186,7 +186,7 @@ class Spark4Shim extends SparkShim {
val statementType = "REPLACE TABLE"
val columns = schemaOrColumns.asInstanceOf[Seq[ColumnDefinition]]
ResolveDefaultColumns.validateCatalogForDefaultValue(columns, catalog,
ident)
- GeneratedColumn.validateGeneratedColumns(tableSchema, catalog, ident,
statementType)
+ validateGeneratedColumns(tableSchema, columns, catalog, ident,
statementType)
Review Comment:
[P1] Reject unsupported CHECK constraints before replacing the table
Spark 4.3's native `DataSourceV2Strategy` validates `TableSpec.constraints`
against catalog capabilities before planning a replacement. Paimon's custom
`PaimonReplaceTableStrategy` takes this path and checks generated, default and
identity columns only. On the merged tree with Spark 4.3.0 I created a Paimon
REST table `t(id INT)` and inserted `7`. Plain `CREATE TABLE other (id INT,
CONSTRAINT positive CHECK (id > 0))` failed with
`UNSUPPORTED_FEATURE.TABLE_OPERATION` as expected. `CREATE OR REPLACE TABLE t
(id INT, CONSTRAINT positive CHECK (id > 0))` succeeded and `SELECT * FROM t`
was empty. Please run Spark's table-constraint capability check before creating
the replacement exec (or reject constraints explicitly) and add a case
asserting that the old row remains. [Spark 4.3.0 native
check](https://github.com/apache/spark/blob/v4.3.0/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala#L311-L328)
--
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]