You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "BryanEmond (via GitHub)" <gi...@apache.org> on 2023/06/15 20:27:01 UTC

[GitHub] [arrow-datafusion] BryanEmond opened a new pull request, #6689: removed self.all_values.len() from inside reserve

BryanEmond opened a new pull request, #6689:
URL: https://github.com/apache/arrow-datafusion/pull/6689

   # 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 #123` indicates that this PR will close issue #123.
   -->
   
   Closes #6674 .
   
   # 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.  
   -->
   See #6674 
   
   # What changes are included in this PR?
   Removed self.all_values.len() from inside reserve().
   I have also looked at the two other places where reserve() is used, and they don't use the same calculation.
   https://github.com/apache/arrow-datafusion/blob/9dfaf4249e31e9a08953955fe4837eb287b089bf/datafusion/execution/src/memory_pool/proxy.rs#L41
   https://github.com/apache/arrow-datafusion/blob/9dfaf4249e31e9a08953955fe4837eb287b089bf/datafusion/execution/src/memory_pool/proxy.rs#L83
   
   <!--
   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.
   -->
   
   # Are these changes tested?
   No
   <!--
   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)?
   -->
   
   # Are there any user-facing changes?
   No
   <!--
   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.
   -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on pull request #6689: removed self.all_values.len() from inside reserve

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6689:
URL: https://github.com/apache/arrow-datafusion/pull/6689#issuecomment-1593693461

   cc @stuartcarnie 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb merged pull request #6689: removed self.all_values.len() from inside reserve

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6689:
URL: https://github.com/apache/arrow-datafusion/pull/6689


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on pull request #6689: removed self.all_values.len() from inside reserve

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6689:
URL: https://github.com/apache/arrow-datafusion/pull/6689#issuecomment-1593692025

   Thanks @BryanEmond ! I started CI


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] BryanEmond closed pull request #6689: removed self.all_values.len() from inside reserve

Posted by "BryanEmond (via GitHub)" <gi...@apache.org>.
BryanEmond closed pull request #6689: removed self.all_values.len() from inside reserve
URL: https://github.com/apache/arrow-datafusion/pull/6689


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on pull request #6689: removed self.all_values.len() from inside reserve

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6689:
URL: https://github.com/apache/arrow-datafusion/pull/6689#issuecomment-1594496264

   Thanks again @BryanEmond !


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6689: removed self.all_values.len() from inside reserve

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6689:
URL: https://github.com/apache/arrow-datafusion/pull/6689#discussion_r1231511337


##########
datafusion/physical-expr/src/aggregate/median.rs:
##########
@@ -126,7 +126,7 @@ impl Accumulator for MedianAccumulator {
         let array = &values[0];
 
         assert_eq!(array.data_type(), &self.data_type);
-        self.all_values.reserve(self.all_values.len() + array.len());
+        self.all_values.reserve(array.len());

Review Comment:
   Per the rust docs: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.reserve
   
   > Reserves capacity for at least additional more elements to be inserted in the given Vec<T>. The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.
   
   👍 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org