jaceklaskowski commented on a change in pull request #31296:
URL: https://github.com/apache/spark/pull/31296#discussion_r566453163
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
##########
@@ -2007,6 +2007,54 @@ class DatasetSuite extends QueryTest
checkAnswer(withUDF, Row(Row(1), null, null) :: Row(Row(1), null, null) ::
Nil)
}
+
+ test("SPARK-34205: Pipe Dataset") {
+ assume(TestUtils.testCommandAvailable("cat"))
+
+ val nums = spark.range(4)
+ val piped = nums.pipe("cat", (l, printFunc) => printFunc(l.toString)).toDF
+
+ checkAnswer(piped, Row("0") :: Row("1") :: Row("2") :: Row("3") :: Nil)
+
+ val piped2 = nums.pipe("wc -l", (l, printFunc) =>
printFunc(l.toString)).toDF.collect()
Review comment:
nit: Why `toDF`?
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
##########
@@ -2007,6 +2007,54 @@ class DatasetSuite extends QueryTest
checkAnswer(withUDF, Row(Row(1), null, null) :: Row(Row(1), null, null) ::
Nil)
}
+
+ test("SPARK-34205: Pipe Dataset") {
+ assume(TestUtils.testCommandAvailable("cat"))
+
+ val nums = spark.range(4)
+ val piped = nums.pipe("cat", (l, printFunc) => printFunc(l.toString)).toDF
Review comment:
nit: any reason for `toDF` (as `pipe` gives a `Dataset[String]`)?
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala
##########
@@ -1264,6 +1264,20 @@ class StreamSuite extends StreamTest {
}
}
}
+
+ test("SPARK-34205: Pipe Streaming Dataset") {
+ assume(TestUtils.testCommandAvailable("cat"))
+
+ val inputData = MemoryStream[Int]
+ val piped = inputData.toDS()
+ .pipe("cat", (n, printFunc) => printFunc(n.toString)).toDF
Review comment:
nit: Why `toDF`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]