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

    https://github.com/apache/spark/pull/13727#discussion_r67576047
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
 ---
    @@ -228,4 +220,101 @@ class DataFrameReaderWriterSuite extends QueryTest 
with SharedSQLContext {
           }
         }
       }
    +
    +  test("load API") {
    +    spark.read.format("org.apache.spark.sql.test").load()
    +    spark.read.format("org.apache.spark.sql.test").load(input)
    +    spark.read.format("org.apache.spark.sql.test").load(input, input, 
input)
    +    spark.read.format("org.apache.spark.sql.test").load(Seq(input, input): 
_*)
    +    Option(input).map(spark.read.format("org.apache.spark.sql.test").load)
    +  }
    +
    +  test("text - API and common behavior") {
    +    // Reader, without user specified schema
    +    assert(spark.read.text().schema === textSchema)
    +    assert(spark.read.text(input).schema === textSchema)
    +    assert(spark.read.text(input, input, input).schema === textSchema)
    +    assert(spark.read.text(Seq(input, input): _*).schema === textSchema)
    +    assert(Option(input).map(spark.read.text).get.schema === textSchema) 
// SPARK-16009
    +
    +    // Reader, with user specified schema
    +    assert(spark.read.schema(userSchema).text().schema === userSchema)
    +    assert(spark.read.schema(userSchema).text(input).schema === userSchema)
    +    assert(spark.read.schema(userSchema).text(input, input, input).schema 
=== userSchema)
    +    assert(spark.read.schema(userSchema).text(Seq(input, input): 
_*).schema === userSchema)
    +
    +    // Writer
    +    spark.read.text().write.text(output)
    +  }
    +
    +  test("textFile - API and common behavior") {
    +    // Reader, without user specified schema
    +    assert(spark.read.textFile().schema === textSchema)
    +    assert(spark.read.textFile(input).schema === textSchema)
    +    assert(spark.read.textFile(input, input, input).schema === textSchema)
    +    assert(spark.read.textFile(Seq(input, input): _*).schema === 
textSchema)
    +    assert(Option(input).map(spark.read.textFile).get.schema === 
textSchema) // SPARK-16009
    +  }
    +
    +  test("csv - API and common behavior") {
    +    // Reader, with user specified schema
    +    // Refer to csv-specific test suites for behavior without user 
specified schema
    +    assert(spark.read.schema(userSchema).csv().schema === userSchema)
    +    assert(spark.read.schema(userSchema).csv(input).schema === userSchema)
    +    assert(spark.read.schema(userSchema).csv(input, input, input).schema 
=== userSchema)
    +    assert(spark.read.schema(userSchema).csv(Seq(input, input): _*).schema 
=== userSchema)
    +
    +    // Test explicit calls to single arg method - SPARK-16009
    +    assert(Option(input).map(spark.read.schema(userSchema).csv).get.schema 
=== userSchema)
    +
    +    // Writer
    +    spark.range(10).write.csv(output)
    +  }
    +
    +  test("json - API and common behavior") {
    +    // Reader, with user specified schema
    +    // Refer to csv-specific test suites for behavior without user 
specified schema
    +    assert(spark.read.schema(userSchema).json().schema === userSchema)
    +    assert(spark.read.schema(userSchema).json(input).schema === userSchema)
    +    assert(spark.read.schema(userSchema).json(input, input, input).schema 
=== userSchema)
    +    assert(spark.read.schema(userSchema).json(Seq(input, input): 
_*).schema === userSchema)
    +
    +    // Test explicit calls to single arg method - SPARK-16009
    +    
assert(Option(input).map(spark.read.schema(userSchema).json).get.schema === 
userSchema)
    +
    +    // Writer
    +    spark.range(10).write.json(output)
    +  }
    +
    +  test("parquet - API and common behavior") {
    +    // Reader, with user specified schema
    +    // Refer to csv-specific test suites for behavior without user 
specified schema
    +    assert(spark.read.schema(userSchema).parquet().schema === userSchema)
    +    assert(spark.read.schema(userSchema).parquet(input).schema === 
userSchema)
    +    assert(spark.read.schema(userSchema).parquet(input, input, 
input).schema === userSchema)
    +    assert(spark.read.schema(userSchema).parquet(Seq(input, input): 
_*).schema === userSchema)
    +
    +    // Test explicit calls to single arg method - SPARK-16009
    +    
assert(Option(input).map(spark.read.schema(userSchema).parquet).get.schema === 
userSchema)
    +
    +    // Writer
    +    spark.range(10).write.parquet(output)
    --- End diff --
    
    My goal in these tests were to test the API, and individual suites like 
CsvSuite, ParquetSuite, etc should take care of correctness. But I see your 
point, I could add a few basic tests. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to