Skip to content

eliminate multi limit-offset nodes to EmptyRelation if possible  #2822

Closed

Description

@HuSen8891

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
For such query: select * from (select * from xxxx limit n offset ..) a limit n offset m;

If outer offset(m) is greater than or equal to inner limit(n),we can replace inner limit node with an [LogicalPlan::EmptyRelation], like this logical plan:

---Limit: skip=m, fetch=n
---- Projection: #a.column1
------EmptyRelation

Generally, for logical plans, if upper offset is greater than or equal to current limit, replace current limit with an [LogicalPlan::EmptyRelation].

Describe the solution you'd like
As above.

Describe alternatives you've considered
None

Additional context
None

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions