Skip to content

Commit

Permalink
Fix ballista compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Sep 8, 2021
1 parent 55d0cc8 commit d47311b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
21 changes: 11 additions & 10 deletions ballista/rust/core/src/serde/logical_plan/from_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
}
LogicalPlanType::Selection(selection) => {
let input: LogicalPlan = convert_box_required!(selection.input)?;
let expr: Expr = selection
.expr
.as_ref()
.ok_or_else(|| {
BallistaError::General("expression required".to_string())
})?
.try_into()?;
LogicalPlanBuilder::from(input)
.filter(
selection
.expr
.as_ref()
.expect("expression required")
.try_into()?,
)?
.filter(expr)?
.build()
.map_err(|e| e.into())
}
Expand All @@ -85,7 +86,7 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
.window_expr
.iter()
.map(|expr| expr.try_into())
.collect::<Result<Vec<_>, _>>()?;
.collect::<Result<Vec<Expr>, _>>()?;
LogicalPlanBuilder::from(input)
.window(window_expr)?
.build()
Expand All @@ -97,12 +98,12 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
.group_expr
.iter()
.map(|expr| expr.try_into())
.collect::<Result<Vec<_>, _>>()?;
.collect::<Result<Vec<Expr>, _>>()?;
let aggr_expr = aggregate
.aggr_expr
.iter()
.map(|expr| expr.try_into())
.collect::<Result<Vec<_>, _>>()?;
.collect::<Result<Vec<Expr>, _>>()?;
LogicalPlanBuilder::from(input)
.aggregate(group_expr, aggr_expr)?
.build()
Expand Down
7 changes: 5 additions & 2 deletions datafusion/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,11 @@ impl LogicalPlanBuilder {
}

/// Apply a window functions to extend the schema
pub fn window(&self, window_expr: impl IntoIterator<Item = Expr>) -> Result<Self> {
let window_expr = window_expr.into_iter().collect::<Vec<Expr>>();
pub fn window(
&self,
window_expr: impl IntoIterator<Item = impl Into<Expr>>,
) -> Result<Self> {
let window_expr = normalize_cols(window_expr, &self.plan)?;
let all_expr = window_expr.iter();
validate_unique_names("Windows", all_expr.clone(), self.plan.schema())?;
let mut window_fields: Vec<DFField> =
Expand Down

0 comments on commit d47311b

Please sign in to comment.