Skip to content

Commit

Permalink
fix(cube): Sort fetch is not deserialized
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Dec 2, 2024
1 parent 613263f commit cf1376a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion datafusion/proto/src/logical_plan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,19 @@ impl AsLogicalPlan for LogicalPlanNode {
into_logical_plan!(sort.input, ctx, extension_codec)?;
let sort_expr: Vec<SortExpr> =
from_proto::parse_sorts(&sort.expr, ctx, extension_codec)?;
LogicalPlanBuilder::from(input).sort(sort_expr)?.build()
let fetch = if sort.fetch < 0 {
None
} else {
Some(sort.fetch as usize)
};

match LogicalPlanBuilder::from(input).sort(sort_expr)?.build()? {
LogicalPlan::Sort(mut sort) => {
sort.fetch = fetch;
Ok(LogicalPlan::Sort(sort))
}
p => LogicalPlanBuilder::from(p).limit(0, fetch)?.build()
}
}
LogicalPlanType::Repartition(repartition) => {
use datafusion::logical_expr::Partitioning;
Expand Down

0 comments on commit cf1376a

Please sign in to comment.