Skip to content

Commit

Permalink
Minor updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuai committed Jul 25, 2014
1 parent 33c4fec commit d48fc7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@

package org.apache.spark.sql.api.java;

import java.io.File;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.google.common.io.Files;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -36,22 +34,18 @@
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.Function;
import org.apache.spark.sql.test.TestSQLContext;

// The test suite itself is Serializable so that anonymous Function implementations can be
// serialized, as an alternative to converting these anonymous classes to static inner classes;
// see http://stackoverflow.com/questions/758570/.
public class JavaApplySchemaSuite implements Serializable {
private transient JavaSparkContext javaCtx;
private transient JavaSQLContext javaSqlCtx;
private transient File tempDir;

@Before
public void setUp() {
javaCtx = new JavaSparkContext(TestSQLContext.sparkContext());
javaCtx = new JavaSparkContext("local", "JavaApplySchemaSuite");
javaSqlCtx = new JavaSQLContext(javaCtx);
tempDir = Files.createTempDir();
tempDir.deleteOnExit();
}

@After
Expand Down Expand Up @@ -135,7 +129,7 @@ public void applySchemaToJSON() {
fields.add(DataType.createStructField("null", DataType.StringType, true));
fields.add(DataType.createStructField("string", DataType.StringType, true));
StructType expectedSchema = DataType.createStructType(fields);
List<Row> expectedResult = new ArrayList<Row>(1);
List<Row> expectedResult = new ArrayList<Row>(2);
expectedResult.add(
Row.create(
new BigDecimal("92233720368547758070"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.Map;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.Test;

public class JavaRowSuite {
Expand All @@ -41,7 +41,7 @@ public class JavaRowSuite {
private byte[] binaryValue;
private Timestamp timestampValue;

@BeforeClass
@Before
public void setUp() {
byteValue = (byte)127;
shortValue = (short)32767;
Expand Down

0 comments on commit d48fc7b

Please sign in to comment.