Hi Rui,

Thanks very much. It seems that I can find column name from input row type.
In order to find column position in original table, I need to find its
position based on input row type recursively.

Thanks,

Dustin


On Sun, Sep 8, 2019 at 2:24 PM Rui Wang <[email protected]> wrote:

> Regarding to original user tables, my observation is column names are
> passed to each Rel from bottom to top (and saves in row type) unless there
> is an alias.
>
> But please do correct me if my observation is wrong.
>
>
> -Rui
>
> On Sun, Sep 8, 2019 at 2:19 PM Rui Wang <[email protected]> wrote:
>
> > Hi Dustin,
> >
> > 1. My understanding is RexInputRef's index is an offset from its inputs
> > and indexed from the first column from the first input(offset starts from
> > 0). For a Rel with a single input, the offset is the column position from
> > index 0. In BeamSQL's implementation, if I recall correctly, for a Join
> > Rel, the left join input is indexed from 0 to len(left_schema) - 1, and
> > right join input is from len(left_schema) to len(left_schema) +
> > len(right_schema) - 1.
> >
> > 2. After you locate the column based on RexInput, you can find column
> name
> > from input.getRowType().getFieldList().get(i).getName().
> >
> > RexInputRef saves the index and column type. I am not aware that it saves
> > any column name directly. Usually column name is not useful inside a
> > logical plan.
> >
> >
> > -Rui
> >
> >
> > On Sun, Sep 8, 2019 at 1:48 PM Dustin Jiang <[email protected]>
> > wrote:
> >
> >> Hi,
> >> I am new to calcite. if you can provide any info about the following
> >> questions, I would really appreciate it.
> >>
> >> I have a RexInpuRef which refers to a column from input schema.  1) how
> do
> >> I find the column name and column position in its input schema? The the
> >> input schema is formed by joining two tables, 2) how do I find original
> >> column name and original column position in original user-defined table?
> >>
> >> Do we store any such info in the RefInputRef node itself?
> >>
> >> Thanks in advance,
> >>
> >> Dustin
> >>
> >
>

Reply via email to