[ 
https://issues.apache.org/jira/browse/SPARK-6748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cheng Lian resolved SPARK-6748.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 1.4.0

Issue resolved by pull request 5398
[https://github.com/apache/spark/pull/5398]

> QueryPlan.schema should be a lazy val to avoid creating excessive duplicate 
> StructType objects
> ----------------------------------------------------------------------------------------------
>
>                 Key: SPARK-6748
>                 URL: https://issues.apache.org/jira/browse/SPARK-6748
>             Project: Spark
>          Issue Type: Bug
>    Affects Versions: 1.3.0
>            Reporter: Cheng Lian
>             Fix For: 1.4.0
>
>
> Spotted this issue while trying to do a simple micro benchmark:
> {code}
> sc.parallelize(1 to 10000000).
>   map(i => (i, s"val_$i")).
>   toDF("key", "value").
>   saveAsParquetFile("file:///tmp/src.parquet")
> sqlContext.parquetFile("file:///tmp/src.parquet").collect()
> {code}
> YJP profiling result showed that, *10 million {{StructType}}, 10 million 
> {{StructField \[\]}}, and 20 million {{StructField}} were allocated*.
> It turned out that {{DataFrame.collect()}} calls 
> {{SparkPlan.executeCollect()}}, which consists of a single line:
> {code}
> execute().map(ScalaReflection.convertRowToScala(_, schema)).collect()
> {code}
> The problem is that, {{QueryPlan.schema}} is a function, and since 1.3.0, 
> {{convertRowToScala}} starts returning a {{GenericRowWithSchema}}. These two 
> facts result in 10 million rows, each with a separate schema object.



--
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