spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nongli <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-13072][SQL] simplify and improve murmur...
Date Fri, 29 Jan 2016 18:13:38 GMT
Github user nongli commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10974#discussion_r51294176
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
---
    @@ -325,36 +325,62 @@ case class Murmur3Hash(children: Seq[Expression], seed: Int) extends
Expression
     
       override def genCode(ctx: CodegenContext, ev: ExprCode): String = {
         ev.isNull = "false"
    -    val childrenHash = children.zipWithIndex.map {
    -      case (child, dt) =>
    -        val childGen = child.gen(ctx)
    -        val childHash = computeHash(childGen.value, child.dataType, ev.value, ctx)
    -        s"""
    -          ${childGen.code}
    -          if (!${childGen.isNull}) {
    -            ${childHash.code}
    -            ${ev.value} = ${childHash.value};
    -          }
    -        """
    +    val childrenHash = children.map { child =>
    +      val childGen = child.gen(ctx)
    +      childGen.code + generateNullCheck(child.nullable, childGen.isNull) {
    +        computeHash(childGen.value, child.dataType, ev.value, ctx)
    +      }
         }.mkString("\n")
    +
         s"""
           int ${ev.value} = $seed;
           $childrenHash
         """
       }
     
    +  private def generateNullCheck(nullable: Boolean, isNull: String)(execution: String):
String = {
    --- End diff --
    
    Are there other places we can use this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message