ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkulichenko <valentin.kuliche...@gmail.com>
Subject Re: Issue with running SQL Scan queries
Date Thu, 28 Jan 2016 20:51:30 GMT
Hi Saurabh,

Can you please properly subscribe to the mailing list so that the community
receives email notifications? Follow the instruction here:
http://apache-ignite-users.70518.x6.nabble.com/mailing_list/MailingListOptions.jtp?forum=1


the100rabh wrote
> Hi,
> I am trying to start testing SQL in Apache Ignite using the following
> code.
> 
>         IgniteBiPredicate&lt;Long, Person&gt; filter = new
> IgniteBiPredicate&lt;Long, Person&gt;() {
>             @Override public boolean apply(Long key, Person p) {
>                 return p.getSalary() > 10000d;
>             }
>         };
>         
>         try (QueryCursor

>  cursor = cache.query(new ScanQuery(filter))) {
>             System.out.println(cursor.toString());
>             for (Object p : cursor)
>                 System.out.println(p.toString());
>         }
> 
> But I get an exception thrown in the last where I try to go over the
> cursor with after the scan query. 
> 
> Caused by: java.lang.ClassNotFoundException:
> co.near.ignite.MainExperiment$Person
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> 	... 14 more

You're running a predicate-based SCAN query. This query invokes the filter
you provide on server nodes, so that only the data you're interested in is
returned. Your implementation expects the Person class to be there, so you
get this error. There are two options to fix it:
- (recommended) Use withKeepBinary() flag and BinaryObject instead of Person
object. See scanQuery() method in [1] for an example.
- Add Person class to classpath of all server nodes.

[1]
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Issue-with-running-SQL-Scan-queries-tp2753p2765.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message