itholic commented on a change in pull request #32053:
URL: https://github.com/apache/spark/pull/32053#discussion_r608347059
##########
File path:
examples/src/main/scala/org/apache/spark/examples/sql/SQLDataSourceExample.scala
##########
@@ -309,6 +310,67 @@ object SQLDataSourceExample {
// $example off:csv_dataset$
}
+ private def runTextDatasetExample(spark: SparkSession): Unit = {
+ // $example on:text_dataset$
+ // A text dataset is pointed to by path.
+ // The path can be either a single text file or a directory of text files
+ val path = "examples/src/main/resources/people.txt"
+
+ val df1 = spark.read.text(path)
+ df1.show()
+ // +-----------+
+ // | value|
+ // +-----------+
+ // |Michael, 29|
+ // | Andy, 30|
+ // | Justin, 19|
+ // +-----------+
+
+ // You can use 'lineSep' option to define the line separator.
+ // If None is set, the line separator handles all `\r`, `\r\n` and `\n` by
default.
Review comment:
Thanks!
--
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]