Github user Fokko commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22399#discussion_r218078332
  
    --- Diff: 
sql/catalyst/src/test/java/org/apache/spark/sql/catalyst/expressions/RowBasedKeyValueBatchSuite.java
 ---
    @@ -356,49 +335,45 @@ public void appendRowUntilExceedingPageSize() throws 
Exception {
             Assert.assertTrue(checkValue(value1, 1, 1));
           }
           Assert.assertFalse(iterator.next());
    -    } finally {
    -      batch.close();
         }
       }
     
       @Test
       public void failureToAllocateFirstPage() throws Exception {
         memoryManager.limit(1024);
    -    RowBasedKeyValueBatch batch = RowBasedKeyValueBatch.allocate(keySchema,
    -            valueSchema, taskMemoryManager, DEFAULT_CAPACITY);
    -    try {
    +    try (RowBasedKeyValueBatch batch = 
RowBasedKeyValueBatch.allocate(keySchema,
    +            valueSchema, taskMemoryManager, DEFAULT_CAPACITY)) {
           UnsafeRow key = makeKeyRow(1, "A");
           UnsafeRow value = makeValueRow(11, 11);
           UnsafeRow ret = appendRow(batch, key, value);
           Assert.assertNull(ret);
           Assert.assertFalse(batch.rowIterator().next());
    -    } finally {
    -      batch.close();
         }
       }
     
       @Test
       public void randomizedTest() {
    -    RowBasedKeyValueBatch batch = RowBasedKeyValueBatch.allocate(keySchema,
    -            valueSchema, taskMemoryManager, DEFAULT_CAPACITY);
    -    int numEntry = 100;
    -    long[] expectedK1 = new long[numEntry];
    -    String[] expectedK2 = new String[numEntry];
    -    long[] expectedV1 = new long[numEntry];
    -    long[] expectedV2 = new long[numEntry];
    -
    -    for (int i = 0; i < numEntry; i++) {
    -      long k1 = rand.nextLong();
    -      String k2 = getRandomString(rand.nextInt(256));
    -      long v1 = rand.nextLong();
    -      long v2 = rand.nextLong();
    -      appendRow(batch, makeKeyRow(k1, k2), makeValueRow(v1, v2));
    -      expectedK1[i] = k1;
    -      expectedK2[i] = k2;
    -      expectedV1[i] = v1;
    -      expectedV2[i] = v2;
    -    }
    -    try {
    +
    --- End diff --
    
    Good one


---

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

Reply via email to