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

    https://github.com/apache/spark/pull/16383#discussion_r93813849
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala
 ---
    @@ -143,15 +197,96 @@ case class TypedAggregateExpression(
         }
       }
     
    -  override def toString: String = {
    -    val input = inputDeserializer match {
    -      case Some(UnresolvedDeserializer(deserializer, _)) => 
deserializer.dataType.simpleString
    -      case Some(deserializer) => deserializer.dataType.simpleString
    -      case _ => "unknown"
    +  override def withInputInfo(
    +      deser: Expression,
    +      cls: Class[_],
    +      schema: StructType): TypedAggregateExpression = {
    +    copy(inputDeserializer = Some(deser), inputClass = Some(cls), 
inputSchema = Some(schema))
    +  }
    +}
    +
    +case class ComplexTypedAggregateExpression(
    +    aggregator: Aggregator[Any, Any, Any],
    +    inputDeserializer: Option[Expression],
    +    inputClass: Option[Class[_]],
    +    inputSchema: Option[StructType],
    +    bufferSerializer: Seq[NamedExpression],
    +    bufferDeserializer: Expression,
    +    outputSerializer: Seq[Expression],
    +    dataType: DataType,
    +    nullable: Boolean,
    +    mutableAggBufferOffset: Int = 0,
    +    inputAggBufferOffset: Int = 0)
    +  extends TypedImperativeAggregate[Any] with TypedAggregateExpression with 
NonSQLExpression {
    +
    +  override def deterministic: Boolean = true
    --- End diff --
    
    like UDF, we can also assume the `Aggregator` is always deterministic. I 
think in the future we should allow users to define nondeterministic 
UDF(including `Aggregator`).


---
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