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-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to