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

David Alves edited comment on DRILL-45 at 3/11/13 8:37 PM:
-----------------------------------------------------------

I agree that we need more builders, but IMO those should not be in the 
LogicalPlanBuilder (my reasoning is that we wouldn't want to  keep updating it 
to reflect every Logical Op and/or logical Op field).

My idea is to create builders inside the logical ops themselves (using a 
builder hierarchy that follow the op hierarchy).

In the end using them would look approximately like:
{code}
StorageEngine engine = HBaseStorageEngine.builder()
  .url(...)
  .build()

LogicalPlan plan = LogicalPlan.builder()
.planProperties(PlanProperties.builder()
  .version(1)
  .generator(generator)
  .build())
.addStorageEngine(engine)
.addLogicalOperator(Scan.builder()
  .storageEngine(engine)
  .build())
.build()

{code}

Along with adding builders to ops we would also make them immutable.

                
      was (Author: dr-alves):
    I agree that we need more builders, but IMO those should not be in the 
LogicalPlanBuilder (my reasoning is that we wouldn't want to  keep updating it 
to reflect every Logical Op and/or logical Op field).

My idea is to create builders inside the logical ops themselves (using a 
builder hierarchy that follow the op hierarchy).

In the end using them would look approximately like:
{code:java}
StorageEngine engine = HBaseStorageEngine.builder()
  .url(...)
  .build()

LogicalPlan plan = LogicalPlan.builder()
.planProperties(PlanProperties.builder()
  .version(1)
  .generator(generator)
  .build())
.addStorageEngine(engine)
.addLogicalOperator(Scan.builder()
  .storageEngine(engine)
  .build())
.build()

{code}

Along with adding builders to ops we would also make them immutable.

                  
> Create Logical Plan builder for programmatic creation of a Logical Plan
> -----------------------------------------------------------------------
>
>                 Key: DRILL-45
>                 URL: https://issues.apache.org/jira/browse/DRILL-45
>             Project: Apache Drill
>          Issue Type: New Feature
>            Reporter: Jacques Nadeau
>
> Will be useful when users are generating a Logical Plan within Java.  First 
> consumer would likely be the SQL parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to