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

Support multiple outer aggregators of same type and provide more help… #1799

Merged
merged 2 commits into from
Oct 30, 2015
Merged

Support multiple outer aggregators of same type and provide more help… #1799

merged 2 commits into from
Oct 30, 2015

Conversation

dclim
Copy link
Contributor

@dclim dclim commented Oct 1, 2015

…ful exception when the same inner aggregator is referenced by multiple types of outer aggregators

Temporary bandage for issue with nested group by where an inner aggregator is referenced by more than one outer aggregator. This fix allows multiple references if the outer aggregators are the same (based on 'equals' method), otherwise it throws an exception with a more helpful message than previously. To fully support this would require a larger re-work of the implementation.

…ful exception when the same inner aggregator is referenced by multiple types of outer aggregators
for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) {
aggs.addAll(aggregatorFactory.getRequiredColumns());
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't it solve the problem if we did..

for (AggregatorFactory aggregatorFactory : subquery.getAggregatorSpeces()) {
  aggs.add(aggregatorFactory.getCombiningFactory());
}

Copy link
Contributor

Choose a reason for hiding this comment

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

also, probably set innerQuery.setPostAggregatorSpecs(subquery.getPostAggregatorSpecs())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@himanshug Using the combining factories from the subquery works for the aggregators, but setting innerQuery.setPostAggregatorSpecs(subquery.getPostAggregatorSpecs()) doesn't do anything since that field isn't read when we create the intermediate incremental index from the subquery results. The result is that any aggregator in the outer query that is operating on a subquery post aggregator doesn't work correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense

@himanshug himanshug closed this Oct 7, 2015
@himanshug himanshug reopened this Oct 7, 2015
@himanshug
Copy link
Contributor

LGTM

for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) {
aggs.addAll(aggregatorFactory.getRequiredColumns());
for (final AggregatorFactory transferAgg : aggregatorFactory.getRequiredColumns()) {
Copy link
Member

Choose a reason for hiding this comment

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

can we add some comments to explain the logic here? Outside of the context of this PR it might be hard to understand what this is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xvrl I added a comment, hopefully it clears things up. Thanks for the feedback X.

@fjy
Copy link
Contributor

fjy commented Oct 26, 2015

👍

fjy added a commit that referenced this pull request Oct 30, 2015
Support multiple outer aggregators of same type and provide more help…
@fjy fjy merged commit 25a0eb7 into apache:master Oct 30, 2015
@dclim dclim deleted the nested-groupby-aggregator-fix branch October 30, 2015 03:28
@gianm gianm added this to the 0.9.0 milestone Nov 7, 2015
@gianm gianm modified the milestones: 0.8.3, 0.9.0 Dec 1, 2015
This was referenced Dec 1, 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.

None yet

5 participants