You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by fluffy <fh...@gmail.com> on 2015/06/16 22:47:37 UTC

SQL Query Regular Expression

Does anyone know what the Ignite capabilities are regarding SQL and Regular
Expressions?

Specifically, I am trying to do an SQLFieldQuery based on 2 fields where I
would like the text to start with a sequence of characters. In regular SQL
speak, this can be done using the '^' character at the beginning of the
regular expression. 

However, I tried putting the '^' character in my SQLFieldQuery as well as in
the setArgs() method, but neither seemed to work.

Does anyone have more detailed on Ignite Regular Expressions?

Thanks much,
Florian



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/SQL-Query-Regular-Expression-tp505.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: SQL Query Regular Expression

Posted by fluffy <fh...@gmail.com>.
Thanks Alexey, that was exactly what I was looking for....



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/SQL-Query-Regular-Expression-tp505p597.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: SQL Query Regular Expression

Posted by Alexey Goncharuk <al...@gmail.com>.
SQL grammar and limitations are fully defined by the H2 SQL rules as Ignite
uses H2 as the underlying SQL engine:
http://www.h2database.com/html/grammar.html#condition

For your case something like "SELECT * FORM Table WHERE column REGEXP
'^abc' " should work. The documentation says that regular java Matcher.find
rules are applied. Note, though, that indexes most likely will not be
involved in such a query (this is just my speculation, maybe Sergi can shed
more light on this).
However, for your case the following query will also work: "SELECT * FORM
Table WHERE column LIKE 'abc%' ". Such syntax allows to do less than
regexp, but this query should be able to pick up an index.

Finally, if neither of the above works for you, you can plug a custom SQL
function with @QuerySqlFunction annotation and do whatever filtering you
want.

Hope this helps,
AG

2015-06-16 13:47 GMT-07:00 fluffy <fh...@gmail.com>:

> Does anyone know what the Ignite capabilities are regarding SQL and Regular
> Expressions?
>
> Specifically, I am trying to do an SQLFieldQuery based on 2 fields where I
> would like the text to start with a sequence of characters. In regular SQL
> speak, this can be done using the '^' character at the beginning of the
> regular expression.
>
> However, I tried putting the '^' character in my SQLFieldQuery as well as
> in
> the setArgs() method, but neither seemed to work.
>
> Does anyone have more detailed on Ignite Regular Expressions?
>
> Thanks much,
> Florian
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/SQL-Query-Regular-Expression-tp505.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>