calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Transitioning rules from ProjectFactory etc. to RelBuilder
Date Wed, 23 Sep 2015 00:14:43 GMT
I have started work on
https://issues.apache.org/jira/browse/CALCITE-828 and my
work-in-progress is in
https://github.com/julianhyde/incubator-calcite/commits/828-rule-builder.

This will be a big change to teams such as Hive and Drill. Now would
be a good time to chime in.

The plan is that every rule instance has a ProtoRelBuilder field from
which a RelBuilder can be created to be used in an onMatch method. The
RelBuilder contains factories for every kind of RelNode, so we won't
have to keep plumbing new factories in to existing rules.

There will be other advantages. RelBuilder is an easier and more
concise way of creating relational expressions. It does some useful
stuff for free, like flattening ANDs and eliminating identity
projections. I'm seeing the volume of code decrease and a few minor
plan improvements.

I haven't yet found a good way to deal with the pattern where if, say,
ProjectFactory is null the rule is to use Project.copy to create a
Project of the same type.

I'm keeping & deprecating the old rule constructors that take a
variety of XxxFactory arguments.

As always, we try to keep API compatibility and mark the old API

  @Deprecated // to be removed before 2.0

but the deprecated APIs are no longer tested and are likely to be
flaky. We strongly suggest that you fix calls to deprecated APIs as
soon as you upgrade to a more recent version of Calcite.

Julian

Mime
View raw message