I've got to the bottom of this, it is indeed a bug [1]

The workaround is to use a different overload [2], this works:

CompiledQueryFunc<ICacheEntry<string, Employee>> issueqry =
    CompiledQuery.Compile(queryable.Where(emp => emp.Value.Name ==
"unused_value"));

foreach (var entry in issueqry("abc"))
    Console.WriteLine(">>>    " + entry.Value.Name);


[1] https://issues.apache.org/jira/browse/IGNITE-11985
[2]
https://ignite.apache.org/releases/latest/dotnetdoc/api/Apache.Ignite.Linq.CompiledQuery.html#Apache_Ignite_Linq_CompiledQuery_Compile__1_System_Linq_IQueryable___0__

On Mon, Jul 15, 2019 at 8:04 PM Alexandr Shapkin <[email protected]> wrote:

> Hi!
>
>
>
> As I understand correctly, right now CompiledQuery won’t work if there is
> a non-primitive value inside the WHERE clause.
>
>
>
> This seems like a bug for me, because it’s pretty common to treat String
> class as a primitive one.
>
> Right now you can rewrite your query to “x.Contains(y)” or
> “x.StartsWith(y)”, but it’s not the same as Equals.
>
>
>
> *From: *siva <[email protected]>
> *Sent: *Friday, July 12, 2019 9:36 PM
> *To: *[email protected]
> *Subject: *RE: Error compiling query: entire LINQ expression should
> bespecifiedwithin lambda passed to Compile method. Part of the query can't
> beoutsidethe Compile method call.
>
>
>
> Hi ,
>
>
>
>
>
> Thanks for reply
>
>
>
>
>
> i have attached sample code  git hub link.please verify it .
>
>
>
>
>
>
>
>
>
>
>
>
>
> Thanks
>
> siva https://github.com/cvakarna/ApacheIgnite/blob/master/Program.cs
>
> <https://github.com/cvakarna/ApacheIgnite/blob/master/Program.cs>
>
>
>
>
>
>
>
> --
>
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
>
>

Reply via email to