Search before asking
Paimon version
master (1d368b4)
Compute Engine
Spark with a path-based Paimon table. The underlying problem is in core automatic schema merging.
Minimal reproduce step
-
Create a path-based primary-key table with:
- id INT
- PRIMARY KEY (id)
- 16 buckets
-
Write id = -100000.
-
Append a Spark DataFrame where id has LongType, using:
write.merge-schema=true
write.merge-schema.type-widening=true
-
Read the table and inspect its schema and bucket assignments.
Automatic merging can commit id BIGINT while retaining primaryKeys=[id] .
The normal explicit schema-change path rejects type changes to primary-key and partition columns. SchemaMergingUtils , however, merges every field type and preserves the existing key-name lists without validating protected fields. A direct filesystem schema manager can then commit the merged schema.
The physical hash representation changes with the type. For example, the reviewed reproduction produced:
INT(-100000): bucket 3
BIGINT(-100000): bucket 13
The same logical key can therefore be written to two buckets and escape per-bucket deduplication.
What doesn't meet your expectations?
Automatic schema merging should preserve the same key-type invariants as explicit ALTER TABLE operations.
Type changes to primary-key and partition columns should be rejected before a new schema is committed. Non-key widening should continue to work.
Anything else?
A shared validation method could compare the old and merged types of all primary-key and partition fields before commit and produce an error naming the protected column.
Suggested tests:
- Reject widening an INT primary key to BIGINT
- Reject widening a partition column
- Verify no schema ID or schema file is created after rejection
- Verify non-key widening still succeeds
- Spark path-table integration test
- Regression with a key whose INT and BIGINT representations hash to different buckets
This issue has a high correctness impact. I would reproduce it in an integration test once more before filing and mention whether catalog-backed tables follow the same path.
Are you willing to submit a PR?
Search before asking
Paimon version
master (1d368b4)
Compute Engine
Spark with a path-based Paimon table. The underlying problem is in core automatic schema merging.
Minimal reproduce step
Create a path-based primary-key table with:
Write id = -100000.
Append a Spark DataFrame where id has LongType, using:
write.merge-schema=true
write.merge-schema.type-widening=true
Read the table and inspect its schema and bucket assignments.
Automatic merging can commit id BIGINT while retaining primaryKeys=[id] .
The normal explicit schema-change path rejects type changes to primary-key and partition columns. SchemaMergingUtils , however, merges every field type and preserves the existing key-name lists without validating protected fields. A direct filesystem schema manager can then commit the merged schema.
The physical hash representation changes with the type. For example, the reviewed reproduction produced:
The same logical key can therefore be written to two buckets and escape per-bucket deduplication.
What doesn't meet your expectations?
Automatic schema merging should preserve the same key-type invariants as explicit ALTER TABLE operations.
Type changes to primary-key and partition columns should be rejected before a new schema is committed. Non-key widening should continue to work.
Anything else?
A shared validation method could compare the old and merged types of all primary-key and partition fields before commit and produce an error naming the protected column.
Suggested tests:
This issue has a high correctness impact. I would reproduce it in an integration test once more before filing and mention whether catalog-backed tables follow the same path.
Are you willing to submit a PR?