Ok, I understand now. It is a quite common issue, syntax "WHERE name in ?"
is wrong, you have to use exact list of parameters like this:

SqlQuery query = new SqlQuery(ResultType.class, "WHERE name IN (?,?,?)");
query.setArgs("name1", "name2", "name3");

Or create user defined  SQL function (see QuerySqlFunction annotation)
which will accept Set of names, name and does set.contains(name) and call
it like
"WHERE IN_SET(?, name)"

Sergi

2015-08-04 1:32 GMT+03:00 Mirko Raner <[email protected]>:

> On Sat, Aug 1, 2015 at 12:53 PM, Sergi Vladykin [via Apache Ignite Users]
> <[hidden email] <http:///user/SendEmail.jtp?type=node&node=807&i=0>>
> wrote:
>
>> [...]
>> Most probably IN operator works correctly but you do something wrong.
>>
>
> You're probably right about that :-)
> Unfortunately, we already restructured our code, and the logs are long
> gone at this point...
>
> [...]
>>
> How the query looks like? How do you set query arguments?
>>
>>
> Essentially, what we were doing is this (pseudo-code):
>
>   SqlQuery query = new SqlQuery(ResultType.class, "WHERE name IN ?");
>   Set<String> names = getApplicableNames();
>   query.setArgs(names);
>
> In addition to sets, we tried arrays and java.util.List as well, but none
> of them seem to work.
> I looked at GridCacheCrossCacheQuerySelfTest, but it's using
> SqlFieldsQuery not SqlQuery.
>
> If I can find the time I'll try to put together a test case that
> demonstrates what we're doing and what we're expecting, should be a lot
> easier to tell where we're going wrong...
>
> Thanks,
>
> Mirko
>
> ------------------------------
> View this message in context: Re: SQL IN Operator
> <http://apache-ignite-users.70518.x6.nabble.com/SQL-IN-Operator-tp779p807.html>
>
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>

Reply via email to