Skip to content

[BUG] LIMIT works incorrectly with NESTED #1764

Open

Description

@Yury-Fridlyand

What is the bug?
Bit-Quill#278 (comment)
A query with LIMIT N and NESTED function may return M rows, where M > N.

How can one reproduce the bug?
Bit-Quill#278 (comment)
Being pushed down LIMIT defines number of docs to be returned, but NestedOperator adds extra rows while processes cartesian products.

What is the expected behavior?
Keep LIMIT pushed down, but leave LogicalLimit/LimitOperator in the plan tree to count number of the rows returned and cut off when limit reached.
Depends on Optimizer rework presented in #1752.

What is your host/environment?
main @ ded014d

Do you have any screenshots?
N/A

Do you have any additional context?
N/A

Activity

  1. added
    bug
    on Jun 22, 2023
  2. Yury-Fridlyand commented on Jun 22, 2023

    @Yury-Fridlyand
    CollaboratorAuthor

    Hey bot, don't play with labels!

  3. added
    PPL
    on May 29, 2025
  4. removed
    PPL
    on Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

SQLbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions