Skip to content

Implement limit push down for IcebergTableProvider #1673

Closed
krinart wants to merge 14 commits intoapache:mainfrom
spiceai:viktor/origin_limit_push_down
Closed

Implement limit push down for IcebergTableProvider #1673
krinart wants to merge 14 commits intoapache:mainfrom
spiceai:viktor/origin_limit_push_down

Conversation

@krinart
Copy link
Copy Markdown

@krinart krinart commented Sep 15, 2025

Which issue does this PR close?

N/A

What changes are included in this PR?

Previously _limit was ignored in IcebergTableProvider::scan:

_state: &dyn Session,
projection: Option<&Vec<usize>>,
filters: &[Expr],
_limit: Option<usize>,
) -> DFResult<Arc<dyn ExecutionPlan>> {
Ok(Arc::new(IcebergTableScan::new(
self.table.clone(),
self.snapshot_id,
self.schema.clone(),
projection,
filters,
)))
}
fn supports_filters_pushdown(

This PR propagates limit all the way to the ArrowReaderBuilder.

Note: limit push down is only applied to each batch which means that IcebergTableProvider::scan may potentially return more records than specified by limit.

Which is OK according to TableProvider::scan documentation:

If limit is specified, must only produce at least this many rows, (though it may return more).

Are these changes tested?

Unit tests

record_batch_stream_builder.with_row_groups(selected_row_group_indices);
}

if let Some(limit) = task.limit {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Thanks! I extended should_load_page_index logic and ArrowReaderOptions is initialized with with_page_index(should_load_page_index).

Copy link
Copy Markdown
Contributor

@ZENOTME ZENOTME left a comment

Choose a reason for hiding this comment

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

Thanks @krinart

@krinart
Copy link
Copy Markdown
Author

krinart commented Sep 19, 2025

Happy to help @ZENOTME and thanks for the feedback!
Any suggestions on how to proceed and merge this PR?

sgrebnov added a commit to spiceai/iceberg-rust that referenced this pull request Sep 25, 2025
@krinart
Copy link
Copy Markdown
Author

krinart commented Oct 12, 2025

Hi. Anything else I can do on my side to get this merged?

Copy link
Copy Markdown
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thank you for working on this!

@Xuanwo
Copy link
Copy Markdown
Member

Xuanwo commented Dec 5, 2025

hi, @krinart please allow me to edit this PR so we can resolve the conflicts and merge it.

lukekim pushed a commit to spiceai/iceberg-rust that referenced this pull request Jan 19, 2026
@krinart
Copy link
Copy Markdown
Author

krinart commented Jan 20, 2026

Hey @Xuanwo, apologies for a late reply.

I just resolved all the conflicts. Let me know if there's anything else I can do. Thanks!

@lukekim
Copy link
Copy Markdown

lukekim commented Feb 12, 2026

@Xuanwo anything left to get this merged?

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Mar 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Mar 23, 2026
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.

5 participants