Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21206#discussion_r185298238
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
 ---
    @@ -1333,4 +1334,19 @@ class ColumnarBatchSuite extends SparkFunSuite {
     
           column.close()
       }
    +
    +  testVector("WritableColumnVector.reserve(): requested capacity is too 
large", 1024, ByteType) {
    +    column =>
    +      val capacity = Integer.MAX_VALUE - 1
    +      val ex = intercept[RuntimeException] { column.reserve(capacity) }
    +      
assert(ex.getMessage.contains(SQLConf.PARQUET_VECTORIZED_READER_BATCH_SIZE.key))
    +      assert(ex.getMessage.contains(capacity.toString))
    +  }
    +
    +  testVector("WritableColumnVector.reserve(): requested capacity is 
negative", 1024, ByteType) {
    +    column =>
    +      val ex = intercept[RuntimeException] { column.reserve(-1) }
    +      
assert(ex.getMessage.contains(SQLConf.PARQUET_VECTORIZED_READER_BATCH_SIZE.key))
    --- End diff --
    
    I understand the underlying intention to check the actionable exception 
message, but this is a general test coverage for both Parquet and ORC. Could 
you change like the following?
    ```scala
    - val ex = intercept[RuntimeException] { column.reserve(-1) }
    - 
assert(ex.getMessage.contains(SQLConf.PARQUET_VECTORIZED_READER_BATCH_SIZE.key))
    - assert(ex.getMessage.contains("integer overflow"))
    + val m = intercept[RuntimeException] { column.reserve(-1) }.getMessage
    + assert(m.contains("Cannot reserve additional contiguous bytes in the 
vectorized reader " +
    + "(integer overflow)"))
    ```
    
    Also, you can avoid [importing 
SQLConf](https://github.com/apache/spark/pull/21206/files#diff-20b42054c777b583772d02de10a36b4bR35).


---

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

Reply via email to