Skip to content

RENAME COLUMN can change which field a sequence group protects #1559

Backlog

Description

@taoran92

Search before asking

  • I searched in the issues and found nothing similar.

Please describe the bug

On a partial-update table, renaming a column can allow an older update to overwrite a different column previously protected by a sequence group. Run the following in a DataFusion session with a Paimon filesystem catalog:

CREATE SCHEMA paimon.db;
CREATE TABLE paimon.db.events (
    id BIGINT, ts BIGINT, channel STRING, " channel " STRING, PRIMARY KEY (id)
) WITH (
    'bucket' = '1', 'merge-engine' = 'partial-update',
    'fields.ts.sequence-group' = ' channel '
);
INSERT INTO paimon.db.events VALUES (1, 100, 'organic', 'first');
ALTER TABLE paimon.db.events RENAME COLUMN " channel " TO aux;
INSERT INTO paimon.db.events VALUES (1, 80, 'older', 'later');
SELECT channel, aux FROM paimon.db.events;

Expected
A successful rename should preserve the protected column. The query should return ('organic', 'later'), as it does with the original column names when the rename is omitted. If the binding is ambiguous, the rename should fail before publishing a new schema.

Actual
The rename succeeds and the query returns ('older', 'first'). The group now protects aux.

Ordinary column names are also affected. For a group defined as 'fields.ts.sequence-group' = 'a, b', renaming b to c fails because the group still references b.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions