Skip to content

[SPARK-5642] [SQL] Apply column pruning on unused aggregation fields #4415

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

Closed
wants to merge 4 commits into from

Conversation

adrian-wang
Copy link
Contributor

select k from (select key k, max(value) v from src group by k) t

@SparkQA
Copy link

SparkQA commented Feb 6, 2015

Test build #26889 has started for PR 4415 at commit ce99ea1.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Feb 6, 2015

Test build #26889 has finished for PR 4415 at commit ce99ea1.

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

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26889/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Feb 6, 2015

Test build #26898 has started for PR 4415 at commit b6420cb.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Feb 6, 2015

Test build #26898 has finished for PR 4415 at commit b6420cb.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26898/
Test PASSed.

@rxin
Copy link
Contributor

rxin commented Feb 6, 2015

Is it possible to add a unit test?

@rxin
Copy link
Contributor

rxin commented Feb 6, 2015

(I understand unit test coverage for the optimizer is pretty low - but that would be great to change & increase)

@SparkQA
Copy link

SparkQA commented Feb 9, 2015

Test build #27080 has started for PR 4415 at commit 8f5c86d.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Feb 9, 2015

Test build #27080 has finished for PR 4415 at commit 8f5c86d.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27080/
Test PASSed.

@@ -116,6 +116,10 @@ object ColumnPruning extends Rule[LogicalPlan] {
case a @ Aggregate(_, _, child) if (child.outputSet -- a.references).nonEmpty =>
a.copy(child = Project(a.references.toSeq, child))

case p @ Project(pl, Aggregate(ge, ec, child))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd follow the convention from the rest of the optimizer and use longer variable names (i.e. projectList, groupExprs, aggExprs)

@SparkQA
Copy link

SparkQA commented Feb 10, 2015

Test build #27163 has started for PR 4415 at commit 2cd88ff.

  • This patch does not merge cleanly.

@SparkQA
Copy link

SparkQA commented Feb 10, 2015

Test build #27165 has started for PR 4415 at commit 2916ec9.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Feb 10, 2015

Test build #27163 has finished for PR 4415 at commit 2cd88ff.

  • This patch passes all tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27163/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Feb 10, 2015

Test build #27165 has finished for PR 4415 at commit 2916ec9.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27165/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Feb 13, 2015

Test build #27430 has started for PR 4415 at commit 5d2d8a3.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Feb 13, 2015

Test build #27430 has finished for PR 4415 at commit 5d2d8a3.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27430/
Test PASSed.

@adrian-wang
Copy link
Contributor Author

@rxin @marmbrus

@marmbrus
Copy link
Contributor

Thanks! I'm going to go ahead and add one more test case while merging since I wasn't sure if this case was handled properly (it is :) )

Merging to master and 1.3

@marmbrus
Copy link
Contributor

  test("column pruning for group with alias") {
    val originalQuery =
      testRelation
        .groupBy('a)('a as 'c, Count('b))
        .select('c)

    val optimized = Optimize(originalQuery.analyze)
    val correctAnswer =
      testRelation
        .select('a)
        .groupBy('a)('a as 'c)
        .select('c).analyze

    comparePlans(optimized, correctAnswer)
  }

asfgit pushed a commit that referenced this pull request Feb 13, 2015
select k from (select key k, max(value) v from src group by k) t

Author: Daoyuan Wang <daoyuan.wang@intel.com>
Author: Michael Armbrust <michael@databricks.com>

Closes #4415 from adrian-wang/groupprune and squashes the following commits:

5d2d8a3 [Daoyuan Wang] address Michael's comments
61f8ef7 [Daoyuan Wang] add a unit test
80ddcc6 [Daoyuan Wang] keep project
b69d385 [Daoyuan Wang] add a prune rule for grouping set

(cherry picked from commit 2cbb3e4)
Signed-off-by: Michael Armbrust <michael@databricks.com>
@asfgit asfgit closed this in 2cbb3e4 Feb 13, 2015
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