Skip to content

Commit fd07e73

Browse files
dqkqdJefffrey
authored andcommitted
feat: support null_treatment, distinct, and filter for window functions in proto (apache#18024)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes apache#123` indicates that this PR will close issue apache#123. --> - Closes apache#17417. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> - Support `null_treatment`, `distinct`, and `filter` for window function in proto. - Support `null_treatment` for aggregate udf in proto. ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> - [x] Add `null_treatment`, `distinct`, `filter` fields to `WindowExprNode` message and handle them in `to/from_proto.rs`. - [x] Add `null_treatment` field to `AggregateUDFExprNode` message and handle them in `to/from_proto.rs`. - [ ] Docs update: I'm not sure where to add docs as declared in the issue description. ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> - Add tests to `roundtrip_window` for respectnulls, ignorenulls, distinct, filter. - Add tests to `roundtrip_aggregate_udf` for respectnulls, ignorenulls. ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> N/A --------- Co-authored-by: Jeffrey Vo <[email protected]>
1 parent b00bd19 commit fd07e73

File tree

6 files changed

+359
-46
lines changed

6 files changed

+359
-46
lines changed

datafusion/proto/proto/datafusion.proto

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ message AggregateUDFExprNode {
518518
LogicalExprNode filter = 3;
519519
repeated SortExprNode order_by = 4;
520520
optional bytes fun_definition = 6;
521+
optional NullTreatment null_treatment = 7;
521522
}
522523

523524
message ScalarUDFExprNode {
@@ -538,6 +539,9 @@ message WindowExprNode {
538539
// repeated LogicalExprNode filter = 7;
539540
WindowFrame window_frame = 8;
540541
optional bytes fun_definition = 10;
542+
optional NullTreatment null_treatment = 11;
543+
bool distinct = 12;
544+
LogicalExprNode filter = 13;
541545
}
542546

543547
message BetweenNode {
@@ -622,6 +626,11 @@ message WindowFrameBound {
622626
datafusion_common.ScalarValue bound_value = 2;
623627
}
624628

629+
enum NullTreatment {
630+
RESPECT_NULLS = 0;
631+
IGNORE_NULLS = 1;
632+
}
633+
625634
///////////////////////////////////////////////////////////////////////////////////////////////////
626635
// Arrow Data Types
627636
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1365,4 +1374,4 @@ message SortMergeJoinExecNode {
13651374
JoinFilter filter = 5;
13661375
repeated SortExprNode sort_options = 6;
13671376
datafusion_common.NullEquality null_equality = 7;
1368-
}
1377+
}

datafusion/proto/src/generated/pbjson.rs

Lines changed: 145 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: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)