Skip to content

Commit

Permalink
revert schema change v3
Browse files Browse the repository at this point in the history
  • Loading branch information
xinlifoobar committed Aug 5, 2024
1 parent 1ccc740 commit 4d50a94
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ mod tests {
schema: &Schema,
) -> Arc<dyn AggregateExpr> {
AggregateExprBuilder::new(count_udaf(), vec![expr])
.schema(schema.clone())
.schema(Arc::new(schema.clone()))
.name(name)
.build()
.unwrap()
Expand Down Expand Up @@ -363,7 +363,7 @@ mod tests {
let aggr_expr =
vec![
AggregateExprBuilder::new(sum_udaf(), vec![col("b", &schema)?])
.dfschema(Arc::clone(&schema).to_dfschema()?)
.schema(Arc::clone(&schema))
.name("Sum(b)")
.build()
.unwrap(),
Expand Down
1 change: 1 addition & 0 deletions datafusion/physical-expr-common/src/aggregate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ pub fn create_aggregate_expr_with_dfschema(
builder = builder.sort_exprs(sort_exprs.to_vec());
builder = builder.order_by(ordering_req.to_vec());
builder = builder.logical_exprs(input_exprs.to_vec());
builder = builder.dfschema(dfschema.clone());
let schema: Schema = dfschema.into();
builder = builder.schema(Arc::new(schema));
builder = builder.name(name);
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-plan/src/aggregates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ mod tests {
// Median(a)
fn test_median_agg_expr(schema: SchemaRef) -> Result<Arc<dyn AggregateExpr>> {
AggregateExprBuilder::new(median_udaf(), vec![col("a", &schema)?])
.schema(Arc::clone(&schema))
.schema(schema)
.name("MEDIAN(a)")
.build()
}
Expand Down
3 changes: 2 additions & 1 deletion datafusion/proto/src/physical_plan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ impl AsExecutionPlan for protobuf::PhysicalPlanNode {

// TODO: approx_percentile_cont and approx_percentile_cont_weight are not supported for UDAF from protobuf yet.
// TODO: `order by` is not supported for UDAF yet
AggregateExprBuilder::new(agg_udf, input_phy_expr).schema(Arc::clone(&physical_schema)).name(name).with_ignore_nulls(agg_node.ignore_nulls).with_distinct(agg_node.distinct).build() }
AggregateExprBuilder::new(agg_udf, input_phy_expr).schema(Arc::clone(&physical_schema)).name(name).with_ignore_nulls(agg_node.ignore_nulls).with_distinct(agg_node.distinct).build()
}
}
}).transpose()?.ok_or_else(|| {
proto_error("Invalid AggregateExpr, missing aggregate_function")
Expand Down

0 comments on commit 4d50a94

Please sign in to comment.