[
https://issues.apache.org/jira/browse/CALCITE-748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14573568#comment-14573568
]
Julian Hyde commented on CALCITE-748:
-------------------------------------
It's looking good -- a 5 line SQL statement becomes not much more than 5 lines
of Java in many cases.
I've deployed a preview of the manual to
http://calcite.hydromatic.net/docs/algebra.html, and javadoc to
http://calcite.hydromatic.net/apidocs/org/apache/calcite/tools/RelBuilder.html.
The code is in my 748-builder branch,
https://github.com/julianhyde/incubator-calcite/tree/748-builder.
> 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)