Hi,

When defining a UDF, e.g.  
  CREATE FUNCTION myfunc(a int, b int) RETURNS int
we can have:

- a scalar implementation 
  command myfunc(a:int, b:int) :int 

- a bulk implementation 
  command myfunc(a:bat[:int], b:bat[:int]) :bat[:int]

- a mixed implementation (e.g. a is a column, b is scalar):
  command myfunc(a:bat[:int], b:int) :bat[:int]

I'm trying to understand what the restrictions are, if any, for the third case. 
Is it expected to be allowed in (a combination of) the following cases?

- Interleaved bulk/scalar arguments
  command myfunc(a:bat[:int], b:int, c:bat[:int]) :bat[:int]

- Table-returning function
  command myfunc(a:bat[:int], b:int) (:bat[:int], :bat[:int])

- Table-returning function, used with a sub-select in input
  SELECT * FROM myfunc( (SELECT a, 10 FROM mytable) );

In particular I can't get the last one to work. Even though the sub-select has a constant as the second column, this constant seems to be first replicated into a full column and then given to myfunc() as a column.

When the constant parameters are a few, that becomes a waste of time/space. Plus the annoyance of selecting the first value of a constant column for the actual internal implementation, which of course expects a scalar for those arguments.

Am I missing something? Is there a way to make that work as I would expect?

Thanks, Roberto