Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
guowei2 committed Apr 7, 2015
1 parent 646f609 commit 668c47a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
Cube(children.map(nodeToExpr), withLateralView, selectExprs)
case _ => sys.error("Expect WITH CUBE")
}),
Some(withLateralView)).flatten.head
Some(Project(selectExprs, withLateralView))).flatten.head

windowToPlan(selectExpressions, groupPlan)
}
Expand Down Expand Up @@ -1072,6 +1072,10 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
selectExpressions.filter(
_.collect { case a @ Alias(WindowExpression(_, _), _) => a }.isEmpty)

val childPlan = groupPlan(subSelectExprs).transform {
case Project(_, child) => child
}

val attributes =
(
windowExpressions.flatMap(_.collect {
Expand All @@ -1084,7 +1088,7 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
}.distinct

val (restWindowExprs, _, withWindow) =
windowPartitions.foldLeft((windowExpressions, attributes, groupPlan(subSelectExprs))) {
windowPartitions.foldLeft((windowExpressions, attributes, childPlan)) {
case ((expressions, attributes, plan), part @ WindowPartition(partitionBy, sortBy)) =>
val (computeExprs, restWindowExprs) =
expressions.partition(
Expand Down

0 comments on commit 668c47a

Please sign in to comment.