dongjoon-hyun commented on a change in pull request #24637: [SPARK-27707][SQL]
Prune unnecessary nested fields from Generate to address performance issue in
explode
URL: https://github.com/apache/spark/pull/24637#discussion_r285429576
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala
##########
@@ -130,6 +130,18 @@ object MiscBenchmark extends SqlBasedBenchmark {
df.selectExpr("*", "explode(arr) as arr_col")
.select("col", "arr_col.*").count
}
+
+ codegenBenchmark("generate big nested struct array", M) {
+ import spark.implicits._
+ val df = spark.sparkContext.parallelize(Seq(("1",
+ Array.fill(M)({
+ val i = math.random
+ (i.toString, (i + 1).toString, (i + 2).toString, (i + 3).toString)
+ })))).toDF("col", "arr")
+ .selectExpr("col", "struct(col, arr) as st")
+ .selectExpr("col", "st.col as col1", "explode(st.arr) as arr_col")
+ df.collect()
+ }
Review comment:
Please add benchmark result in this PR.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]