[GitHub] spark pull request #20035: Enable to execute generated code of function in G...
Github user kiszk commented on a diff in the pull request: https://github.com/apache/spark/pull/20035#discussion_r158029035 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala --- @@ -214,11 +214,15 @@ case class Stack(children: Seq[Expression]) extends Generator { // Create the collection. val wrapperClass = classOf[mutable.WrappedArray[_]].getName -ctx.addMutableState( +val wrappedArray = ctx.addMutableState( s"$wrapperClass", - ev.value, - v => s"$v = $wrapperClass$$.MODULE$$.make($rowData);", useFreshName = false) -ev.copy(code = code, isNull = "false") + "stackWrappedArray", + v => s"$v = $wrapperClass$$.MODULE$$.make($rowData);") +ev.copy(code = + s""" + |$code + |$wrapperClass ${ev.value} = $wrappedArray; + """.stripMargin, isNull = "false") --- End diff -- This change does not use `inline = true` for correct code generation. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #20035: Enable to execute generated code of function in G...
GitHub user kiszk opened a pull request: https://github.com/apache/spark/pull/20035 Enable to execute generated code of function in Generator ## What changes were proposed in this pull request? This PR enables to execute generated code of `Explode`, PosExplode`, `Inline`, and `Stack` in Generator while `doGenCode` has been implemented. This PR also fixes to generate incorrect code for `Stack` ## How was this patch tested? Existing test suites You can merge this pull request into a Git repository by running: $ git pull https://github.com/kiszk/spark SPARK-22848 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/20035.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #20035 commit 2b65856b78d663564a876f601d2f3bdfc7f353a6 Author: Kazuaki IshizakiDate: 2017-12-20T13:51:39Z initial commit --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org