Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -327,23 +327,23 @@ private String getResource(String resource) {

@Test
public void testGenericLoad() {
Dataset<Row> df1 = spark.read().format("text").load(getResource("text-suite.txt"));
Dataset<Row> df1 = spark.read().format("text").load(getResource("test-data/text-suite.txt"));
Assert.assertEquals(4L, df1.count());

Dataset<Row> df2 = spark.read().format("text").load(
getResource("text-suite.txt"),
getResource("text-suite2.txt"));
getResource("test-data/text-suite.txt"),
getResource("test-data/text-suite2.txt"));
Assert.assertEquals(5L, df2.count());
}

@Test
public void testTextLoad() {
Dataset<String> ds1 = spark.read().textFile(getResource("text-suite.txt"));
Dataset<String> ds1 = spark.read().textFile(getResource("test-data/text-suite.txt"));
Assert.assertEquals(4L, ds1.count());

Dataset<String> ds2 = spark.read().textFile(
getResource("text-suite.txt"),
getResource("text-suite2.txt"));
getResource("test-data/text-suite.txt"),
getResource("test-data/text-suite2.txt"));
Assert.assertEquals(5L, ds2.count());
}

Expand Down
Binary file removed sql/core/src/test/resources/old-repeated.parquet
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@ class DDLSuite extends QueryTest with SharedSQLContext with BeforeAndAfterEach {
}

