Julian Hyde created CALCITE-748:
-----------------------------------

             Summary: Builder for relational expressions
                 Key: CALCITE-748
                 URL: https://issues.apache.org/jira/browse/CALCITE-748
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


Creating relational expressions currently involves calling the "create" method 
of the relevant sub-class of RelNode, often with a lot of obscure parameters. 
This might be appropriate for someone writing a rule, but is not particularly 
friendly to someone who wants to write queries using an API.

We propose instead a builder. It would have a method for each core type of 
relational expression; for example a {{filter}} method that returns a Filter. 
For a given type, there might be overloads that allow you more control.

Inside the builder is a factory for each operator type. Thus a builder could be 
configured to create logical rels (LogicalFilter, LogicalProject) or rels of a 
different convention (HiveFilter, HiveProject).

Two particular areas that the builder can help. First, it can deduce the names 
and types of output columns. (You can override types, and optionally also 
names, or maybe just some names, using other APIs.)

Second, it can help you build RexNode expressions. It knows the type and names 
of the input, it will let you build expressions in terms of column ordinals or 
names, which are easier than RexInputRefs.



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

Reply via email to