[
https://issues.apache.org/jira/browse/PHOENIX-2167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maryann Xue updated PHOENIX-2167:
---------------------------------
Attachment: PHOENIX-2167.patch
The idea is to have a new method "limit(int)" in QueryPlan and to ask each
implementation class to handle its own copy approach. For example, most
BaseQueryPlan sub-classes will return a new instance overridden with the new
limit value. And classes deriving from DelegateQueryPlan can push down the
limit into its delegate if desired. Other QueryPlan implementation classes that
do not care about the limit value (e.g. DegenerateQueryPlan) can simply return
its own instance.
Still it's the caller's responsibility to call getLimit() on the original
QueryPlan in order to decide whether to use this "limit(int)" method. If
getLimit() does not return null, which means the plan already has a limit
value, the caller can choose either to merge the two limit values or wrap the
original plan with a ClientScanPlan.
> Add new interface in QueryPlan for pushing down a limit value.
> --------------------------------------------------------------
>
> Key: PHOENIX-2167
> URL: https://issues.apache.org/jira/browse/PHOENIX-2167
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: Maryann Xue
> Assignee: Maryann Xue
> Attachments: PHOENIX-2167.patch
>
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> Calcite rel trees are compiled bottom-up into Phoenix QueryPlans, the easiest
> way to implement a Limit RelNode in the tree is to create a ClientScanPlan
> with the limit value and wrap it around the inner plan. However, oftentimes
> this may not be efficient.
> For example, select * from T limit 10, the original Phoenix compiler would
> generate a ScanPlan with limit 10, apply a PageFilter and avoid using
> sophisticated or expensive ResultIterators.
> So it would make sense to push down the limit to a QueryPlan as low as
> possible and create a new copy of the plan based on this rule.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)