Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14822#discussion_r76368623
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/interfaces.scala
 ---
    @@ -489,25 +510,23 @@ abstract class TypedImperativeAggregate[T] extends 
ImperativeAggregate {
       }
     
       final override def update(buffer: MutableRow, input: InternalRow): Unit 
= {
    -    val bufferObject = getField[T](buffer, mutableAggBufferOffset)
    -    update(bufferObject, input)
    +    update(getBufferObject(buffer), input)
       }
     
       final override def merge(buffer: MutableRow, inputBuffer: InternalRow): 
Unit = {
    -    val bufferObject = getField[T](buffer, mutableAggBufferOffset)
    +    val bufferObject = getBufferObject(buffer)
         // The inputBuffer stores serialized aggregation buffer object 
produced by partial aggregate
         val inputObject = 
deserialize(inputBuffer.getBinary(inputAggBufferOffset))
         merge(bufferObject, inputObject)
       }
     
       final override def eval(buffer: InternalRow): Any = {
    -    val bufferObject = getField[T](buffer, mutableAggBufferOffset)
    -    eval(bufferObject)
    +    eval(getBufferObject(buffer))
       }
     
       private[this] val anyObjectType = ObjectType(classOf[AnyRef])
    -  private def getField[U](input: InternalRow, fieldIndex: Int): U = {
    -    input.get(fieldIndex, anyObjectType).asInstanceOf[U]
    +  private def getBufferObject(bufferRow: InternalRow): T = {
    --- End diff --
    
    this addresses https://github.com/apache/spark/pull/14753/files#r76154000


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to