Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/20636#discussion_r195111027
--- Diff:
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/BufferHolder.java
---
@@ -61,12 +61,15 @@
* Grows the buffer by at least neededSize and points the row to the
buffer.
*/
void grow(int neededSize) {
- if (neededSize > ARRAY_MAX - totalSize()) {
+ assert neededSize < 0 :
+ "Cannot grow BufferHolder by size " + neededSize + " because the
size is negative";
+ int roundedSize =
ByteArrayMethods.roundNumberOfBytesToNearestWord(neededSize);
--- End diff --
and we should add a comment to the `buffer` field to say that, it's
guaranteed to be word-aligned, and explain who may assume it's word-aligned.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]