Creating an expression in Calcite's relational algebra has always been too complicated. The constructors for the various RelNode sub-classes have lots of parameters, and you have to worry about row-types, trait-sets, making field names unique, and so forth. And if you want to generate a different sub-class of RelNode, say a HiveProject rather than a LogicalProject, you have to do it all again.
I set out to change this in https://issues.apache.org/jira/browse/CALCITE-748, with a new RelBuilder class. 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. I'd love to hear what you think of it, and what it's potentially good for. Julian