test("create temporary view using") {
val csvFile = Thread.currentThread().getContextClassLoader.getResource("cars.csv").toString()
val csvFile =
Thread.currentThread().getContextClassLoader.getResource("test-data/cars.csv").toString
withView("testview") {
sql(s"CREATE OR REPLACE TEMPORARY VIEW testview (c1: String, c2: String) USING " +
"org.apache.spark.sql.execution.datasources.csv.CSVFileFormat " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ import org.apache.spark.sql.types._
class CSVSuite extends QueryTest with SharedSQLContext with SQLTestUtils {
import testImplicits._

private val carsFile = "cars.csv"
private val carsMalformedFile = "cars-malformed.csv"
private val carsFile8859 = "cars_iso-8859-1.csv"
private val carsTsvFile = "cars.tsv"
private val carsAltFile = "cars-alternative.csv"
private val carsUnbalancedQuotesFile = "cars-unbalanced-quotes.csv"
private val carsNullFile = "cars-null.csv"
private val carsBlankColName = "cars-blank-column-name.csv"
private val emptyFile = "empty.csv"
private val commentsFile = "comments.csv"
private val disableCommentsFile = "disable_comments.csv"
private val boolFile = "bool.csv"
private val decimalFile = "decimal.csv"
private val simpleSparseFile = "simple_sparse.csv"
private val numbersFile = "numbers.csv"
private val datesFile = "dates.csv"
private val unescapedQuotesFile = "unescaped-quotes.csv"
private val carsFile = "test-data/cars.csv"
private val carsMalformedFile = "test-data/cars-malformed.csv"
private val carsFile8859 = "test-data/cars_iso-8859-1.csv"
private val carsTsvFile = "test-data/cars.tsv"
private val carsAltFile = "test-data/cars-alternative.csv"
private val carsUnbalancedQuotesFile = "test-data/cars-unbalanced-quotes.csv"
private val carsNullFile = "test-data/cars-null.csv"
private val carsBlankColName = "test-data/cars-blank-column-name.csv"
private val emptyFile = "test-data/empty.csv"
private val commentsFile = "test-data/comments.csv"
private val disableCommentsFile = "test-data/disable_comments.csv"
private val boolFile = "test-data/bool.csv"
private val decimalFile = "test-data/decimal.csv"
private val simpleSparseFile = "test-data/simple_sparse.csv"
private val numbersFile = "test-data/numbers.csv"
private val datesFile = "test-data/dates.csv"
private val unescapedQuotesFile = "test-data/unescaped-quotes.csv"

private def testFile(fileName: String): String = {
Thread.currentThread().getContextClassLoader.getResource(fileName).toString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext {
withSQLConf(SQLConf.PARQUET_VECTORIZED_READER_ENABLED.key -> vectorized) {
checkAnswer(
// Decimal column in this file is encoded using plain dictionary
readResourceParquetFile("dec-in-i32.parquet"),
readResourceParquetFile("test-data/dec-in-i32.parquet"),
spark.range(1 << 4).select('id % 10 cast DecimalType(5, 2) as 'i32_dec))
}
}
Expand All @@ -579,7 +579,7 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext {
withSQLConf(SQLConf.PARQUET_VECTORIZED_READER_ENABLED.key -> vectorized) {
checkAnswer(
// Decimal column in this file is encoded using plain dictionary
readResourceParquetFile("dec-in-i64.parquet"),
readResourceParquetFile("test-data/dec-in-i64.parquet"),
spark.range(1 << 4).select('id % 10 cast DecimalType(10, 2) as 'i64_dec))
}
}
Expand All @@ -590,7 +590,7 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext {
withSQLConf(SQLConf.PARQUET_VECTORIZED_READER_ENABLED.key -> vectorized) {
checkAnswer(
// Decimal column in this file is encoded using plain dictionary
readResourceParquetFile("dec-in-fixed-len.parquet"),
readResourceParquetFile("test-data/dec-in-fixed-len.parquet"),
spark.range(1 << 4).select('id % 10 cast DecimalType(10, 2) as 'fixed_len_dec))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ import org.apache.spark.sql.test.SharedSQLContext

class ParquetProtobufCompatibilitySuite extends ParquetCompatibilityTest with SharedSQLContext {
test("unannotated array of primitive type") {
checkAnswer(readResourceParquetFile("old-repeated-int.parquet"), Row(Seq(1, 2, 3)))
checkAnswer(readResourceParquetFile("test-data/old-repeated-int.parquet"), Row(Seq(1, 2, 3)))
}

test("unannotated array of struct") {
checkAnswer(
readResourceParquetFile("old-repeated-message.parquet"),
readResourceParquetFile("test-data/old-repeated-message.parquet"),
Row(
Seq(
Row("First inner", null, null),
Row(null, "Second inner", null),
Row(null, null, "Third inner"))))

checkAnswer(
readResourceParquetFile("proto-repeated-struct.parquet"),
readResourceParquetFile("test-data/proto-repeated-struct.parquet"),
Row(
Seq(
Row("0 - 1", "0 - 2", "0 - 3"),
Row("1 - 1", "1 - 2", "1 - 3"))))

checkAnswer(
readResourceParquetFile("proto-struct-with-array-many.parquet"),
readResourceParquetFile("test-data/proto-struct-with-array-many.parquet"),
Seq(
Row(
Seq(
Expand All @@ -60,13 +60,13 @@ class ParquetProtobufCompatibilitySuite extends ParquetCompatibilityTest with Sh

test("struct with unannotated array") {
checkAnswer(
readResourceParquetFile("proto-struct-with-array.parquet"),
readResourceParquetFile("test-data/proto-struct-with-array.parquet"),
Row(10, 9, Seq.empty, null, Row(9), Seq(Row(9), Row(10))))
}

test("unannotated array of struct with unannotated array") {
checkAnswer(
readResourceParquetFile("nested-array-struct.parquet"),
readResourceParquetFile("test-data/nested-array-struct.parquet"),
Seq(
Row(2, Seq(Row(1, Seq(Row(3))))),
Row(5, Seq(Row(4, Seq(Row(6))))),
Expand All @@ -75,7 +75,7 @@ class ParquetProtobufCompatibilitySuite extends ParquetCompatibilityTest with Sh

test("unannotated array of string") {
checkAnswer(
readResourceParquetFile("proto-repeated-string.parquet"),
readResourceParquetFile("test-data/proto-repeated-string.parquet"),
Seq(
Row(Seq("hello", "world")),
Row(Seq("good", "bye")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import org.apache.spark.sql.test.SharedSQLContext
class ParquetThriftCompatibilitySuite extends ParquetCompatibilityTest with SharedSQLContext {
import ParquetCompatibilityTest._

private val parquetFilePath =
Thread.currentThread().getContextClassLoader.getResource("parquet-thrift-compat.snappy.parquet")
private val parquetFilePath = Thread.currentThread().getContextClassLoader.getResource(
"test-data/parquet-thrift-compat.snappy.parquet")

test("Read Parquet file generated by parquet-thrift") {
logInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TextSuite extends QueryTest with SharedSQLContext {

test("reading partitioned data using read.textFile()") {
val partitionedData = Thread.currentThread().getContextClassLoader
.getResource("text-partitioned").toString
.getResource("test-data/text-partitioned").toString
val ds = spark.read.textFile(partitionedData)
val data = ds.collect()

Expand All @@ -76,7 +76,7 @@ class TextSuite extends QueryTest with SharedSQLContext {

test("support for partitioned reading using read.text()") {
val partitionedData = Thread.currentThread().getContextClassLoader
.getResource("text-partitioned").toString
.getResource("test-data/text-partitioned").toString
val df = spark.read.text(partitionedData)
val data = df.filter("year = '2015'").select("value").collect()

Expand Down Expand Up @@ -155,7 +155,7 @@ class TextSuite extends QueryTest with SharedSQLContext {
}

private def testFile: String = {
Thread.currentThread().getContextClassLoader.getResource("text-suite.txt").toString
Thread.currentThread().getContextClassLoader.getResource("test-data/text-suite.txt").toString
}

/** Verifies data and schema. */
Expand Down