[ 
https://issues.apache.org/jira/browse/IGNITE-6190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156749#comment-16156749
 ] 

ASF GitHub Bot commented on IGNITE-6190:
----------------------------------------

GitHub user shroman opened a pull request:

    https://github.com/apache/ignite/pull/2608

    IGNITE-6190: Let pass collections as arguments to SQL queries.

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shroman/ignite IGNITE-6190

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/2608.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2608
    
----
commit 7e5a1ad1ad7100cb2f5a35a02aead071bdc03085
Author: shroman <[email protected]>
Date:   2017-09-07T09:41:55Z

    IGNITE-6190: Let pass collections as arguments to SQL queries.

----


> SQL query fails silently if Set is passed as a parameter
> --------------------------------------------------------
>
>                 Key: IGNITE-6190
>                 URL: https://issues.apache.org/jira/browse/IGNITE-6190
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Denis Magda
>            Assignee: Roman Shtykh
>         Attachments: TestIgniteQuery.zip
>
>
> Seems like the SqlQuery API does not like {{Set<?>}} as the input parameter. 
> While this query doesn't work (the Set is used as an input):
> {code}
> public Map<String, Account> getAccountsForLe(Set<String> leId) {
>     SqlQuery<String, Account> query =
>             new SqlQuery<String, Account>(Account.class, "from Account join 
> table(id varchar = ?) i on Account.clientLegalEntityId = i.id")
>                     .setArgs(leId);
>     Map<String, Account> results = new HashMap<>();
>     _cache.query(query).getAll().stream().forEach(e -> 
> results.put(e.getKey(), e.getValue()));
>     return results;
> }
> {code}
> This one works well (the Set is converted to Array explicitly):
> {code}
> public Map<String, Account> getAccountsForLe(Set<String> leId) {
>     SqlQuery<String, Account> query =
>             new SqlQuery<String, Account>(Account.class, "from Account join 
> table(id varchar = ?) i on Account.clientLegalEntityId = i.id")
>                     .setArgs(leId.toArray());
>     Map<String, Account> results = new HashMap<>();
>     _cache.query(query).getAll().stream().forEach(e -> 
> results.put(e.getKey(), e.getValue()));
>     return results;
> }
> {code}
> The fact that it fails silently is an issue. IMHO there should be some 
> validation to alert the calling code that the type specified is not valid or 
> the set has to be transformed to the array on the fly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to