calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: Extending/adding SQL operators
Date Wed, 30 Dec 2015 05:28:02 GMT
To add a new infix operator such as ILIKE you will need to extend the parser. It makes sense
if you think about it — you will need to make ILIKE into a keyword (possibly reserved) otherwise
the parser wouldn’t know whether ILIKE is supposed to be an identifier.

As you have discovered, Calcite’s operator table contains operators of various syntactic
types - function, prefix, postfix, infix - but only operators with function syntax can be
handled without changing the parser.

Creating your own variant of the parser is not too difficult — see https://issues.apache.org/jira/browse/PHOENIX-1706
for how we did it in Phoenix.

Julian


> On Dec 29, 2015, at 9:38 AM, Homer <logsplitter4401@gmail.com> wrote:
> 
> Hi,
> 
> I have been fiddling around with UDF functions in calcite and it all seems to work as
expected.
> 
> What I am wondering is there a way to add/extend operators in calcite?
> 
> Lets say I wanted to have a syntax similar to postgress for ILIKE (case insensitive LIKE)
> 
> It appears I can create an operator for ILIKE but I do not seem to be able to get it
wired in a way that it works without bracketing.
> 
> Is it possible?  If so is there an example somewhere of something similar.
> 
> regards
> Homer


Mime
View raw message