Skip to content

Commit c0f40e1

Browse files
authored
Add extension hooks for encoding and decoding UDAFs and UDWFs (#253)
* Add extension hooks for encoding and decoding UDAFs and UDWFs * Add tests for encoding and decoding UDAFs
1 parent 55cdadf commit c0f40e1

File tree

13 files changed

+640
-315
lines changed

13 files changed

+640
-315
lines changed

datafusion/physical-expr-common/src/aggregate/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ impl AggregateFunctionExpr {
255255
pub fn is_distinct(&self) -> bool {
256256
self.is_distinct
257257
}
258+
259+
/// Return if the aggregation ignores nulls
260+
pub fn ignore_nulls(&self) -> bool {
261+
self.ignore_nulls
262+
}
258263
}
259264

260265
impl AggregateExpr for AggregateFunctionExpr {

datafusion/proto/proto/datafusion.proto

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ message CreateExternalTableNode {
164164
map<string, string> options = 8;
165165
datafusion_common.Constraints constraints = 12;
166166
map<string, LogicalExprNode> column_defaults = 13;
167-
}
167+
}
168168

169169
message PrepareNode {
170170
string name = 1;
@@ -249,30 +249,30 @@ message DistinctOnNode {
249249
}
250250

251251
message CopyToNode {
252-
LogicalPlanNode input = 1;
253-
string output_url = 2;
254-
oneof format_options {
255-
datafusion_common.CsvOptions csv = 8;
256-
datafusion_common.JsonOptions json = 9;
257-
datafusion_common.TableParquetOptions parquet = 10;
258-
datafusion_common.AvroOptions avro = 11;
259-
datafusion_common.ArrowOptions arrow = 12;
260-
}
261-
repeated string partition_by = 7;
252+
LogicalPlanNode input = 1;
253+
string output_url = 2;
254+
oneof format_options {
255+
datafusion_common.CsvOptions csv = 8;
256+
datafusion_common.JsonOptions json = 9;
257+
datafusion_common.TableParquetOptions parquet = 10;
258+
datafusion_common.AvroOptions avro = 11;
259+
datafusion_common.ArrowOptions arrow = 12;
260+
}
261+
repeated string partition_by = 7;
262262
}
263263

264264
message UnnestNode {
265-
LogicalPlanNode input = 1;
266-
repeated datafusion_common.Column exec_columns = 2;
267-
repeated uint64 list_type_columns = 3;
268-
repeated uint64 struct_type_columns = 4;
269-
repeated uint64 dependency_indices = 5;
270-
datafusion_common.DfSchema schema = 6;
271-
UnnestOptions options = 7;
265+
LogicalPlanNode input = 1;
266+
repeated datafusion_common.Column exec_columns = 2;
267+
repeated uint64 list_type_columns = 3;
268+
repeated uint64 struct_type_columns = 4;
269+
repeated uint64 dependency_indices = 5;
270+
datafusion_common.DfSchema schema = 6;
271+
UnnestOptions options = 7;
272272
}
273273

274274
message UnnestOptions {
275-
bool preserve_nulls = 1;
275+
bool preserve_nulls = 1;
276276
}
277277

278278
message UnionNode {
@@ -522,6 +522,7 @@ message AggregateUDFExprNode {
522522
repeated LogicalExprNode args = 2;
523523
LogicalExprNode filter = 3;
524524
repeated LogicalExprNode order_by = 4;
525+
optional bytes fun_definition = 6;
525526
}
526527

527528
message ScalarUDFExprNode {
@@ -556,6 +557,7 @@ message WindowExprNode {
556557
repeated LogicalExprNode order_by = 6;
557558
// repeated LogicalExprNode filter = 7;
558559
WindowFrame window_frame = 8;
560+
optional bytes fun_definition = 10;
559561
}
560562

561563
message BetweenNode {
@@ -856,6 +858,8 @@ message PhysicalAggregateExprNode {
856858
repeated PhysicalExprNode expr = 2;
857859
repeated PhysicalSortExprNode ordering_req = 5;
858860
bool distinct = 3;
861+
bool ignore_nulls = 6;
862+
optional bytes fun_definition = 7;
859863
}
860864

861865
message PhysicalWindowExprNode {
@@ -869,6 +873,7 @@ message PhysicalWindowExprNode {
869873
repeated PhysicalSortExprNode order_by = 6;
870874
WindowFrame window_frame = 7;
871875
string name = 8;
876+
optional bytes fun_definition = 9;
872877
}
873878

874879
message PhysicalIsNull {

0 commit comments

Comments
 (0)