Since substr is overloaded the SqlUnresolvedFunction is not replaced
with the correct operator class until we try to infer the return type in
SqlValidatorImpl
<https://github.com/julianhyde/optiq/blob/master/core/src/main/java/org/eigenbase/sql/validate/SqlValidatorImpl.java#L3877>
which eventually delegates to SqlFunction
<https://github.com/julianhyde/optiq/blob/master/core/src/main/java/org/eigenbase/sql/SqlFunction.java#L290>
to replace the operator with the correct class and passes the validation
phase successfully. The problem seems to be that we aren't performing
similar replacement when we try and convert to Rel nodes.
I don't have a test case reproducible within Optiq yet, I'll try to see
if I can put together one.
Thanks
Mehant
On 6/10/14, 6:42 AM, Vladimir Sitnikov wrote:
As far as I remember, replacement of SqlUnresolvedFunction operator with
the correct one is performed in
https://github.com/julianhyde/optiq/blob/master/core/src/main/java/org/eigenbase/sql/validate/SqlValidatorImpl.java#L894
The code seems to lack support of user defined functions with multiple
overloads.
As far as I remember, I did try using functions with same name and
different arguments (e.g. to_char(Department), to_char(Employee), etc) and
it fails in beautiful ways.
Mehant, can you please clarify if substr operator has multiple overloads?
Can you reproduce the case using Optiq code base?
--
Vladimir Sitnikov