sundapeng opened a new pull request, #9436:
URL: https://github.com/apache/paimon/pull/9436
### Purpose
`ADD PARTITION` on a format table accepted an empty string as a partition
value. Nothing downstream can represent that: `PartitionPathUtils` renders
`dt=` for it, which is not a partition directory Hive-style layout can
round-trip, and the value-only layout renders an empty path segment. The
registration lands in the catalog, the directory it names is unusable, and the
partition is unreadable and un-droppable by the value that created it.
`createPartitions` now validates before mutating anything and throws
`IllegalArgumentException` naming the offending column and table. Three cases
are rejected:
- an empty `STRING` value;
- an all-blank `CHAR(n)` value, because `CHAR` pads with spaces and `''` and
`' '` are the same value there;
- an empty `VARCHAR(n)` value — reached through
`CharVarcharUtils.replaceCharVarcharWithString`, since the char/varchar type is
carried in metadata rather than in `dataType`.
`NULL` is untouched: it already has a well-defined encoding via the default
partition name, and it stays on that path.
Validation runs over all rows before the first directory is created, so a
batch containing one bad spec fails without leaving the earlier specs
half-registered.
### Tests
Four cases added to `CatalogManagedPartitionEdgeParityTest`:
- empty `STRING` is rejected and neither the catalog's partition list nor
storage changes;
- empty `CHAR(8)` is rejected and state is unchanged;
- empty `VARCHAR(8)` is rejected and state is unchanged;
- an empty string arriving through an `INSERT` (rather than DDL) still lands
on the default-partition encoding, which pins down that this change does not
alter the write path.
```
mvn -pl paimon-spark/paimon-spark-3.5 -am -Pspark3 \
-DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dtest=none \
-DwildcardSuites=org.apache.paimon.spark.sql.CatalogManagedPartitionEdgeParityTest
test
```
Tests: succeeded 12, failed 0 (8 existing + 4 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]