findepi commented on code in PR #17442:
URL: https://github.com/apache/datafusion/pull/17442#discussion_r2330208915
##########
datafusion/physical-expr-common/src/sort_expr.rs:
##########
@@ -367,8 +367,21 @@ impl LexOrdering {
/// Creates a new [`LexOrdering`] from the given vector of sort
expressions.
/// If the vector is empty, returns `None`.
pub fn new(exprs: impl IntoIterator<Item = PhysicalSortExpr>) ->
Option<Self> {
- let (non_empty, ordering) = Self::construct(exprs);
- non_empty.then_some(ordering)
+ let exprs = exprs.into_iter();
Review Comment:
> I personally suggest avoiding the Vec::with_capacity call unless we are
sure it is better
I added it only because a test complained.
There is a test checking exact allocated memory and without pre-sizing, the
test was reporting a slightly higher value then the old code. Will it be OK to
drop `with_capacity`, and thus increase code readability and just update that
test?
That would be the following changes: [Drop Vec::with_capacity
pre-sizing](https://github.com/apache/datafusion/pull/17442/commits/00308e5df18a41bb9386da44cdfaa1b28ede5e09)
(added to this PR)
--
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]