You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "hvanhovell (via GitHub)" <gi...@apache.org> on 2023/02/16 02:53:37 UTC

[GitHub] [spark] hvanhovell commented on a diff in pull request #40048: [SPARK-42460][CONNECT] Clean-up results in ClientE2ETestSuite

hvanhovell commented on code in PR #40048:
URL: https://github.com/apache/spark/pull/40048#discussion_r1107952394


##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala:
##########
@@ -32,40 +32,44 @@ class ClientE2ETestSuite extends RemoteSparkSession {
   // Spark Result
   test("spark result schema") {
     val df = spark.sql("select val from (values ('Hello'), ('World')) as t(val)")
-    val schema = df.collectResult().schema
-    assert(schema == StructType(StructField("val", StringType, false) :: Nil))
+    df.withResult { result =>
+      val schema = result.schema
+      assert(schema == StructType(StructField("val", StringType, nullable = false) :: Nil))
+    }
   }
 
   test("spark result array") {
     val df = spark.sql("select val from (values ('Hello'), ('World')) as t(val)")
-    val result = df.collectResult()
-    assert(result.length == 2)
-    val array = result.toArray
-    assert(array.length == 2)
-    assert(array(0).getString(0) == "Hello")
-    assert(array(1).getString(0) == "World")
+    df.withResult { result =>

Review Comment:
   we could also use df.collect() here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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