spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davies <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-14275][SQL] Reimplement TypedAggregateE...
Date Wed, 13 Apr 2016 20:16:57 GMT
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12067#discussion_r59617422
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala
---
    @@ -19,133 +19,153 @@ package org.apache.spark.sql.execution.aggregate
     
     import scala.language.existentials
     
    -import org.apache.spark.internal.Logging
     import org.apache.spark.sql.Encoder
    -import org.apache.spark.sql.catalyst.InternalRow
    -import org.apache.spark.sql.catalyst.encoders.{encoderFor, ExpressionEncoder, OuterScopes}
    +import org.apache.spark.sql.catalyst.analysis.{UnresolvedAttribute, UnresolvedDeserializer,
UnresolvedExtractValue}
    +import org.apache.spark.sql.catalyst.encoders.encoderFor
     import org.apache.spark.sql.catalyst.expressions._
    -import org.apache.spark.sql.catalyst.expressions.aggregate.ImperativeAggregate
    +import org.apache.spark.sql.catalyst.expressions.aggregate.DeclarativeAggregate
     import org.apache.spark.sql.expressions.Aggregator
     import org.apache.spark.sql.types._
     
     object TypedAggregateExpression {
    -  def apply[A, B : Encoder, C : Encoder](
    -      aggregator: Aggregator[A, B, C]): TypedAggregateExpression = {
    +  def apply[BUF : Encoder, OUT : Encoder](
    +      aggregator: Aggregator[_, BUF, OUT]): TypedAggregateExpression = {
    +    val bufferEncoder = encoderFor[BUF]
    +    // We will insert the deserializer and function call expression at the bottom of
each serializer
    +    // expression while executing `TypedAggregateExpression`, which means multiply serializer
    +    // expressions will all evaluate the same sub-expression at bottom.  To avoid the
re-evaluating,
    +    // here we always use one single serializer expression to serialize the buffer object
into a
    +    // single-field row, no matter whether the encoder is flat or not.  We also need
to update the
    +    // deserializer to read in all fields from that single-field row.
    +    // TODO: remove this trick after we have  better integration of subexpression elimination
and
    --- End diff --
    
    Can we hold this pr a little bit? let me think of how to do subexpression elimination
in aggregate.


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