You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by da...@apache.org on 2015/07/09 18:57:23 UTC

spark git commit: [SPARK-8940] [SPARKR] Don't overwrite given schema in createDataFrame

Repository: spark
Updated Branches:
  refs/heads/master a1964e9d9 -> 59cc38944


[SPARK-8940] [SPARKR] Don't overwrite given schema in createDataFrame

JIRA: https://issues.apache.org/jira/browse/SPARK-8940

The given `schema` parameter will be overwritten in `createDataFrame` now. If it is not null, we shouldn't overwrite it.

Author: Liang-Chi Hsieh <vi...@appier.com>

Closes #7311 from viirya/df_not_overwrite_schema and squashes the following commits:

2385139 [Liang-Chi Hsieh] Don't overwrite given schema if it is not null.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/59cc3894
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/59cc3894
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/59cc3894

Branch: refs/heads/master
Commit: 59cc38944fe5c1dffc6551775bd939e2ac66c65e
Parents: a1964e9
Author: Liang-Chi Hsieh <vi...@appier.com>
Authored: Thu Jul 9 09:57:12 2015 -0700
Committer: Davies Liu <da...@gmail.com>
Committed: Thu Jul 9 09:57:12 2015 -0700

----------------------------------------------------------------------
 R/pkg/R/SQLContext.R | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/59cc3894/R/pkg/R/SQLContext.R
----------------------------------------------------------------------
diff --git a/R/pkg/R/SQLContext.R b/R/pkg/R/SQLContext.R
index 9a743a3..30978bb 100644
--- a/R/pkg/R/SQLContext.R
+++ b/R/pkg/R/SQLContext.R
@@ -86,7 +86,9 @@ infer_type <- function(x) {
 createDataFrame <- function(sqlContext, data, schema = NULL, samplingRatio = 1.0) {
   if (is.data.frame(data)) {
       # get the names of columns, they will be put into RDD
-      schema <- names(data)
+      if (is.null(schema)) {
+        schema <- names(data)
+      }
       n <- nrow(data)
       m <- ncol(data)
       # get rid of factor type


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