Skip to content

feat(proto): support expressions in LIMIT skip and fetch - #24159

Open
karpenkoag wants to merge 1 commit into
apache:mainfrom
tarantool:a.karpenko/allow-evaluated-expr-in-logical-plan
Open

feat(proto): support expressions in LIMIT skip and fetch#24159
karpenkoag wants to merge 1 commit into
apache:mainfrom
tarantool:a.karpenko/allow-evaluated-expr-in-logical-plan

Conversation

@karpenkoag

Copy link
Copy Markdown

Serialize and deserialize LIMIT expressions in logical plan protobufs, and simplify them before physical planning so evaluable expressions can be used.

@github-actions github-actions Bot added logical-expr Logical plan and expressions core Core DataFusion crate proto Related to proto crate labels Aug 7, 2026
@karpenkoag
karpenkoag force-pushed the a.karpenko/allow-evaluated-expr-in-logical-plan branch from acd6517 to 1420aed Compare August 7, 2026 09:50
@karpenkoag
karpenkoag marked this pull request as draft August 7, 2026 09:54
Serialize and deserialize LIMIT expressions in logical plan protobufs, and
simplify them before physical planning so evaluable expressions can be used.
@karpenkoag
karpenkoag force-pushed the a.karpenko/allow-evaluated-expr-in-logical-plan branch from 1420aed to 7d464ab Compare August 7, 2026 10:27
@karpenkoag
karpenkoag marked this pull request as ready for review August 7, 2026 10:27
@askalt

askalt commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@karpenkoag Please reflect in the PR description that it extends support for limit expressions. Currently, it seems that this patch only touches the proto, while there are also changes in the planner.

}
LogicalPlan::SubqueryAlias(_) => children.one()?,
LogicalPlan::Limit(limit) => {
// Try to evaluate skip and fetch expressions.

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.

Let's add SLT to test these changes.

Comment on lines +1226 to +1234
let skip = match &limit.skip {
Some(expr) => Some(Box::new(simplifier.simplify(*expr.clone())?)),
None => None,
};

let fetch = match &limit.fetch {
Some(expr) => Some(Box::new(simplifier.simplify(*expr.clone())?)),
None => None,
};

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.

Can we avoid code duplication here? e.g. create a closure.

Literal(Option<usize>),
/// Currently only supports expressions that can be folded into constants.
//// Currently supports all expressions that can be evaluated.
/// UnsupportedExpr means that the expression is not considered by the analyzer/optimizer.

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.

Suggested change
/// UnsupportedExpr means that the expression is not considered by the analyzer/optimizer.
/// UnsupportedExpr means that the expression is not considered by the logical analyzer/optimizer.

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

Labels

core Core DataFusion crate logical-expr Logical plan and expressions proto Related to proto crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants