diff options
author | Andrew Ray <ray.andrew@gmail.com> | 2016-05-02 22:47:32 -0700 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-05-02 22:47:32 -0700 |
commit | d8f528ceb61e3c2ac7ac97cd8147dafbb625932f (patch) | |
tree | 5e5e3987d3efc5740c4ed21eb53fc2eea478ce46 /sql/catalyst | |
parent | bb9ab56b960153d374d7e8838f62a18e7e45481e (diff) | |
download | spark-d8f528ceb61e3c2ac7ac97cd8147dafbb625932f.tar.gz spark-d8f528ceb61e3c2ac7ac97cd8147dafbb625932f.tar.bz2 spark-d8f528ceb61e3c2ac7ac97cd8147dafbb625932f.zip |
[SPARK-13749][SQL][FOLLOW-UP] Faster pivot implementation for many distinct values with two phase aggregation
## What changes were proposed in this pull request?
This is a follow up PR for #11583. It makes 3 lazy vals into just vals and adds unit test coverage.
## How was this patch tested?
Existing unit tests and additional unit tests.
Author: Andrew Ray <ray.andrew@gmail.com>
Closes #12861 from aray/fast-pivot-follow-up.
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala index 9154e96e34..9ead571c53 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala @@ -141,12 +141,12 @@ case class PivotFirst( copy(mutableAggBufferOffset = newMutableAggBufferOffset) - override lazy val aggBufferAttributes: Seq[AttributeReference] = + override val aggBufferAttributes: Seq[AttributeReference] = pivotIndex.toList.sortBy(_._2).map(kv => AttributeReference(kv._1.toString, valueDataType)()) - override lazy val aggBufferSchema: StructType = StructType.fromAttributes(aggBufferAttributes) + override val aggBufferSchema: StructType = StructType.fromAttributes(aggBufferAttributes) - override lazy val inputAggBufferAttributes: Seq[AttributeReference] = + override val inputAggBufferAttributes: Seq[AttributeReference] = aggBufferAttributes.map(_.newInstance()) } |