You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/07/07 12:39:45 UTC
[GitHub] [arrow] mr-smidge opened a new pull request #7657: ARROW-8886: [C#] Resize to negative length no longer permitted
mr-smidge opened a new pull request #7657:
URL: https://github.com/apache/arrow/pull/7657
The C# implementation of buffer builders previously accepted a negative length to the `Resize()` method, and clamped it to zero. However, based on [comments by the original author of that code](https://github.com/apache/arrow/pull/7158#discussion_r437589084) @chutchinson , this behaviour is being changed to disallow negative lengths:
> It's hard to say why I chose this behavior; this was written over a year ago. I can only imagine my thought process was that the capacity "can't go any lower", and avoiding the costs that come with throwing an exception.
>
> The unit test existed to verify the behavior as written, not necessarily to satisfy requirements, which I would agree was misguided.
>
> My current stance would be to match the behavior of the more mature implementations, and throw **ArgumentOutOfRangeException**. I tend to prefer avoiding exceptions and bounds checking where possible, but as a consumer I could understand being surprised to find that passing a negative capacity results in an empty buffer. I'm not sure I would expect this method in a situation where the bounds checking or exception stack unwinding would be harmful enough to be undesirable.
The new behaviour is in line with the [behaviour in the C++ Arrow implementation](https://github.com/apache/arrow/blob/master/cpp/src/arrow/array/builder_base.h#L190), and indeed library functions like [`System.Array.Resize<T>()`](https://docs.microsoft.com/en-us/dotnet/api/system.array.resize?view=netcore-3.1).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #7657: ARROW-8886: [C#] Resize to negative length no longer permitted
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7657:
URL: https://github.com/apache/arrow/pull/7657#issuecomment-654832532
https://issues.apache.org/jira/browse/ARROW-8886
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wesm commented on pull request #7657: ARROW-8886: [C#] Resize to negative length no longer permitted
Posted by GitBox <gi...@apache.org>.
wesm commented on pull request #7657:
URL: https://github.com/apache/arrow/pull/7657#issuecomment-656369641
@eerhardt?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] eerhardt closed pull request #7657: ARROW-8886: [C#] Resize to negative length no longer permitted
Posted by GitBox <gi...@apache.org>.
eerhardt closed pull request #7657:
URL: https://github.com/apache/arrow/pull/7657
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org