You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by viirya <gi...@git.apache.org> on 2017/12/21 04:22:16 UTC

[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

GitHub user viirya opened a pull request:

    https://github.com/apache/spark/pull/20043

    [SPARK-22856][SQL] Add wrappers for codegen output and nullability

    ## What changes were proposed in this pull request?
    
    The codegen output of `Expression`, aka `ExprCode`, now encapsulates only strings of output value (`value`) and nullability (`isNull`). It makes difficulty for us to know what the output really is. I think it is better if we can add wrappers for the value and nullability that let us to easily know that.
    
    ## How was this patch tested?
    
    Existing tests.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/viirya/spark-1 SPARK-22856

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/20043.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 #20043
    
----
commit 78680cc60c27d645c349451090bfa056380e89f6
Author: Liang-Chi Hsieh <vi...@...>
Date:   2017-12-21T04:22:10Z

    Add wrappers for codegen output.

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85234 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85234/testReport)** for PR 20043 at commit [`5ace8b8`](https://github.com/apache/spark/commit/5ace8b83b7c90cd5a6a451812ac9c1087aaa1c29).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @cloud-fan Can you take a look again? Thanks.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Thanks.
    
    If we have forseen this need in near future, do we bother to combine them
    here and separate it again later?
    
    On Dec 22, 2017 12:02 PM, "Kazuaki Ishizaki" <no...@github.com>
    wrote:
    
    *@kiszk* commented on this pull request.
    ------------------------------
    
    In sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/
    expressions/codegen/CodeGenerator.scala
    <https://github.com/apache/spark/pull/20043#discussion_r158426351>:
    
    > @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result
    of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var
    value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    
    In summary, I have no strong preference.
    
    In the future, we will want to distinguish Literal and Global for some
    optimizations. This
    <https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala#L121>
    is already one of optimizations for Literal.
    
    If this PR just focuses on classifying types between arguments and
    non-arguments, it is fine to combine Literal and Global. Then, another PR
    will separate one type into Literal and Global.
    
    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    <https://github.com/apache/spark/pull/20043#discussion_r158426351>, or mute
    the thread
    <https://github.com/notifications/unsubscribe-auth/AAEM93ru1REIPBaOD4knd0BMTtWZt1TJks5tCynKgaJpZM4RJVpM>
    .



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158210849
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +case class LiteralValue(val value: String) extends ExprValue {
    +  override def toString: String = value
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(val variableName: String) extends ExprValue {
    +  override def toString: String = variableName
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(val statement: String) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String) extends ExprValue {
    --- End diff --
    
    It is considered as global variable now, as it can be accessed globally and don't/can't be parameterized.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158299679
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala ---
    @@ -321,7 +322,12 @@ case class IsNull(child: Expression) extends UnaryExpression with Predicate {
     
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         val eval = child.genCode(ctx)
    -    ExprCode(code = eval.code, isNull = "false", value = eval.isNull)
    +    val value = if ("true" == s"${eval.isNull}" || "false" == s"${eval.isNull}") {
    --- End diff --
    
    `if ("true" == eval.isNull || "false" == eval.isNull) {`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85231/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158329715
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    I think we should classify `ExprValue` by our needs, not by java definitions. Thinking about the needs, we wanna know: 1) if this value is accessible anywhere and we don't need to carry it via method parameters. 2) if this value needs to be carried with parameters, do we need to generate a parameter name or use this value directly?
    
    So basically we can combine `LiteralValue` and `GlobalValue`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by gczsjdy <gi...@git.apache.org>.
Github user gczsjdy commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @viirya Sorry I didn't quite understand, how do we easily know the value by adding wrappers? Could you explain a little bit?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85247 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85247/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).
     * This patch **fails PySpark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1139/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87844 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87844/testReport)** for PR 20043 at commit [`e530f01`](https://github.com/apache/spark/commit/e530f01f74c359aa4b21017393fd9d72d289a252).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171263916
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = variableName
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(
    +    val statement: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean", true))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean", true))
    +
    +// Represents the java type of an evaluation.
    +case class ExprType(val typeName: String, val isPrimitive: Boolean)
    --- End diff --
    
    why is this `isPrimitive` needed? If I am not wrong, we have somewhere a method to check whether a type is primitive or not. I think we can get rid of this and use that method when needed, or at least store this using that method instead of passing it every time.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Sorry I think we can't make this into Spark 2.3. Recently I'm busy with some data source v2 features that are promised for 2.3, I will come back to this after rc1. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #88887 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88887/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87843 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87843/testReport)** for PR 20043 at commit [`e530f01`](https://github.com/apache/spark/commit/e530f01f74c359aa4b21017393fd9d72d289a252).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `class LiteralValue(val value: String, val javaType: String) extends ExprValue `
      * `case class GlobalValue(val value: String, val javaType: String) extends ExprValue `


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85243 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85243/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85264 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85264/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87838/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #89056 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89056/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87765 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87765/testReport)** for PR 20043 at commit [`f59bb19`](https://github.com/apache/spark/commit/f59bb19a3fd04b24ea3077a12283777be0af437d).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `abstract class ExprValue `
      * `class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue `
      * `case class VariableValue(`
      * `case class StatementValue(`
      * `case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue `
      * `case class ExprType(val typeName: String, val isPrimitive: Boolean)`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/20043


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87958/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158299743
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala ---
    @@ -347,7 +353,14 @@ case class IsNotNull(child: Expression) extends UnaryExpression with Predicate {
     
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         val eval = child.genCode(ctx)
    -    ExprCode(code = eval.code, isNull = "false", value = s"(!(${eval.isNull}))")
    +    val value = if ("true" == s"${eval.isNull}") {
    --- End diff --
    
    ditto


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85264 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85264/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158426351
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    In summary, I have no strong preference.
    
    In the future, we will want to distinguish `Literal` and `Global` for some optimizations. [This](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala#L121) is already one of optimizations for `Literal`.
    
    If this PR just focuses on classifying types between arguments and non-arguments, it is fine to combine `Literal` and `Global`. Then, another PR will separate one type into `Literal` and `Global`. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85588/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158361160
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala ---
    @@ -321,7 +322,12 @@ case class IsNull(child: Expression) extends UnaryExpression with Predicate {
     
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         val eval = child.genCode(ctx)
    -    ExprCode(code = eval.code, isNull = "false", value = eval.isNull)
    +    val value = if ("true" == s"${eval.isNull}" || "false" == s"${eval.isNull}") {
    --- End diff --
    
    or `eval.isNull == Literal("true")`? Or even better we can create a `LiteralTrue = Literal("true")` and equivalent for false and use them?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158209659
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +case class LiteralValue(val value: String) extends ExprValue {
    +  override def toString: String = value
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(val variableName: String) extends ExprValue {
    +  override def toString: String = variableName
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(val statement: String) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String) extends ExprValue {
    --- End diff --
    
    for compacted global variables, we may get something like `arr[1]` while `arr` is a global variable. Is `arr[1]` a statement or global variable?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r159227015
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    OK let's keep it.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r169223825
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala ---
    @@ -75,7 +75,7 @@ case class BoundReference(ordinal: Int, dataType: DataType, nullable: Boolean)
                  |$javaType ${ev.value} = ${ev.isNull} ? ${ctx.defaultValue(dataType)} : ($value);
                """.stripMargin)
           } else {
    -        ev.copy(code = s"$javaType ${ev.value} = $value;", isNull = "false")
    +        ev.copy(code = s"$javaType ${ev.value} = $value;", isNull = LiteralValue("false"))
    --- End diff --
    
    I think it should be useful to the `isNull` field.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #88884 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88884/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171557192
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +
    +  def isPrimitive(ctx: CodegenContext): Boolean = javaType.isPrimitive(ctx)
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType) extends ExprValue {
    +  override def toString: String = variableName
    +  override val canDirectAccess: Boolean = false
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(
    +    val statement: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean"))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean"))
    +
    +// Represents the java type of an evaluation.
    +case class ExprType(val typeName: String) {
    +  def isPrimitive(ctx: CodegenContext): Boolean = ctx.isPrimitiveType(typeName)
    --- End diff --
    
    here following the approach in #20700 we can avoid to pass `CodegenContext` as a parameter. We can move the method to `CodeGenerator`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85231 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85231/testReport)** for PR 20043 at commit [`78680cc`](https://github.com/apache/spark/commit/78680cc60c27d645c349451090bfa056380e89f6).
     * This patch **fails PySpark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)`
      * `case class LiteralValue(var value: String) extends ExprValue `
      * `case class VariableValue(var variableName: String) extends ExprValue `
      * `case class StatementValue(var statement: String) extends ExprValue `
      * `case class GlobalValue(var value: String) extends ExprValue `
      * `case class SubExprEliminationState(isNull: ExprValue, value: ExprValue)`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87958 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87958/testReport)** for PR 20043 at commit [`c8c70a9`](https://github.com/apache/spark/commit/c8c70a9107791cdfccb48dbc729aa8b6a6e9c7ee).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85288 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85288/testReport)** for PR 20043 at commit [`53926cc`](https://github.com/apache/spark/commit/53926ccb0795c09a90ba70a5c7862ec1cb126391).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85291 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85291/testReport)** for PR 20043 at commit [`4384c84`](https://github.com/apache/spark/commit/4384c84bd039addab34ba126447462ea87e13734).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @viirya big fan of this change! More structure will make code gen easier & safer to implement. I think we should merge this as is, and then I think it might be good to start adding types to the values, and to make the `CodeGenerator` and the `CodegenContext` work directly with these values.
    
    Since I merged @kiszk PR just now, can you update? I am sorry for the hassle.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1197/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @rednaxelafx Thanks! Yeah, let's revisit this after 2.3.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Thanks @HyukjinKwon 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87838 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87838/testReport)** for PR 20043 at commit [`0841c4a`](https://github.com/apache/spark/commit/0841c4afdb1808e3a1281d7612d1954b486c22dd).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class ExprType(val typeName: String) `


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87754 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87754/testReport)** for PR 20043 at commit [`f59bb19`](https://github.com/apache/spark/commit/f59bb19a3fd04b24ea3077a12283777be0af437d).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85232 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85232/testReport)** for PR 20043 at commit [`d5c986a`](https://github.com/apache/spark/commit/d5c986a1cab410c4eb64a72119346875d7607be6).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171443786
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = variableName
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(
    +    val statement: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean", true))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean", true))
    +
    +// Represents the java type of an evaluation.
    +case class ExprType(val typeName: String, val isPrimitive: Boolean)
    --- End diff --
    
    Here the idea is to include java type information for an evaluation. Then we don't need to consult `CodegenContext`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85232/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85241 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85241/testReport)** for PR 20043 at commit [`d120750`](https://github.com/apache/spark/commit/d120750ff61bb066e7ceb628f3356fa37af462f5).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85243 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85243/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by gczsjdy <gi...@git.apache.org>.
Github user gczsjdy commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @viirya Thanks much. Actually local variable corresponds to `VariableValue` and `StatementValue`? IIUC `VariableValue` is value that depends on something else, but what is `StatementValue`? Maybe we can add more comments near the `xxValue` definition.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85255/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85232 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85232/testReport)** for PR 20043 at commit [`d5c986a`](https://github.com/apache/spark/commit/d5c986a1cab410c4eb64a72119346875d7607be6).
     * This patch **fails PySpark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)`
      * `case class LiteralValue(val value: String) extends ExprValue `
      * `case class VariableValue(val variableName: String) extends ExprValue `
      * `case class StatementValue(val statement: String) extends ExprValue `
      * `case class GlobalValue(val value: String) extends ExprValue `
      * `case class SubExprEliminationState(isNull: ExprValue, value: ExprValue)`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158403352
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    @kiszk WDYT?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #89056 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89056/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87843 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87843/testReport)** for PR 20043 at commit [`e530f01`](https://github.com/apache/spark/commit/e530f01f74c359aa4b21017393fd9d72d289a252).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87810/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #89065 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89065/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85241 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85241/testReport)** for PR 20043 at commit [`d120750`](https://github.com/apache/spark/commit/d120750ff61bb066e7ceb628f3356fa37af462f5).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    cc @kiszk @cloud-fan 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85234 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85234/testReport)** for PR 20043 at commit [`5ace8b8`](https://github.com/apache/spark/commit/5ace8b83b7c90cd5a6a451812ac9c1087aaa1c29).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)`
      * `case class LiteralValue(val value: String) extends ExprValue `
      * `case class VariableValue(val variableName: String) extends ExprValue `
      * `case class StatementValue(val statement: String) extends ExprValue `
      * `case class GlobalValue(val value: String) extends ExprValue `
      * `case class SubExprEliminationState(isNull: ExprValue, value: ExprValue)`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @gczsjdy By this, we can easily know what the output is. Is it a global variable, a local variable or a literal? For now, we just get a string. It makes us hard to act according to the type of codegen output. It's also hard to search the codes to find out where we output global variable, local variable or literal, BTW.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    LGTM


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89065/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Spark 2.3 should be ready soon, let's resume this PR :) 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87765 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87765/testReport)** for PR 20043 at commit [`f59bb19`](https://github.com/apache/spark/commit/f59bb19a3fd04b24ea3077a12283777be0af437d).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #88884 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88884/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158400953
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala ---
    @@ -118,10 +118,10 @@ abstract class Expression extends TreeNode[Expression] {
       private def reduceCodeSize(ctx: CodegenContext, eval: ExprCode): Unit = {
         // TODO: support whole stage codegen too
         if (eval.code.trim.length > 1024 && ctx.INPUT_ROW != null && ctx.currentVars == null) {
    -      val setIsNull = if (eval.isNull != "false" && eval.isNull != "true") {
    +      val setIsNull = if ("false" != s"${eval.isNull}" && "true" != s"${eval.isNull}") {
    --- End diff --
    
    oh, yea.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87754/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87765/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85288/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #89065 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89065/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89056/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158328435
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala ---
    @@ -118,10 +118,10 @@ abstract class Expression extends TreeNode[Expression] {
       private def reduceCodeSize(ctx: CodegenContext, eval: ExprCode): Unit = {
         // TODO: support whole stage codegen too
         if (eval.code.trim.length > 1024 && ctx.INPUT_ROW != null && ctx.currentVars == null) {
    -      val setIsNull = if (eval.isNull != "false" && eval.isNull != "true") {
    +      val setIsNull = if ("false" != s"${eval.isNull}" && "true" != s"${eval.isNull}") {
    --- End diff --
    
    this can be simplified to `!eval.isNull.instanceOf[LiteralValue]`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    ping @cloud-fan 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158403030
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala ---
    @@ -321,7 +322,12 @@ case class IsNull(child: Expression) extends UnaryExpression with Predicate {
     
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         val eval = child.genCode(ctx)
    -    ExprCode(code = eval.code, isNull = "false", value = eval.isNull)
    +    val value = if ("true" == s"${eval.isNull}" || "false" == s"${eval.isNull}") {
    --- End diff --
    
    We can do `eval.isNull.instanceOf[LiteralValue]` as suggested by @cloud-fan below.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Sure. No problem.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171536167
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    --- End diff --
    
    Ok. I'd let it as fixed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r169317284
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala ---
    @@ -75,7 +75,7 @@ case class BoundReference(ordinal: Int, dataType: DataType, nullable: Boolean)
                  |$javaType ${ev.value} = ${ev.isNull} ? ${ctx.defaultValue(dataType)} : ($value);
                """.stripMargin)
           } else {
    -        ev.copy(code = s"$javaType ${ev.value} = $value;", isNull = "false")
    +        ev.copy(code = s"$javaType ${ev.value} = $value;", isNull = LiteralValue("false"))
    --- End diff --
    
    Looks like a good idea.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158401512
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    For now `LiteralValue` and `GlobalValue` can be seen as the same effectively, as they are all accessible anywhere and we don't need to carry it via method parameters.
    
    I don't have strong preference here.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158361417
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    IMHO I prefer this approach because in the future we might need to distinguish these two cases, thus I think is a good thing to let them be distinct.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by rednaxelafx <gi...@git.apache.org>.
Github user rednaxelafx commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Hi @viirya, this PR is definitely onto the right direction. I'd like to review this PR as well and hopeful help polish it in for post-2.3. Thanks for your work!


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171268197
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala ---
    @@ -22,7 +22,7 @@ import scala.collection.mutable.ArrayBuffer
     import org.apache.spark.rdd.RDD
     import org.apache.spark.sql.catalyst.InternalRow
     import org.apache.spark.sql.catalyst.expressions._
    -import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
    +import org.apache.spark.sql.catalyst.expressions.codegen._
    --- End diff --
    
    ditto


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1192/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87810 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87810/testReport)** for PR 20043 at commit [`37ae9b0`](https://github.com/apache/spark/commit/37ae9b0e217de323dbc73c9e1247ebe9bf2c278c).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2095/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1274/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85234/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85588 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85588/testReport)** for PR 20043 at commit [`4384c84`](https://github.com/apache/spark/commit/4384c84bd039addab34ba126447462ea87e13734).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87844/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    ping @hvanhovell @cloud-fan Any more comment for this?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85591 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85591/testReport)** for PR 20043 at commit [`4384c84`](https://github.com/apache/spark/commit/4384c84bd039addab34ba126447462ea87e13734).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r169223570
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala ---
    @@ -75,7 +75,7 @@ case class BoundReference(ordinal: Int, dataType: DataType, nullable: Boolean)
                  |$javaType ${ev.value} = ${ev.isNull} ? ${ctx.defaultValue(dataType)} : ($value);
                """.stripMargin)
           } else {
    -        ev.copy(code = s"$javaType ${ev.value} = $value;", isNull = "false")
    +        ev.copy(code = s"$javaType ${ev.value} = $value;", isNull = LiteralValue("false"))
    --- End diff --
    
    nit: shall we introduce a `TrueLiteral` and `FalseLiteral`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    `StatementValue` means an output like `a + 1`. It is a java statement which doesn't rely on a local variable to hold the result.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1131/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171556576
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -70,13 +72,14 @@ case class GlobalValue(val value: String, val javaType: ExprType) extends ExprVa
       override val canDirectAccess: Boolean = true
     }
     
    -case object TrueLiteral extends LiteralValue("true", ExprType("boolean", true))
    -case object FalseLiteral extends LiteralValue("false", ExprType("boolean", true))
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean"))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean"))
     
     // Represents the java type of an evaluation.
    -case class ExprType(val typeName: String, val isPrimitive: Boolean)
    +case class ExprType(val typeName: String) {
    +  def isPrimitive(ctx: CodegenContext): Boolean = ctx.isPrimitiveType(typeName)
    --- End diff --
    
    I see that @kiszk created a PR to move all the "static" methods to `CodeGenerator`. Using that approach here we do not need to pass `ctx` as an argument.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87583/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1174/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85288 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85288/testReport)** for PR 20043 at commit [`53926cc`](https://github.com/apache/spark/commit/53926ccb0795c09a90ba70a5c7862ec1cb126391).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85255 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85255/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85247/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87583 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87583/testReport)** for PR 20043 at commit [`8715d32`](https://github.com/apache/spark/commit/8715d32af9a3c834647489a2333845fb72cd45a7).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85264/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Oh, already re-testing.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/984/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Thanks! Merged to master.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87810 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87810/testReport)** for PR 20043 at commit [`37ae9b0`](https://github.com/apache/spark/commit/37ae9b0e217de323dbc73c9e1247ebe9bf2c278c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85291 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85291/testReport)** for PR 20043 at commit [`4384c84`](https://github.com/apache/spark/commit/4384c84bd039addab34ba126447462ea87e13734).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    this LGTM, any more comments @cloud-fan @kiszk @rednaxelafx ?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171516452
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = variableName
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(
    +    val statement: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean", true))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean", true))
    +
    +// Represents the java type of an evaluation.
    +case class ExprType(val typeName: String, val isPrimitive: Boolean)
    --- End diff --
    
    than can't we move the method from `CodegenContext` to a static method and use that? Currently this information is never used, and I feel this is hard to maintain (even though I don't expect it to change frequently).
    
    We can add a method like
    ```
    def isPrimitive: Boolean = CodegenContext.isPrimitive(typeName)
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85591 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85591/testReport)** for PR 20043 at commit [`4384c84`](https://github.com/apache/spark/commit/4384c84bd039addab34ba126447462ea87e13734).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85247 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85247/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158441506
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    If no strong preference for combining them, I'd keep it as two concepts for now, if we foresee the need to distinguish them. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r180725444
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,76 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: String
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +
    +  def isPrimitive: Boolean = CodeGenerator.isPrimitiveType(javaType)
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: String) extends ExprValue {
    --- End diff --
    
    We currently have case objects for `TrueLiteral` and `FalseLiteral` which extends `LiteralValue`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87583 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87583/testReport)** for PR 20043 at commit [`8715d32`](https://github.com/apache/spark/commit/8715d32af9a3c834647489a2333845fb72cd45a7).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `class ExprValueSuite extends SparkFunSuite `


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    I am going to merge this after this successfully passes tests


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85241/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171447686
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    --- End diff --
    
    I want to give it a bit flexibility for something like static variable.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87838 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87838/testReport)** for PR 20043 at commit [`0841c4a`](https://github.com/apache/spark/commit/0841c4afdb1808e3a1281d7612d1954b486c22dd).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1956/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171556291
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -70,13 +72,14 @@ case class GlobalValue(val value: String, val javaType: ExprType) extends ExprVa
       override val canDirectAccess: Boolean = true
     }
     
    -case object TrueLiteral extends LiteralValue("true", ExprType("boolean", true))
    -case object FalseLiteral extends LiteralValue("false", ExprType("boolean", true))
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean"))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean"))
     
     // Represents the java type of an evaluation.
    -case class ExprType(val typeName: String, val isPrimitive: Boolean)
    +case class ExprType(val typeName: String) {
    +  def isPrimitive(ctx: CodegenContext): Boolean = ctx.isPrimitiveType(typeName)
    +}
     
     object ExprType {
    -  def apply(ctx: CodegenContext, dataType: DataType): ExprType = ExprType(ctx.javaType(dataType),
    -    ctx.isPrimitiveType(dataType))
    +  def apply(ctx: CodegenContext, dataType: DataType): ExprType = ExprType(ctx.javaType(dataType))
    --- End diff --
    
    I am not sure this is useful. `ctx.javaType(dataType)` can be done by the caller


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171517146
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    --- End diff --
    
    a static variable is a `GlobalValue`, isn't it? Considering that we should be able to access also from methods in other internal classes I don't see any use case where this flexibility is required, honestly...


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Just resolve conflicts and add `TrueLiteral` and `FalseLiteral` first. Will replace literals with `TrueLiteral` and `FalseLiteral` later.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171444357
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -31,7 +31,7 @@ import org.apache.spark.sql.catalyst.InternalRow
     import org.apache.spark.sql.catalyst.ScalaReflection.universe.TermName
     import org.apache.spark.sql.catalyst.encoders.RowEncoder
     import org.apache.spark.sql.catalyst.expressions._
    -import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
    +import org.apache.spark.sql.catalyst.expressions.codegen._
    --- End diff --
    
    It will list too many classes `CodegenContext`, `ExprCode`, `ExprValue`, `GlobalValue`, `FalseLiteral`, `VariableValue`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87754 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87754/testReport)** for PR 20043 at commit [`f59bb19`](https://github.com/apache/spark/commit/f59bb19a3fd04b24ea3077a12283777be0af437d).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `abstract class ExprValue `
      * `class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue `
      * `case class VariableValue(`
      * `case class StatementValue(`
      * `case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue `
      * `case class ExprType(val typeName: String, val isPrimitive: Boolean)`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171557425
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +
    +  def isPrimitive(ctx: CodegenContext): Boolean = javaType.isPrimitive(ctx)
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType) extends ExprValue {
    +  override def toString: String = variableName
    +  override val canDirectAccess: Boolean = false
    +}
    +
    +// A statement evaluation of [[ExprCode]].
    +case class StatementValue(
    +    val statement: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    +  override def toString: String = statement
    +}
    +
    +// A global variable evaluation of [[ExprCode]].
    +case class GlobalValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +case object TrueLiteral extends LiteralValue("true", ExprType("boolean"))
    +case object FalseLiteral extends LiteralValue("false", ExprType("boolean"))
    +
    +// Represents the java type of an evaluation.
    +case class ExprType(val typeName: String) {
    +  def isPrimitive(ctx: CodegenContext): Boolean = ctx.isPrimitiveType(typeName)
    +}
    +
    +object ExprType {
    +  def apply(ctx: CodegenContext, dataType: DataType): ExprType = ExprType(ctx.javaType(dataType))
    --- End diff --
    
    I don't think this method is very useful. If needed, the caller can do `ctx.javaType(dataType)` I think


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1196/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    ping @hvanhovell @cloud-fan 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r158598549
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -56,7 +56,36 @@ import org.apache.spark.util.{ParentClassLoader, Utils}
      * @param value A term for a (possibly primitive) value of the result of the evaluation. Not
      *              valid if `isNull` is set to `true`.
      */
    -case class ExprCode(var code: String, var isNull: String, var value: String)
    +case class ExprCode(var code: String, var isNull: ExprValue, var value: ExprValue)
    +
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue
    --- End diff --
    
    @cloud-fan What do you think?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r180778937
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,76 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: String
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +
    +  def isPrimitive: Boolean = CodeGenerator.isPrimitiveType(javaType)
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: String) extends ExprValue {
    --- End diff --
    
    Yes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87844 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87844/testReport)** for PR 20043 at commit [`e530f01`](https://github.com/apache/spark/commit/e530f01f74c359aa4b21017393fd9d72d289a252).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `class LiteralValue(val value: String, val javaType: String) extends ExprValue `
      * `case class GlobalValue(val value: String, val javaType: String) extends ExprValue `


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2103/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88887/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r180724505
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,76 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: String
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +
    +  def isPrimitive: Boolean = CodeGenerator.isPrimitiveType(javaType)
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: String) extends ExprValue {
    --- End diff --
    
    why not a case class?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85291/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85243/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85588 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85588/testReport)** for PR 20043 at commit [`4384c84`](https://github.com/apache/spark/commit/4384c84bd039addab34ba126447462ea87e13734).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85231 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85231/testReport)** for PR 20043 at commit [`78680cc`](https://github.com/apache/spark/commit/78680cc60c27d645c349451090bfa056380e89f6).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @cloud-fan Any more comments on this?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    ping @cloud-fan 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171264038
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -31,7 +31,7 @@ import org.apache.spark.sql.catalyst.InternalRow
     import org.apache.spark.sql.catalyst.ScalaReflection.universe.TermName
     import org.apache.spark.sql.catalyst.encoders.RowEncoder
     import org.apache.spark.sql.catalyst.expressions._
    -import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
    +import org.apache.spark.sql.catalyst.expressions.codegen._
    --- End diff --
    
    can we list the needed classes instead?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171264271
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/ExprValue.scala ---
    @@ -0,0 +1,82 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.catalyst.expressions.codegen
    +
    +import scala.language.implicitConversions
    +
    +import org.apache.spark.sql.types.DataType
    +
    +// An abstraction that represents the evaluation result of [[ExprCode]].
    +abstract class ExprValue {
    +
    +  val javaType: ExprType
    +
    +  // Whether we can directly access the evaluation value anywhere.
    +  // For example, a variable created outside a method can not be accessed inside the method.
    +  // For such cases, we may need to pass the evaluation as parameter.
    +  val canDirectAccess: Boolean
    +}
    +
    +object ExprValue {
    +  implicit def exprValueToString(exprValue: ExprValue): String = exprValue.toString
    +}
    +
    +// A literal evaluation of [[ExprCode]].
    +class LiteralValue(val value: String, val javaType: ExprType) extends ExprValue {
    +  override def toString: String = value
    +  override val canDirectAccess: Boolean = true
    +}
    +
    +object LiteralValue {
    +  def apply(value: String, javaType: ExprType): LiteralValue = new LiteralValue(value, javaType)
    +  def unapply(literal: LiteralValue): Option[(String, ExprType)] =
    +    Some((literal.value, literal.javaType))
    +}
    +
    +// A variable evaluation of [[ExprCode]].
    +case class VariableValue(
    +    val variableName: String,
    +    val javaType: ExprType,
    +    val canDirectAccess: Boolean = false) extends ExprValue {
    --- End diff --
    
    why isn't this fixed like for `GlobalValue`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/87843/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #88887 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88887/testReport)** for PR 20043 at commit [`ac2e595`](https://github.com/apache/spark/commit/ac2e5959f204bde0ccd418479482f6f62b51a6f5).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Thanks! @cloud-fan @hvanhovell @kiszk @HyukjinKwon @mgaido91 @maropu @rednaxelafx @gatorsmile 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #87958 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/87958/testReport)** for PR 20043 at commit [`c8c70a9`](https://github.com/apache/spark/commit/c8c70a9107791cdfccb48dbc729aa8b6a6e9c7ee).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    This pr will be merge soon? I'd like to use this in my pr: https://github.com/apache/spark/pull/20965


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20043: [SPARK-22856][SQL] Add wrappers for codegen outpu...

Posted by mgaido91 <gi...@git.apache.org>.
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20043#discussion_r171262081
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -323,7 +323,8 @@ class CodegenContext {
           case _: StructType | _: ArrayType | _: MapType => s"$value = $initCode.copy();"
           case _ => s"$value = $initCode;"
         }
    -    ExprCode(code, "false", value)
    +    ExprCode(code, FalseLiteral,
    +      GlobalValue(value, ExprType(this, dataType)))
    --- End diff --
    
    nit: this can go on one line


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    **[Test build #85255 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85255/testReport)** for PR 20043 at commit [`81c9b6e`](https://github.com/apache/spark/commit/81c9b6e73ee64adcd8fc931d51f3faa98b892e0b).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85591/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88884/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    @hvanhovell Thanks! I also think this structure can help us improve codegen. I will update it soon.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20043: [SPARK-22856][SQL] Add wrappers for codegen output and n...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20043
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1953/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org