Skip to content

Commit cf1376a

Browse files
committed
fix(cube): Sort fetch is not deserialized
1 parent 613263f commit cf1376a

File tree

1 file changed

+13
-1
lines changed
  • datafusion/proto/src/logical_plan

1 file changed

+13
-1
lines changed

datafusion/proto/src/logical_plan/mod.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,19 @@ impl AsLogicalPlan for LogicalPlanNode {
480480
into_logical_plan!(sort.input, ctx, extension_codec)?;
481481
let sort_expr: Vec<SortExpr> =
482482
from_proto::parse_sorts(&sort.expr, ctx, extension_codec)?;
483-
LogicalPlanBuilder::from(input).sort(sort_expr)?.build()
483+
let fetch = if sort.fetch < 0 {
484+
None
485+
} else {
486+
Some(sort.fetch as usize)
487+
};
488+
489+
match LogicalPlanBuilder::from(input).sort(sort_expr)?.build()? {
490+
LogicalPlan::Sort(mut sort) => {
491+
sort.fetch = fetch;
492+
Ok(LogicalPlan::Sort(sort))
493+
}
494+
p => LogicalPlanBuilder::from(p).limit(0, fetch)?.build()
495+
}
484496
}
485497
LogicalPlanType::Repartition(repartition) => {
486498
use datafusion::logical_expr::Partitioning;

0 commit comments

Comments
 (0)