sundapeng opened a new pull request, #9435:
URL: https://github.com/apache/paimon/pull/9435
### Purpose
`PaimonAnalysis` rejects `ALTER TABLE ... SET LOCATION` for Paimon tables,
but the pattern only matched `ResolvedTable(_, _, _: SparkTable, _)`. A format
table resolves to `PaimonFormatTable`, not `SparkTable`, so the rule fell
through and Spark applied the location change to the catalog entry.
That is not a harmless no-op. For a catalog-managed format table the
location is what the registered partitions are relative to, so after a
successful `SET LOCATION` the catalog still lists the old partitions while the
table now points somewhere else — the partition registrations and the data they
describe no longer agree, and reads come back empty or wrong.
This adds the `PaimonFormatTable` case next to the existing one and throws
the same `UnsupportedOperationException` with the same message. Partition-level
`SET LOCATION` is left alone: Spark's own analyzer already rejects it with a
structured `AnalysisException`, and there is no reason to replace a better
error with a worse one.
### Tests
Two cases added to `CatalogManagedPartitionDdlParityTest`:
- table-level `SET LOCATION` throws, and afterwards the location, the
registered partition set, and the readable rows are all unchanged — so the
rejection is verified to be a real rejection, not an error thrown after a
partial mutation;
- partition-level `SET LOCATION` still fails with Spark's
`AnalysisException` and likewise leaves the table intact.
```
mvn -pl paimon-spark/paimon-spark-3.5 -am -Pspark3 \
-DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dtest=none \
-DwildcardSuites=org.apache.paimon.spark.sql.CatalogManagedPartitionDdlParityTest
test
```
Tests: succeeded 9, failed 0 (7 existing + 2 new). `spotless:check` +
`checkstyle:check` on `paimon-spark-common` and `paimon-spark-ut` pass.
--
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]