[ 
https://issues.apache.org/jira/browse/DRILL-3500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14635763#comment-14635763
 ] 

Mehant Baid commented on DRILL-3500:
------------------------------------

OptimizerRulesContext is essentially an interface added on top of existing 
information present in QueryContext so the name might be a bit misleading and 
can be changed. 

The main motivation behind adding the new interface (OptimizerRulesContext) was 
to enable Hive storage plugin to add a rule to perform interpreter based 
execution for partition pruning. I think Jason also needs this for some of his 
work for reading Hive Parquet files natively. Some information in QueryContext 
is needed to be able to perform this and the two main reasons to add the 
interface were:

1. Better encapsulation, since QueryContext is pretty heavy weight and we add a 
bunch of information to it, this interface would prevent any unnecessary 
information being leaked to the plugin.
2. One common interface exposing all information needed by optimizer rules that 
is common to both storage plugin specific rules and the internal rules. 
Currently in master all the internal optimizer rules (eg: 
[PruneScanRule|https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java#L77]
 ) have access to information in QueryContext but storage plugin rules don't. 
This way we provide the same framework to build the rules independent of 
storage plugin.

> Provide additional information while registering storage plugin optimizer 
> rules
> -------------------------------------------------------------------------------
>
>                 Key: DRILL-3500
>                 URL: https://issues.apache.org/jira/browse/DRILL-3500
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Mehant Baid
>            Assignee: Mehant Baid
>             Fix For: 1.2.0
>
>
> Currently all the optimizer rules internal to Drill have access to 
> QueryContext. This is used by a few rules like PruneScanRule which invoke the 
> interpreter to perform partition pruning. However the rules that belong to 
> specific storage plugins don't have access to this information. This JIRA 
> aims to do the following
> 1. Add a new interface OptimizerRulesContext that will be implemented by 
> QueryContext. It will contain all the information needed by the rules. This 
> context will be passed to the storage plugin method while getting the 
> optimizer rules specific to that storage plugin.
> 2. Restrict existing internal rules to only accept OptimizerRulesContext 
> instead of QueryContext so information in QueryContext has better 
> encapsulation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to