|
17 | 17 |
|
18 | 18 | package org.apache.spark.sql.api.java;
|
19 | 19 |
|
20 |
| -import java.io.File; |
21 | 20 | import java.io.Serializable;
|
22 | 21 | import java.math.BigDecimal;
|
23 | 22 | import java.util.ArrayList;
|
24 | 23 | import java.util.Arrays;
|
25 | 24 | import java.util.List;
|
26 | 25 |
|
27 |
| -import com.google.common.io.Files; |
28 | 26 | import org.junit.After;
|
29 | 27 | import org.junit.Assert;
|
30 | 28 | import org.junit.Before;
|
|
36 | 34 | import org.apache.spark.api.java.JavaRDD;
|
37 | 35 | import org.apache.spark.api.java.JavaSparkContext;
|
38 | 36 | import org.apache.spark.api.java.function.Function;
|
39 |
| -import org.apache.spark.sql.test.TestSQLContext; |
40 | 37 |
|
41 | 38 | // The test suite itself is Serializable so that anonymous Function implementations can be
|
42 | 39 | // serialized, as an alternative to converting these anonymous classes to static inner classes;
|
43 | 40 | // see http://stackoverflow.com/questions/758570/.
|
44 | 41 | public class JavaApplySchemaSuite implements Serializable {
|
45 | 42 | private transient JavaSparkContext javaCtx;
|
46 | 43 | private transient JavaSQLContext javaSqlCtx;
|
47 |
| - private transient File tempDir; |
48 | 44 |
|
49 | 45 | @Before
|
50 | 46 | public void setUp() {
|
51 |
| - javaCtx = new JavaSparkContext(TestSQLContext.sparkContext()); |
| 47 | + javaCtx = new JavaSparkContext("local", "JavaApplySchemaSuite"); |
52 | 48 | javaSqlCtx = new JavaSQLContext(javaCtx);
|
53 |
| - tempDir = Files.createTempDir(); |
54 |
| - tempDir.deleteOnExit(); |
55 | 49 | }
|
56 | 50 |
|
57 | 51 | @After
|
@@ -135,7 +129,7 @@ public void applySchemaToJSON() {
|
135 | 129 | fields.add(DataType.createStructField("null", DataType.StringType, true));
|
136 | 130 | fields.add(DataType.createStructField("string", DataType.StringType, true));
|
137 | 131 | StructType expectedSchema = DataType.createStructType(fields);
|
138 |
| - List<Row> expectedResult = new ArrayList<Row>(1); |
| 132 | + List<Row> expectedResult = new ArrayList<Row>(2); |
139 | 133 | expectedResult.add(
|
140 | 134 | Row.create(
|
141 | 135 | new BigDecimal("92233720368547758070"),
|
|
0 commit comments