Repository: spark
Updated Branches:
  refs/heads/master 8135e0e5e -> 7c7586aef


[SPARK-17652] Fix confusing exception message while reserving capacity

## What changes were proposed in this pull request?

This minor patch fixes a confusing exception message while reserving additional 
capacity in the vectorized parquet reader.

## How was this patch tested?

Exisiting Unit Tests

Author: Sameer Agarwal <[email protected]>

Closes #15225 from sameeragarwal/error-msg.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7c7586ae
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7c7586ae
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7c7586ae

Branch: refs/heads/master
Commit: 7c7586aef9243081d02ea5065435234b5950ab66
Parents: 8135e0e
Author: Sameer Agarwal <[email protected]>
Authored: Mon Sep 26 13:21:08 2016 -0700
Committer: Yin Huai <[email protected]>
Committed: Mon Sep 26 13:21:08 2016 -0700

----------------------------------------------------------------------
 .../spark/sql/execution/vectorized/ColumnVector.java  | 14 +++++++-------
 .../sql/execution/vectorized/ColumnarBatchSuite.scala |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7c7586ae/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
----------------------------------------------------------------------
diff --git 
a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
 
b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
index a7cb3b1..ff07940 100644
--- 
a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
+++ 
b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
@@ -285,19 +285,19 @@ public abstract class ColumnVector implements 
AutoCloseable {
         try {
           reserveInternal(newCapacity);
         } catch (OutOfMemoryError outOfMemoryError) {
-          throwUnsupportedException(newCapacity, requiredCapacity, 
outOfMemoryError);
+          throwUnsupportedException(requiredCapacity, outOfMemoryError);
         }
       } else {
-        throwUnsupportedException(newCapacity, requiredCapacity, null);
+        throwUnsupportedException(requiredCapacity, null);
       }
     }
   }
 
-  private void throwUnsupportedException(int newCapacity, int 
requiredCapacity, Throwable cause) {
-    String message = "Cannot reserve more than " + newCapacity +
-        " bytes in the vectorized reader (requested = " + requiredCapacity + " 
bytes). As a" +
-        " workaround, you can disable the vectorized reader by setting "
-        + SQLConf.PARQUET_VECTORIZED_READER_ENABLED().key() + " to false.";
+  private void throwUnsupportedException(int requiredCapacity, Throwable 
cause) {
+    String message = "Cannot reserve additional contiguous bytes in the 
vectorized reader " +
+        "(requested = " + requiredCapacity + " bytes). As a workaround, you 
can disable the " +
+        "vectorized reader by setting " + 
SQLConf.PARQUET_VECTORIZED_READER_ENABLED().key() +
+        " to false.";
 
     if (cause != null) {
       throw new RuntimeException(message, cause);

http://git-wip-us.apache.org/repos/asf/spark/blob/7c7586ae/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
index 100cc4d..e3943f3 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
@@ -802,8 +802,8 @@ class ColumnarBatchSuite extends SparkFunSuite {
         // Over-allocating beyond MAX_CAPACITY throws an exception
         column.appendBytes(10, 0.toByte)
       }
-      assert(ex.getMessage.contains(s"Cannot reserve more than 
${column.MAX_CAPACITY} bytes in " +
-        s"the vectorized reader"))
+      assert(ex.getMessage.contains(s"Cannot reserve additional contiguous 
bytes in the " +
+        s"vectorized reader"))
     }
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to