Skip to content

fix: return EmptyExec for LIMIT 0 in physical planning - #30

Open
karpenkoag wants to merge 1 commit into
release-52.3.0from
a.karpenko/fix-zero-limit-in-plc
Open

fix: return EmptyExec for LIMIT 0 in physical planning#30
karpenkoag wants to merge 1 commit into
release-52.3.0from
a.karpenko/fix-zero-limit-in-plc

Conversation

@karpenkoag

Copy link
Copy Markdown

Short-circuit physical planning when a limit requests zero rows by returning an EmptyExec with the input schema.

Short-circuit physical planning when a limit requests zero rows by
returning an EmptyExec with the input schema.
@github-actions github-actions Bot added the core label Aug 20, 2026
@karpenkoag
karpenkoag requested review from LLDay and askalt August 21, 2026 08:01
// GlobalLimitExec requires a single partition for input
let input = if input.output_partitioning().partition_count() == 1 {
input
if let Some(0) = fetch {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it seems match fetch would look more readable.

// GlobalLimitExec requires a single partition for input
let input = if input.output_partitioning().partition_count() == 1 {
input
if let Some(0) = fetch {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ok with LIMIT 0?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without a placeholder?
Yes, it is OK.

@LLDay

LLDay commented Aug 21, 2026

Copy link
Copy Markdown

Can fetch = 0 be passed to other LogicalPlan nodes? There is the fetch field in Sort and TableScan nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants