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
