When forming a reference it needs to know how many inputs you are
going to pop off the stack in your next operation. Most operations pop
1, but join pops 2. Set operations may pop more, but they don't use
expressions, so it's moot.

You don't necessarily pop the whole stack. For instance, if you're
forming a right-deep join (a join (b join c)) for instance. You would
have a, b, c on the stack and just pop (b, c) to make the first join.

So, I can't see a way to remove the inputCount parameter.

On Fri, Oct 6, 2017 at 12:33 PM, Marc Prud'hommeaux <[email protected]> wrote:
>
> Using the RelBuilder API, I’d like to get a field by alias & name without 
> having to keep track of the inputCount. I’ve found that the following always 
> seems to work fine (after making stack a public variable):
>
>   builder.field(builder.stack.count(), “MYALIAS”, “myfield”)
>
> My question: why does RelBuilder.field(String, String) use an inputCount of 1 
> instead of the size of the stack? Doing so would allow people to search for 
> field names without having to keep track of the number of inputs.
>
> I understand why accessing fields by index require the inputCount and 
> inputOrdinal, but searching for fields by name could just scan the entire 
> stack and return the first matching field name + alias.
>
>

Reply via email to