Then you have one more mistake in your code.
Here is the example, which using Scan query with predicate:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java

If you want the community to help you, please share full reproducer.

Evgenii

2018-01-29 11:48 GMT+03:00 Thomas Isaksen <[email protected]>:

> Actually it didn’t help to get the cache with the correct types:
>
>
>
> Ignition.*setClientMode*(true);
> Ignite ignite = Ignition.*start*("/config/gatekeeper-token-config.xml");
> ignite.active(true);
>
> IgniteCache<Long, BinaryObject> skipCache = ignite.cache("skipCache").
> withKeepBinary();
> ScanQuery<Long, BinaryObject> scan2 = new ScanQuery<>((key, value) -> {
>     *LOG*.debug("Key: {} - Value: {}", () -> key, () -> value);
>     return true;
> });
> List<Cache.Entry<Long, BinaryObject>> result2 =
> skipCache.query(scan2).getAll();
> *LOG*.debug("result2: {}", () -> result2);
>
>
>
> Now gives all rows in cache but lambda is ignored.
>
>
>
> 2018-01-29 09:43:22,274 DEBUG [no.toyota.gatekeeper.test.ApplicationTest]
> result2: [{1=SQL_PUBLIC_SKIP_bd79b460_e9c9_425d_8ad5_9ebe2d32c6b3
> [idHash=846274760, hash=2107026056, EXPRESSION=/gatekeeper/credentials]},
> {2=SQL_PUBLIC_SKIP_bd79b460_e9c9_425d_8ad5_9ebe2d32c6b3
> [idHash=1928312257, hash=677512603, EXPRESSION=/swagger]},
> {3=SQL_PUBLIC_SKIP_bd79b460_e9c9_425d_8ad5_9ebe2d32c6b3
> [idHash=1092619788, hash=-422574611, EXPRESSION=/gatekeeper/test]},
> {4=SQL_PUBLIC_SKIP_bd79b460_e9c9_425d_8ad5_9ebe2d32c6b3
> [idHash=1337835760, hash=-57658554, EXPRESSION=/foo/index.html]},
> {5=SQL_PUBLIC_SKIP_bd79b460_e9c9_425d_8ad5_9ebe2d32c6b3
> [idHash=1807911555, hash=-340982938, EXPRESSION=/rainbow.zul]},
> {6=SQL_PUBLIC_SKIP_bd79b460_e9c9_425d_8ad5_9ebe2d32c6b3
> [idHash=324507700, hash=-341590176, EXPRESSION=/swagger.json]}]
>
>
>
> The same happens for static class as predicate but now the result is empty.
>
>
>
> static class Predicate implements IgniteBiPredicate<Long, BinaryObject>
> {
>     @Override
>     public boolean apply(Long aLong, BinaryObject binaryObject)
>     {
>         *LOG*.debug("apply {} {}", aLong, binaryObject);
>         return true;
>     }
> }
>
>
>
> ScanQuery<Long, BinaryObject> scan3 = new ScanQuery<>(new Predicate());
> List<Cache.Entry<Long, BinaryObject>> result3 =
> skipCache.query(scan3).getAll();
> *LOG*.debug("result3 : {}", () -> result3);
>
>
>
> 2018-01-29 09:43:22,331 DEBUG [no.toyota.gatekeeper.test.ApplicationTest]
> result3 : []
>
>
>
>
>
> *From:* Thomas Isaksen [mailto:[email protected]]
> *Sent:* fredag 26. januar 2018 21.12
> *To:* [email protected]; [email protected]
> *Subject:* Re: ScanQuery with predicate always returns empty result.
>
>
>
> Ah! I make silly mistakes too often. I will give it a try. I will also
> make a separate class instead of an inner class. Thanks!
>
>
>
> --
>
> Thomas Isaksen
> ------------------------------
>
> *From:* ezhuravlev <[email protected]>
> *Sent:* Friday, January 26, 2018 3:48:56 PM
> *To:* [email protected]
> *Subject:* Re: ScanQuery with predicate always returns empty result.
>
>
>
> Hi, in case when you use:
> ScanQuery<Long, BinaryObject> scan = new ScanQuery<>((key, value) -> {
>
>                 System.out.println(key + “ = “ + value);
>
>                 return true;
>
> })
> I think the problem is that you created ScanQuery<Long, BinaryObject> while
> your cache is IgniteCache<String, String>. Scan query should be <String,
> String> too.
>
> In case of Inner class, it's trying to serialize your outer class, but it
> faces some problems in this process. Here you can create separate class
> instead of inner, it will help
>
> Evgenii
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to