ssimeonov commented on a change in pull request #23620: [SPARK-26696][SQL] 
Makes Dataset encoder public
URL: https://github.com/apache/spark/pull/23620#discussion_r255358804
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
 ##########
 @@ -139,6 +139,14 @@ class DatasetSuite extends QueryTest with 
SharedSQLContext {
       ("a", 1), ("b", 2))
   }
 
+  test("as tuple using instance encoder") {
+    val data = Seq(("a", 1), ("b", 2), ("c", 3))
+    val ds = data.toDS()
+    checkDataset(
+      ds.toDF().as[(String, Int)](ds.encoder),
 
 Review comment:
   This is one of the simplest contrived examples I can come up with. Is that 
what you are looking for, used in a test?
   
   ```scala
   def firstRowByGroup[A](groupBy: Column)(ds: Dataset[A]): Dataset[A] =
     ds.groupBy(groupBy).agg(first(struct('*), ignoreNulls = 
true).as("row")).select("row.*").as[A](ds.encoder)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to