Skip to content

[Bug] Batch DELETE is a silent no-op on partial-update tables with remove-record-on-sequence-group #8858

Description

@ZZZxDong

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

master

Compute Engine

Spark

Minimal reproduce step

CREATE TABLE t (id INT, g INT, v BIGINT) TBLPROPERTIES (
  'primary-key' = 'id',
  'bucket' = '2',
  'merge-engine' = 'partial-update',
  'fields.g.sequence-group' = 'v',
  'partial-update.remove-record-on-sequence-group' = 'g');

INSERT INTO t VALUES (1, 1, 10), (2, 1, 20);
DELETE FROM t WHERE id = 1;
SELECT * FROM t;
-- both rows are still there, the DELETE silently has no effect

What doesn't meet your expectations?

validatePKUpsertDeletable allows batch DELETE when partial-update.remove-record-on-sequence-group is set, so the statement goes through the pk-upsert delete path (scan matching rows, mark them with -D and write back). The -D rows carry the real field values including the sequence-group field, so I'd expect retractWithSequenceGroup to set currentDeleteRow and remove the row — but nothing is deleted and no error is raised.

Not sure whether this is a bug or expected (e.g. the delete row is required to carry a larger sequence value than the current one?). If it is expected, maybe validatePKUpsertDeletable should reject this case or the behavior should be documented, since a silently no-op DELETE is quite surprising.

Noticed while working on #8837 (the fast path there is gated to DEDUPLICATE, so it's unrelated to that change — reproducible on vanilla master).

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

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