You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by li...@apache.org on 2018/02/03 04:36:32 UTC
spark git commit: [SQL] Minor doc update: Add an example in
DataFrameReader.schema
Repository: spark
Updated Branches:
refs/heads/master eaf35de24 -> 3ff83ad43
[SQL] Minor doc update: Add an example in DataFrameReader.schema
## What changes were proposed in this pull request?
This patch adds a small example to the schema string definition of schema function. It isn't obvious how to use it, so an example would be useful.
## How was this patch tested?
N/A - doc only.
Author: Reynold Xin <rx...@databricks.com>
Closes #20491 from rxin/schema-doc.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/3ff83ad4
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/3ff83ad4
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/3ff83ad4
Branch: refs/heads/master
Commit: 3ff83ad43a704cc3354ef9783e711c065e2a1a22
Parents: eaf35de
Author: Reynold Xin <rx...@databricks.com>
Authored: Fri Feb 2 20:36:27 2018 -0800
Committer: gatorsmile <ga...@gmail.com>
Committed: Fri Feb 2 20:36:27 2018 -0800
----------------------------------------------------------------------
.../src/main/scala/org/apache/spark/sql/DataFrameReader.scala | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/3ff83ad4/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala b/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
index 46b5f54..fcaf8d6 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
@@ -74,6 +74,10 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
* infer the input schema automatically from data. By specifying the schema here, the underlying
* data source can skip the schema inference step, and thus speed up data loading.
*
+ * {{{
+ * spark.read.schema("a INT, b STRING, c DOUBLE").csv("test.csv")
+ * }}}
+ *
* @since 2.3.0
*/
def schema(schemaString: String): DataFrameReader = {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org