Hi all,
I agree with what Jacques said, in addition to that, what helps me is to
observe that RelNode objects can be seen as what "builds" the plan/DAG
itself, via the "input" field(s).

For instance, a project will have another RelNode as it's input, the same
for a join who has two inputs (left and right children).

Of course in projection you have row expressions, and that's why you have
RexNode within a RelNode, same goes for expressing the join conditions
which, again, are RexNode.

The relationships between RelNode objects, via their input field(s),
logically forms the plan.

Then of course there is the underlying AND/OR DAG implementation details
like HepVertex, but let's not consider that as it is not relevant here.

HTH,
Alessandro

On Wed, 12 Jan 2022 at 16:27, Gavin Ray <[email protected]> wrote:

> Jacques' answer is helpful, thank you.
> I had this same question.
>
> What makes things blurry is the fact that "RelBuilder" uses a mix of
> RelNode/RexNode stuff, which I found a little confusing.
>
>
> On Wed, Jan 12, 2022 at 10:18 AM M Singh <[email protected]>
> wrote:
>
> >  Hey Jacques:
> > That's a wonderful insight.  I will try to understand the concepts in
> that
> > light, but may have more questions.
> > Thanks again for your insight.
> > Mans
> >     On Wednesday, January 12, 2022, 10:06:36 AM EST, Jacques Nadeau <
> > [email protected]> wrote:
> >
> >  RexNode => Works on one record (aka a row expression)
> > RelNode => Works on a set of records (aka a relational expression)
> >
> > For example:
> > A sort reorders a number of records. As such it is a RelNode (it works on
> > many records)
> > Adding two numbers (e.g. 4+6) is a RexNode, it works on each record
> > independently of the last.
> >
> > Most people who aren't super familiar with relational algebra (see
> > wikipedia) think in terms of RexNodes since that is what people learn
> about
> > in grammar school. When I first started looking at Calcite code I had the
> > same confusion. Best way to try to understand is look at the plans of
> some
> > sql queries and see how each type of object appears.
> >
> > Hope that helps!
> >
> >
> >
> > On Wed, Jan 12, 2022 at 6:31 AM M Singh <[email protected]>
> > wrote:
> >
> > > Hi:
> > > I am trying to understand the difference b/w RelNode and RexNode.  I
> have
> > > taken a looks at the javadocs and a few examples, but am still not
> clear
> > > what role they play.
> > > It's a newbie questions, but if there is any good
> > > blog/documentation/article, please let me know.
> > > Thanks
> > > Mans
> >
>

Reply via email to