Skip to content

Commit

Permalink
[SPARK-23892][TEST] Improve converge and fix lint error in UTF8String…
Browse files Browse the repository at this point in the history
…-related tests

## What changes were proposed in this pull request?

This PR improves test coverage in `UTF8StringSuite` and code efficiency in `UTF8StringPropertyCheckSuite`.

This PR also fixes lint-java issue in `UTF8StringSuite` reported at [here](apache#20995 (comment))

```[ERROR] src/test/java/org/apache/spark/unsafe/types/UTF8StringSuite.java:[28,8] (imports) UnusedImports: Unused import - org.apache.spark.unsafe.Platform.```

## How was this patch tested?

Existing UT

Author: Kazuaki Ishizaki <[email protected]>

Closes apache#21000 from kiszk/SPARK-23892.
  • Loading branch information
kiszk authored and hvanhovell committed Apr 8, 2018
1 parent 6a73457 commit 710a68c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.*;

import com.google.common.collect.ImmutableMap;
import org.apache.spark.unsafe.Platform;
import org.apache.spark.unsafe.memory.ByteArrayMemoryBlock;
import org.apache.spark.unsafe.memory.OnHeapMemoryBlock;
import org.junit.Test;
Expand Down Expand Up @@ -53,8 +52,8 @@ private static void checkBasic(String str, int len) {

assertTrue(s1.contains(s2));
assertTrue(s2.contains(s1));
assertTrue(s1.startsWith(s1));
assertTrue(s1.endsWith(s1));
assertTrue(s1.startsWith(s2));
assertTrue(s1.endsWith(s2));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class UTF8StringPropertyCheckSuite extends FunSuite with GeneratorDrivenProperty
def padding(origin: String, pad: String, length: Int, isLPad: Boolean): String = {
if (length <= 0) return ""
if (length <= origin.length) {
if (length <= 0) "" else origin.substring(0, length)
origin.substring(0, length)
} else {
if (pad.length == 0) return origin
val toPad = length - origin.length
Expand Down

0 comments on commit 710a68c

Please sign in to comment.