Skip to content

[Bug] DataFusion UPDATE and DELETE can affect more rows than LIMIT allows #1396

Description

@lyne7-sc

Search before asking

  • I searched in the issues and found nothing similar.

Please describe the bug 🐞

DataFusion SQLContext drops ORDER BY and LIMIT when selecting rows for UPDATE/DELETE, affecting both Copy-on-Write and Data Evolution tables.

For example, run through SQLContext with the paimon catalog:

CREATE SCHEMA paimon.dml_limit_repro;
CREATE TABLE paimon.dml_limit_repro.t (id INT);
INSERT INTO paimon.dml_limit_repro.t VALUES (1), (2), (3);
DELETE FROM paimon.dml_limit_repro.t ORDER BY id LIMIT 1;
SELECT * FROM paimon.dml_limit_repro.t ORDER BY id;

Expected: only id=1 is deleted. Actual: all three rows are deleted. UPDATE has the same issue;

Solution

Preserve ORDER BY and LIMIT in the internal selection queries.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added theissue type on Nov 12, 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

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions