[
https://issues.apache.org/jira/browse/SPARK-11990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15026876#comment-15026876
]
Yi Tian commented on SPARK-11990:
---------------------------------
I found TRACE logs like this:
{code}
=== Applying Rule org.apache.spark.sql.catalyst.optimizer.ProjectCollapsing ===
!Project [a#1,arr#2,e0#3,arr#2[1] AS e1#4]
Project [_1#0 AS a#1,UDF(_1#0) AS arr#2,UDF(_1#0)[0] AS
e0#3,UDF(_1#0)[1] AS e1#4]
! Project [a#1,arr#2,arr#2[0] AS e0#3]
LogicalRDD [_1#0], MapPartitionsRDD[1] at
stringRddToDataFrameHolder at SparkBug.scala:22
! Project [a#1,UDF(a#1) AS arr#2]
! Project [_1#0 AS a#1]
! LogicalRDD [_1#0], MapPartitionsRDD[1] at stringRddToDataFrameHolder at
SparkBug.scala:22
{code}
> DataFrame recompute UDF in some situation.
> ------------------------------------------
>
> Key: SPARK-11990
> URL: https://issues.apache.org/jira/browse/SPARK-11990
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.5.1
> Reporter: Yi Tian
>
> Here is codes for reproducing this problem:
> {code}
> val mkArrayUDF = org.apache.spark.sql.functions.udf[Array[String],String]
> ((s: String) => {
> println("udf called")
> Array[String](s+"_part1", s+"_part2")
> })
>
> val df = sc.parallelize(Seq(("a"))).toDF("a")
> val df2 = df.withColumn("arr",mkArrayUDF(df("a")))
> val df3 = df2.withColumn("e0", df2("arr")(0)).withColumn("e1",
> df2("arr")(1))
> df3.collect().foreach(println)
> {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]