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 >
