Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-13637][SQL] use more information to simplify the code in Expand builder #11485

Closed
wants to merge 2 commits into from

Conversation

cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

The code in Expand.apply can be simplified by existing information:

  • the groupByExprs parameter are all Attributes
  • the child parameter is a Project that append aliased group by expressions to its child's output

How was this patch tested?

by existing tests.


(child.output :+ gid).map(expr => expr transformDown {
// TODO this causes a problem when a column is used both for grouping and aggregation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still valid?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't anymore. We had some trouble with such columns when I placed the comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is for cube and rollup. Now, we covered all the cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gatorsmile are Cube and Rollup still broken? Or have they been fixed?

(edited)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a code history search. Sorry, this line was added by you. You know, cube and rollup also use Expand. Previously, cube and rollup had a couple of issues in grouping and aggregation. Now, all the issues have been fixed. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, so it's time to remove this TODO :)

@rxin
Copy link
Contributor

rxin commented Mar 3, 2016

@hvanhovell you might as well review this :)

@SparkQA
Copy link

SparkQA commented Mar 3, 2016

Test build #52370 has finished for PR 11485 at commit 9db97ec.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Mar 3, 2016

Test build #52386 has finished for PR 11485 at commit 9db97ec.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Mar 3, 2016

Test build #52394 has finished for PR 11485 at commit 9db97ec.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

gid: Attribute,
child: LogicalPlan): Expand = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not move the creation of the Project from the analyzer into this method? Then we can just take any logical plan as an argument.

@SparkQA
Copy link

SparkQA commented Mar 4, 2016

Test build #52435 has finished for PR 11485 at commit 4f31c5c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Mar 8, 2016

Test build #52666 has finished for PR 11485 at commit 4f31c5c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@hvanhovell
Copy link
Contributor

LGTM

@cloud-fan
Copy link
Contributor Author

Thanks for the review! Merging to master

@asfgit asfgit closed this in 7d05d02 Mar 8, 2016
roygao94 pushed a commit to roygao94/spark that referenced this pull request Mar 22, 2016
…d builder

## What changes were proposed in this pull request?

The code in `Expand.apply` can be simplified by existing information:

* the `groupByExprs` parameter are all `Attribute`s
* the `child` parameter is a `Project` that append aliased group by expressions to its child's output

## How was this patch tested?

by existing tests.

Author: Wenchen Fan <wenchen@databricks.com>

Closes apache#11485 from cloud-fan/expand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants