findepi commented on code in PR #12178:
URL: https://github.com/apache/datafusion/pull/12178#discussion_r1732591732
##########
datafusion/proto/src/logical_plan/from_proto.rs:
##########
@@ -586,7 +586,10 @@ pub fn parse_expr(
parse_exprs(&pb.args, registry, codec)?,
pb.distinct,
parse_optional_expr(pb.filter.as_deref(), registry,
codec)?.map(Box::new),
- parse_vec_expr(&pb.order_by, registry, codec)?,
+ match pb.order_by.len() {
+ 0 => None,
+ _ => Some(parse_exprs(&pb.order_by, registry, codec)?),
+ },
Review Comment:
`empty_vec_to_none`? `vec_if_non_empty`?
in this case, however, my preference would be to remove `Option` and keep
just `Vec`.
Empty collection perfectly describes lack of sorting, so no need to wrap if
with optional value.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]