Skip to content

[Bug] Dropping a clustering.columns column makes the table permanently unwritable #11455

Backlog

Description

@Yibo-Dong

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

master (88792ed, 2026-11-24) and 2.1.0

Compute Engine

Flink 1.20.5 (SQL Client, batch mode)

Minimal reproduce step

CREATE CATALOG c WITH ('type' = 'paimon', 'warehouse' = 'file:/tmp/paimon_drop_clustering_column');
USE CATALOG c;

-- control: drop a column that is not a clustering column -> later writes succeed
CREATE TABLE control (id INT PRIMARY KEY NOT ENFORCED, v INT, w INT) WITH (
  'bucket' = '1', 'deletion-vectors.enabled' = 'true',
  'pk-clustering-override' = 'true', 'clustering.columns' = 'v');
INSERT INTO control VALUES (1, 1, 1), (2, 2, 2);
ALTER TABLE control DROP w;
INSERT INTO control VALUES (3, 3), (1, 9);
SELECT * FROM control;

-- bug: drop the clustering column -> ALTER succeeds, every later write fails
CREATE TABLE t (id INT PRIMARY KEY NOT ENFORCED, v INT, w INT) WITH (
  'bucket' = '1', 'deletion-vectors.enabled' = 'true',
  'pk-clustering-override' = 'true', 'clustering.columns' = 'v');
INSERT INTO t VALUES (1, 1, 1), (2, 2, 2);
ALTER TABLE t DROP v;
SELECT * FROM t;
INSERT INTO t VALUES (3, 3), (1, 9);

What doesn't meet your expectations?

Expected: ALTER TABLE t DROP v is rejected because v is referenced by clustering.columns (as Paimon already does for primary keys, partition keys and primary-key index columns), or the option is updated so the table stays writable.

Actual: the control table works (SELECT returns (2,2) (3,3) (1,9)). On t the DROP succeeds, SELECT * FROM t still returns (1,1) (2,2), but the next INSERT fails. The writer task fails with:

java.io.IOException: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 2
	at org.apache.paimon.flink.sink.RowDataStoreWriteOperator.write(RowDataStoreWriteOperator.java:63)
Caused by: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 2
	at org.apache.paimon.types.RowType.project(RowType.java:324)
	at org.apache.paimon.mergetree.compact.clustering.ClusteringCompactManager.<init>(ClusteringCompactManager.java:115)
	at org.apache.paimon.mergetree.compact.clustering.ClusteringCompactManagerFactory.create(ClusteringCompactManagerFactory.java:126)
	at org.apache.paimon.operation.KeyValueFileStoreWrite.createWriter(KeyValueFileStoreWrite.java:225)

(The SQL Client itself only prints java.lang.IllegalStateException: MiniCluster is not yet running or has already been shut down.)

Anything else?

The table cannot be repaired: pk-clustering-override is immutable, and both ALTER TABLE t SET ('clustering.columns' = 'w') and ALTER TABLE t RESET ('clustering.columns') are rejected with Cannot change/reset clustering.columns when pk-clustering-override enabled. So a single legal DROP COLUMN leaves the primary-key table permanently unwritable.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    bug
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions