[ 
https://issues.apache.org/jira/browse/SPARK-16664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15388209#comment-15388209
 ] 

Dongjoon Hyun commented on SPARK-16664:
---------------------------------------

It looks like that. FYI, here is the result of current master. As you said, 
it's really 1.6.2 specific.
{code}
scala> import org.apache.spark.sql.types._
scala> val size = 200
scala> val rdd: org.apache.spark.rdd.RDD[Seq[Long]] = 
spark.sparkContext.parallelize(Seq(Seq.range(0, size)))
scala> val rowRdd = rdd.map(d => org.apache.spark.sql.Row.fromSeq(d))
scala> val schemas = List.range(0, size).map(a => StructField("name" + a, 
LongType, true))
scala> val testDf = spark.createDataFrame(rowRdd, StructType(schemas))
scala> testDf.persist().take(1)
res0: Array[org.apache.spark.sql.Row] = 
Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199])
{code}

> Spark 1.6.2 - Persist call on Data frames with more than 200 columns is 
> wiping out the data.
> --------------------------------------------------------------------------------------------
>
>                 Key: SPARK-16664
>                 URL: https://issues.apache.org/jira/browse/SPARK-16664
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 1.6.2
>            Reporter: Satish Kolli
>            Priority: Blocker
>
> Calling persist on a data frame with more than 200 columns is removing the 
> data from the data frame. This is an issue in Spark 1.6.2. Works with out any 
> issues in Spark 1.6.1
> Following test case demonstrates problem. Please let me know if you need any 
> additional information. Thanks.
> {code}
> import org.apache.spark._
> import org.apache.spark.rdd.RDD
> import org.apache.spark.sql.types._
> import org.apache.spark.sql.{Row, SQLContext}
> import org.scalatest.FunSuite
> class TestSpark162_1 extends FunSuite {
>   test("test data frame with 200 columns") {
>     val sparkConfig = new SparkConf()
>     val parallelism = 5
>     sparkConfig.set("spark.default.parallelism", s"$parallelism")
>     sparkConfig.set("spark.sql.shuffle.partitions", s"$parallelism")
>     val sc = new SparkContext(s"local[3]", "TestNestedJson", sparkConfig)
>     val sqlContext = new SQLContext(sc)
>     // create dataframe with 200 columns and fake 200 values
>     val size = 200
>     val rdd: RDD[Seq[Long]] = sc.parallelize(Seq(Seq.range(0, size)))
>     val rowRdd: RDD[Row] = rdd.map(d => Row.fromSeq(d))
>     val schemas = List.range(0, size).map(a => StructField("name"+ a, 
> LongType, true))
>     val testSchema = StructType(schemas)
>     val testDf = sqlContext.createDataFrame(rowRdd, testSchema)
>     // test value
>     assert(testDf.persist.take(1).apply(0).toSeq(100).asInstanceOf[Long] == 
> 100)
>     sc.stop()
>   }
>   test("test data frame with 201 columns") {
>     val sparkConfig = new SparkConf()
>     val parallelism = 5
>     sparkConfig.set("spark.default.parallelism", s"$parallelism")
>     sparkConfig.set("spark.sql.shuffle.partitions", s"$parallelism")
>     val sc = new SparkContext(s"local[3]", "TestNestedJson", sparkConfig)
>     val sqlContext = new SQLContext(sc)
>     // create dataframe with 201 columns and fake 201 values
>     val size = 201
>     val rdd: RDD[Seq[Long]] = sc.parallelize(Seq(Seq.range(0, size)))
>     val rowRdd: RDD[Row] = rdd.map(d => Row.fromSeq(d))
>     val schemas = List.range(0, size).map(a => StructField("name"+ a, 
> LongType, true))
>     val testSchema = StructType(schemas)
>     val testDf = sqlContext.createDataFrame(rowRdd, testSchema)
>     // test value
>     assert(testDf.persist.take(1).apply(0).toSeq(100).asInstanceOf[Long] == 
> 100)
>     sc.stop()
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to