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

    https://github.com/apache/spark/pull/11410#discussion_r55296075
  
    --- Diff: 
repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala ---
    @@ -254,6 +254,30 @@ class ReplSuite extends SparkFunSuite {
             |import sqlContext.implicits._
             |case class TestCaseClass(value: Int)
             |sc.parallelize(1 to 10).map(x => 
TestCaseClass(x)).toDF().collect()
    +        |
    +        |// Test Dataset Serialization in the REPL
    +        |Seq(TestCaseClass(1)).toDS().collect()
    +      """.stripMargin)
    +    assertDoesNotContain("error:", output)
    +    assertDoesNotContain("Exception", output)
    +  }
    +
    +  test("Datasets and encoders") {
    +    val output = runInterpreter("local",
    +      """
    +        |import org.apache.spark.sql.functions._
    +        |import org.apache.spark.sql.Encoder
    +        |import org.apache.spark.sql.expressions.Aggregator
    +        |import org.apache.spark.sql.TypedColumn
    +        |val simpleSum = new Aggregator[Int, Int, Int] {
    +        |  def zero: Int = 0                     // The initial value.
    +        |  def reduce(b: Int, a: Int) = b + a    // Add an element to the 
running total
    +        |  def merge(b1: Int, b2: Int) = b1 + b2 // Merge intermediate 
values.
    +        |  def finish(b: Int) = b                // Return the final 
result.
    +        |}.toColumn
    +        |
    +        |val ds = Seq(1, 2, 3, 4).toDS()
    +        |ds.select(simpleSum).collect
    --- End diff --
    
    I was just thinking you do something like create a file and then make sure 
that file handle gets used in the closure.  If you got something wrong the 
second time the file is created it will fail.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to