Ok, thanks I thought that if I added a binary operator with the same name as CONCAT then in the case when function signature is different that <STRING> || <STRING>, calcite would try to find another function that has suitable signature. But looks like things are not so easy
On Thu, Apr 28, 2022 at 5:11 PM Benchao Li <[email protected]> wrote: > Hi Dmitry, > > I think `SqlLibraryOperators` is designed to extend the standard operator > table, instead of > overriding. There is already an operator in `SqlStdOperatorTable`[1], the > error shows > that the parser still picks the one in `SqlStdOperatorTable`. > > Besides that, '||' is hardcoded in the parser[2]. Hence it's not resolved > from the operator > table. > > In my opinion, if you want to extends '||' to support ARRAY, you may need > to change the > definition in `SqlStdOperatorTable`[1] to achieve that. > > [1] > > https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java#L263 > [2] > > https://github.com/apache/calcite/blob/main/core/src/main/codegen/templates/Parser.jj#L7174 > > Dmitry Sysolyatin <[email protected]> 于2022年4月28日周四 18:15写道: > > > Hi! > > I want the operator '||' to work with arrays not only with strings. > > Array concatenation logic was already implemented in ARRAY_CONCAT > function. > > But if I add a new binary operator: > > - > > > > > https://github.com/apache/calcite/commit/6f35521aa67378ab0756fe074cda375e17c7ce96 > > > > Added test still fails with the same error as before: > > Cannot apply '||' to arguments of type '<INTEGER ARRAY> || <INTEGER > > ARRAY>'. Supported form(s): '<STRING> || <STRING>' > > > > What I am doing wrong? > > > > > -- > > Best, > Benchao Li >
