Thanks...

On Wed, Nov 30, 2016 at 2:34 PM, Julian Hyde <jh...@apache.org> wrote:

> Sorry, my mistake (or my email provider’s). I sent this reply on 11/22 and
> it went into my “sent” folder but it seems not to have made it onto the
> list.
>
> > On Nov 22, 2016, at 7:55 PM, Julian Hyde <jh...@apache.org> wrote:
> >
> > This looks like a bug. But first try writing
> >
> >  rb.scan("EMP").as("t0”)
> >      .scan("DEPT").as("t1")
> >      .join(JoinRelType.LEFT,
> >          rb.field(2, "t0", "emp_dept_no”),
> >          rb.field(2, "t1", "dept_dept_no"));
> >
> > Note that I added an extra “2, “ in each call to “field”.
> >
>

There is no such method in the API. The only field() overload accepting a
table alias is field(alias, fieldName). I will add such method.
Thanks.
Jess


> > The two calls to “field” don’t know they’re in a call to “join”, and in
> particular don’t know that “join” is about to pop two relational
> expressions of the stack. The “2” argument provides that information.
> Without it RelBuilder has no chance to generate the right column offset.
> >
> > If that doesn’t solve the problem, please log a bug.
> >
> > Julian
> >
> >
> >
> >> On Nov 22, 2016, at 1:41 PM, Jess Balint <jbal...@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> Using the RelBuilder API, I would like to create a join condition using
> >> table aliases. The RelBuilder.field(relationAlias, fieldName) method
> only
> >> checks the top of the stack. The top of the stack is not yet a join
> node if
> >> using the RelBuilder.join(joinType, joinCondition) method. Here's an
> >> example:
> >>
> >> rb.scan("EMP").as("t0").scan("DEPT").as("t1")
> >> .join(JoinRelType.LEFT, rb.field("t0", "emp_dept_no"),
> >> rb.field("t1", "dept_dept_no"));
> >>
> >>
> >> I'm getting an error "java.lang.IllegalArgumentException: no relation
> wtih
> >> alias 't0'; aliases are: [t1]". Would it make sense for the RelBuilder
> to
> >> check the entire stack in anticipation that it's contents will be used?
> >>
> >> Thx.
> >> Jess
> >
>
>

Reply via email to