[GitHub] spark pull request #13832: [SPARK-16123] Avoid NegativeArraySizeException wh...

2016-06-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/13832


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #13832: [SPARK-16123] Avoid NegativeArraySizeException wh...

2016-06-23 Thread sameeragarwal
Github user sameeragarwal commented on a diff in the pull request:

https://github.com/apache/spark/pull/13832#discussion_r68334002
  
--- Diff: 
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
 ---
@@ -847,6 +862,11 @@ public final int appendStruct(boolean isNull) {
   protected int capacity;
 
   /**
+   * Upper limit for the maximum capacity for this column.
+   */
+  protected int MAX_CAPACITY = Integer.MAX_VALUE;
--- End diff --

sure, let me tag it explicitly with @VisibileForTesting


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #13832: [SPARK-16123] Avoid NegativeArraySizeException wh...

2016-06-23 Thread hvanhovell
Github user hvanhovell commented on a diff in the pull request:

https://github.com/apache/spark/pull/13832#discussion_r68316556
  
--- Diff: 
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
 ---
@@ -847,6 +862,11 @@ public final int appendStruct(boolean isNull) {
   protected int capacity;
 
   /**
+   * Upper limit for the maximum capacity for this column.
+   */
+  protected int MAX_CAPACITY = Integer.MAX_VALUE;
--- End diff --

Nit: This is for testing purposes only right. We have an annotation for 
that, if I am not mistaking.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #13832: [SPARK-16123] Avoid NegativeArraySizeException wh...

2016-06-22 Thread dongjoon-hyun
Github user dongjoon-hyun commented on a diff in the pull request:

https://github.com/apache/spark/pull/13832#discussion_r68013403
  
--- Diff: 
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java
 ---
@@ -424,7 +424,9 @@ public void loadBytes(ColumnVector.Array array) {
 
   @Override
   public void reserve(int requiredCapacity) {
-if (requiredCapacity > capacity) reserveInternal(requiredCapacity * 2);
+if (requiredCapacity > capacity) {
+  reserveInternal((int) Math.min(Integer.MAX_VALUE, requiredCapacity * 
2L));
--- End diff --

Hi, @sameeragarwal .
To avoid negative value, `Math.max`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #13832: [SPARK-16123] Avoid NegativeArraySizeException wh...

2016-06-21 Thread sameeragarwal
GitHub user sameeragarwal opened a pull request:

https://github.com/apache/spark/pull/13832

[SPARK-16123] Avoid NegativeArraySizeException while reserving additional 
capacity in VectorizedColumnReader

## What changes were proposed in this pull request?

This patch fixes an overflow bug in vectorized parquet reader where both 
off-heap and on-heap variants of `ColumnVector.reserve()` can unfortunately 
overflow while reserving additional capacity during reads.

## How was this patch tested?

Manual Tests

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sameeragarwal/spark negative-array

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/13832.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #13832


commit a5ec358274f270c6edad65dc89de4181fd7d2dc9
Author: Sameer Agarwal 
Date:   2016-06-22T00:59:27Z

Avoid NegativeArraySizeException while reserving additional capacity in 
VectorizedColumnReader




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org