Skip to content

Commit 023b018

Browse files
authored
support unknown col expr in proto (#13603)
1 parent 48aaab7 commit 023b018

File tree

5 files changed

+130
-3
lines changed

5 files changed

+130
-3
lines changed

datafusion/proto/proto/datafusion.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ message PhysicalExprNode {
828828
PhysicalLikeExprNode like_expr = 18;
829829

830830
PhysicalExtensionExprNode extension = 19;
831+
832+
UnknownColumn unknown_column = 20;
831833
}
832834
}
833835

@@ -1067,6 +1069,10 @@ message PhysicalColumn {
10671069
uint32 index = 2;
10681070
}
10691071

1072+
message UnknownColumn {
1073+
string name = 1;
1074+
}
1075+
10701076
message JoinOn {
10711077
PhysicalExprNode left = 1;
10721078
PhysicalExprNode right = 2;

datafusion/proto/src/generated/pbjson.rs

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/proto/src/generated/prost.rs

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/proto/src/physical_plan/from_proto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use datafusion::logical_expr::WindowFunctionDefinition;
3838
use datafusion::physical_expr::{LexOrdering, PhysicalSortExpr, ScalarFunctionExpr};
3939
use datafusion::physical_plan::expressions::{
4040
in_list, BinaryExpr, CaseExpr, CastExpr, Column, IsNotNullExpr, IsNullExpr, LikeExpr,
41-
Literal, NegativeExpr, NotExpr, TryCastExpr,
41+
Literal, NegativeExpr, NotExpr, TryCastExpr, UnKnownColumn,
4242
};
4343
use datafusion::physical_plan::windows::{create_window_expr, schema_add_window_field};
4444
use datafusion::physical_plan::{Partitioning, PhysicalExpr, WindowExpr};
@@ -219,6 +219,7 @@ pub fn parse_physical_expr(
219219
let pcol: Column = c.into();
220220
Arc::new(pcol)
221221
}
222+
ExprType::UnknownColumn(c) => Arc::new(UnKnownColumn::new(&c.name)),
222223
ExprType::Literal(scalar) => Arc::new(Literal::new(scalar.try_into()?)),
223224
ExprType::BinaryExpr(binary_expr) => Arc::new(BinaryExpr::new(
224225
parse_required_physical_expr(

datafusion/proto/src/physical_plan/to_proto.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use datafusion::physical_expr::window::{SlidingAggregateWindowExpr, StandardWind
2323
use datafusion::physical_expr::{LexOrdering, PhysicalSortExpr, ScalarFunctionExpr};
2424
use datafusion::physical_plan::expressions::{
2525
BinaryExpr, CaseExpr, CastExpr, Column, InListExpr, IsNotNullExpr, IsNullExpr,
26-
Literal, NegativeExpr, NotExpr, TryCastExpr,
26+
Literal, NegativeExpr, NotExpr, TryCastExpr, UnKnownColumn,
2727
};
2828
use datafusion::physical_plan::udaf::AggregateFunctionExpr;
2929
use datafusion::physical_plan::windows::{PlainAggregateWindowExpr, WindowUDFExpr};
@@ -220,6 +220,14 @@ pub fn serialize_physical_expr(
220220
},
221221
)),
222222
})
223+
} else if let Some(expr) = expr.downcast_ref::<UnKnownColumn>() {
224+
Ok(protobuf::PhysicalExprNode {
225+
expr_type: Some(protobuf::physical_expr_node::ExprType::UnknownColumn(
226+
protobuf::UnknownColumn {
227+
name: expr.name().to_string(),
228+
},
229+
)),
230+
})
223231
} else if let Some(expr) = expr.downcast_ref::<BinaryExpr>() {
224232
let binary_expr = Box::new(protobuf::PhysicalBinaryExprNode {
225233
l: Some(Box::new(serialize_physical_expr(expr.left(), codec)?)),

0 commit comments

Comments
 (0)