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

Top n push down #110

Merged
merged 10 commits into from
Dec 8, 2017
Merged

Top n push down #110

merged 10 commits into from
Dec 8, 2017

Conversation

Novemser
Copy link
Contributor

@Novemser Novemser commented Dec 4, 2017

Support for Limit and order by clause.

@Novemser Novemser mentioned this pull request Dec 4, 2017
@Novemser
Copy link
Contributor Author

Novemser commented Dec 4, 2017

Refer to client PR: #178

case PhysicalOperation(projectList, filters, LogicalRelation(source: TiDBRelation, _, _))
if filters.forall(TiUtils.isSupportedFilter(_, source)) =>
pruneTopNFilterProject(limit, projectList, filters, source) :: Nil
case TiAggregation(
Copy link
Contributor

@ilovesoup ilovesoup Dec 4, 2017

Choose a reason for hiding this comment

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

Would you please confirm if topN and aggregates can be pushdown independently.
For example, if you have group by name and count
you have
region 1: A, 100, B, 1
region 2: A, 100, B 1000
and you take Top 1. In above case, B will be ignored in region 1 request but actually B is the group to take and final result is 1000 instead of 1001.
I wonder if above case works in your implementation.

@Novemser Novemser changed the title Top n push down [DNM][WIP]Top n push down Dec 4, 2017
)
}

def validGroupAggregate(groupingExpressions: Seq[NamedExpression],
Copy link
Contributor

Choose a reason for hiding this comment

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

Change it to isValidAggregates. Aggregates include aggexpr and groupby exprs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

Copy link
Contributor

@ilovesoup ilovesoup left a comment

Choose a reason for hiding this comment

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

What's the real purpose for this PR? It seems for both refactor aggregates planning and topN.
If we don't need to do topN for aggregates. Do we still need to change all those stuff?
You might open an individual PR for refactoring if you see fit.

aggregate.AggUtils.planAggregateWithoutDistinct(
) if validGroupAggregate(groupingExpressions, aggregateExpressions, source) =>
val dagReq: TiDAGRequest = filterToDAGRequest(filters, source)
groupAggregateProjection(
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Novemser
Copy link
Contributor Author

Novemser commented Dec 7, 2017

@ilovesoup Sorry for the inconvenience I bought, this PR only handles TopN logic but not aggregation with TopN logic.

@Novemser Novemser changed the title [DNM][WIP]Top n push down Top n push down Dec 7, 2017
Copy link
Contributor

@ilovesoup ilovesoup left a comment

Choose a reason for hiding this comment

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

LGTM

@Novemser
Copy link
Contributor Author

Novemser commented Dec 8, 2017

Integration test result:
Tests run: 7211 Tests succeeded: 3735 Tests failed: 21 Tests skipped: 3455
Result is as expected.

Copy link
Contributor

@ilovesoup ilovesoup left a comment

Choose a reason for hiding this comment

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

LGTM

@Novemser Novemser merged commit 74ee985 into master Dec 8, 2017
@Novemser Novemser deleted the TopN_pushdown branch December 8, 2017 09:36
wfxxh pushed a commit to wanfangdata/tispark that referenced this pull request Jun 30, 2023
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.

2 participants