ozankabak commented on code in PR #5863:
URL: https://github.com/apache/arrow-datafusion/pull/5863#discussion_r1158644529
##########
datafusion/physical-expr/src/sort_expr.rs:
##########
@@ -107,19 +147,94 @@ impl std::fmt::Display for PhysicalSortRequirement {
}
impl PhysicalSortRequirement {
+ /// Creates a new `exact` requirement, which must match the
+ /// required options and expression. See
+ /// [`PhysicalSortRequirement`] for examples.
+ pub fn new_exact(expr: Arc<dyn PhysicalExpr>, options: SortOptions) ->
Self {
+ Self {
+ expr,
+ options: Some(options),
+ }
+ }
+
+ /// Creates a new `expr_only` requirement, which must match the
+ /// required expression. See [`PhysicalSortRequirement`] for
+ /// examples.
+ pub fn new_expr_only(expr: Arc<dyn PhysicalExpr>) -> Self {
+ Self {
+ expr,
+ options: None,
+ }
+ }
Review Comment:
The alternative I had in mind was
```rust
for partition_by in partition_by_exprs {
sort_reqs.push(PhysicalSortRequirement::new(partition_by.clone(), None));
// sort_reqs.push(PhysicalSortRequirement::new(partition_by.clone(),
Some(sort_options)));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]