Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15703#discussion_r85981118
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala 
---
    @@ -293,69 +307,57 @@ private[hive] case class HiveUDAFFunction(
       private lazy val inspectors = children.map(toInspector).toArray
     
       @transient
    -  private lazy val functionAndInspector = {
    +  private lazy val function = {
         val parameterInfo = new SimpleGenericUDAFParameterInfo(inspectors, 
false, false)
    -    val f = resolver.getEvaluator(parameterInfo)
    -    f -> f.init(GenericUDAFEvaluator.Mode.COMPLETE, inspectors)
    +    resolver.getEvaluator(parameterInfo)
       }
     
       @transient
    -  private lazy val function = functionAndInspector._1
    +  private lazy val wrappers = children.map(x => wrapperFor(toInspector(x), 
x.dataType)).toArray
     
       @transient
    -  private lazy val wrappers = children.map(x => wrapperFor(toInspector(x), 
x.dataType)).toArray
    +  private lazy val returnInspector =
    +    function.init(GenericUDAFEvaluator.Mode.COMPLETE, inspectors)
     
       @transient
    -  private lazy val returnInspector = functionAndInspector._2
    +  private lazy val partialResultInspector =
    +    function.init(GenericUDAFEvaluator.Mode.PARTIAL1, inspectors)
    +
    +  // The following two lines initializes `function: GenericUDAFEvaluator` 
eagerly. These two fields
    --- End diff --
    
    Good point, I didn't check whether these two fields are really used on 
executor side. If not, it's true that we can remove the `lazy` modifier.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to