> Sorry to bother you,does scan in distribute compute faster than use a
scan in client?

Depends on the use case. Always measure your own scenario.

On Wed, Aug 24, 2022 at 2:34 PM wkhapy...@gmail.com <wkhapy...@gmail.com>
wrote:

> Sorry to bother you,does scan in distribute compute faster than use a scan
> in client?
>
> ---Original---
> *From:* "Pavel Tupitsyn"<ptupit...@apache.org>
> *Date:* Wed, Aug 24, 2022 19:14 PM
> *To:* "user"<user@ignite.apache.org>;
> *Subject:* Re: distributed-computing error
> System.Runtime.Serialization.ISerializable
>
> This line is the problem:
> public ICache<string, T> IgniteCache { get; set; }
>
> You can't serialize an Ignite cache. Instead, use [InstanceResource] -
> uncomment the line you already have, then get the cache by name:
>
> [InstanceResource] private readonly IIgnite _ignite;
> public string CacheName { get; set; }
>
> ...
>
> var cache = _ignite.GetCache<string, T>(CacheName);
> cache.Query(...)
>
> On Wed, Aug 24, 2022 at 1:31 PM Charlin S <charli...@hotelhub.com> wrote:
>
>> Hi,
>> The exception details are as follows.
>> System.AggregateException
>>   HResult=0x80131500
>>   Message=One or more errors occurred. (Serializing delegates is not
>> supported on this platform.)
>>   Source=System.Private.CoreLib
>>   StackTrace:
>>    at System.Threading.Tasks.Task`1.GetResultCore(Boolean
>> waitCompletionNotification)
>>    at System.Threading.Tasks.Task`1.get_Result()
>>    at Apache.Ignite.Core.Impl.Common.Future`1.Get()
>>    at
>> Apache.Ignite.Core.Impl.Compute.Compute.Apply[TArg,TJobRes](IComputeFunc`2
>> clo, TArg arg)
>>    at ConsoleApp2.CacheUtils.ComputeTest_OnIgnite(String searchCriteria)
>> in D:\NGSourceCode\POC\ConsoleApp2\ConsoleApp2\CacheUtils.cs:line 76
>>    at ConsoleApp2.Program.Main(String[] args) in
>> D:\NGSourceCode\POC\ConsoleApp2\ConsoleApp2\Program.cs:line 19
>>
>>   This exception was originally thrown at this call stack:
>>
>> System.MulticastDelegate.GetObjectData(System.Runtime.Serialization.SerializationInfo,
>> System.Runtime.Serialization.StreamingContext)
>>
>> Apache.Ignite.Core.Impl.Binary.SerializableSerializer.WriteBinary<T>(T,
>> Apache.Ignite.Core.Impl.Binary.BinaryWriter)
>>     Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write<T>(T)
>>     Apache.Ignite.Core.Impl.Binary.BinaryWriter.WriteObject<T>(string, T)
>>
>> Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary<T>(T,
>> Apache.Ignite.Core.Impl.Binary.BinaryWriter)
>>     Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write<T>(T)
>>     Apache.Ignite.Core.Impl.Binary.BinaryWriter.WriteObject<T>(string, T)
>>
>> Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary<T>(T,
>> Apache.Ignite.Core.Impl.Binary.BinaryWriter)
>>     Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write<T>(T)
>>     Apache.Ignite.Core.Impl.Binary.BinaryWriter.WriteObject<T>(string, T)
>>     ...
>>     [Call Stack Truncated]
>>
>> Inner Exception 1:
>> SerializationException: Serializing delegates is not supported on this
>> platform.
>>
>> Note: I am having two 2 server nodes and running the POC application on a
>> client node.
>>
>> Regards,
>> Charlin
>>
>>
>>
>> On Wed, 24 Aug 2022 at 15:02, Pavel Tupitsyn <ptupit...@apache.org>
>> wrote:
>>
>>> Please share the exception with full stack trace (you've only shared
>>> some warnings, which may or may not be a problem).
>>>
>>> On Wed, Aug 24, 2022 at 10:26 AM Charlin S <charli...@hotelhub.com>
>>> wrote:
>>>
>>>>
>>>> I have a requirement to fetch the data using distributed-computing
>>>> function and  error at
>>>> var res =
>>>> CacheInstance.Instance.InstanceObject.GetCompute().Call(calls);
>>>>
>>>> //  InstanceObject singleton object for Ignite
>>>>
>>>> [11:16:34,865][WARNING][main][Marshaller] Type
>>>> 'System.Collections.Generic.Dictionary`2[System.Int64,Apache.Ignite.Core.Impl.Binary.BinaryFullTypeDescriptor]'
>>>> implements 'System.Runtime.Serialization.ISerializable'. It will be written
>>>> in Ignite binary format, however, the following limitations apply: DateTime
>>>> fields would not work in SQL; sbyte, ushort, uint, ulong fields would not
>>>> work in DML.
>>>> [11:16:34,889][WARNING][main][Marshaller] Type
>>>> 'System.Collections.Generic.Dictionary`2[System.String,System.Byte]'
>>>> implements 'System.Runtime.Serialization.ISerializable'. It will be written
>>>> in Ignite binary format, however, the following limitations apply: DateTime
>>>> fields would not work in SQL; sbyte, ushort, uint, ulong fields would not
>>>> work in DML.
>>>> [11:16:34,895][WARNING][main][Marshaller] Type
>>>> 'System.Func`2[Apache.Ignite.Core.Impl.Binary.BinaryReader,Apache.Ignite.Core.Impl.Compute.ComputeJobHolder]'
>>>> implements 'System.Runtime.Serialization.ISerializable'. It will be written
>>>> in Ignite binary format, however, the following limitations apply: DateTime
>>>> fields would not work in SQL; sbyte, ushort, uint, ulong fields would not
>>>> work in DML.
>>>>
>>>> Kindly help me on this and I have shared the implementation below.
>>>>
>>>>  public class ComputeTestModel : IBinarizable
>>>>     {
>>>>
>>>>         [QuerySqlField]
>>>>         public string TestField1 { get; set; }
>>>>         [QuerySqlField]
>>>>         public string TestField2 { get; set; }
>>>>         [QuerySqlField]
>>>>         public string TestField3 { get; set; }
>>>>
>>>>
>>>>         public void ReadBinary(IBinaryReader reader){}//not added
>>>> implementation here
>>>>         public void WriteBinary(IBinaryWriter writer){}//not added
>>>> implementation here
>>>>     }
>>>>
>>>>
>>>> class TestModelComputeFunc<T> : IComputeFunc<List<ComputeTestModel>>
>>>>     {
>>>>         // [InstanceResource] private readonly IIgnite _ignite;
>>>>         public ICache<string, T> IgniteCache { get; set; }
>>>>
>>>>         public string _searchCriteria { get; set; }
>>>>         public TestModelComputeFunc(ICache<string, T> igniteCache,
>>>> string searchCriteria)
>>>>         {
>>>>             IgniteCache = igniteCache;
>>>>             _searchCriteria = searchCriteria;
>>>>         }
>>>>         public List<ComputeTestModel> Invoke()
>>>>         {
>>>>             List<ComputeTestModel> objs = new List<ComputeTestModel>();
>>>>             string query = "select * from ComputeTestModel where
>>>>  TestField1 = ?";
>>>>             SqlFieldsQuery fieldsQuery =  new SqlFieldsQuery(query,
>>>> _searchCriteria);
>>>>             IFieldsQueryCursor queryCursor =
>>>> IgniteCache.Query(fieldsQuery);
>>>>             if (queryCursor != null)
>>>>             {
>>>>                 foreach (var cacheEntry in queryCursor)
>>>>                 {
>>>>                     objs.Add(new ComputeTestModel
>>>>                     {
>>>>                         TestField1 = cacheEntry[0] as string,
>>>>                         TestField2 = cacheEntry[1] as string,
>>>> TestField3 = cacheEntry[2] as string
>>>>
>>>>                     });
>>>>                 }
>>>>                 return objs;
>>>>
>>>>             }
>>>>             return null;
>>>>         }
>>>>     }
>>>> }
>>>>
>>>> public static class CacheUtilsTest
>>>>     {
>>>> public static List<ComputeTestModel> ComputeTest_OnIgnite(string
>>>> searchCriteria)
>>>>         {
>>>> //CacheInstance.Instance.ComputeTestICache defined in another class
>>>> public ICache<string, ComputeTestModel> ComputeTestModelICache { get; set; 
>>>> }
>>>>
>>>>             ComputeTestComputeFunc<ComputeTestModel> calls = new
>>>> ComputeTestComputeFunc<ComputeTestModel>(CacheInstance.Instance.ComputeTestICache,
>>>> searchCriteria);
>>>>
>>>>             // Execute the collection of calls on the cluster.
>>>>             var res =
>>>> CacheInstance.Instance.InstanceObject.GetCompute().Call(calls);
>>>>  //exception thrown here
>>>>
>>>>
>>>> /*
>>>> //another aproach
>>>> ComputeTestComputeFunc<ComputeTestModel> cacheObject = new
>>>> ComputeTestComputeFunc<ComputeTestModel>(CacheInstance.Instance.ComputeTestICache,
>>>> searchCriteria);
>>>> // var calls = CacheInstance.Instance.ComputeTestICache.Select(s =>
>>>> cacheObject).ToList();
>>>>
>>>>              // Execute the collection of calls on the cluster.
>>>>             var res =
>>>> CacheInstance.Instance.InstanceObject.GetCompute().Call(calls);
>>>>  //exception thrown here
>>>> */
>>>>             return null;
>>>>         }
>>>>
>>>> }
>>>>
>>>>
>>>> class Program
>>>>     {
>>>>
>>>>         static void Main(string[] args)
>>>>         {
>>>>             // Console.WriteLine("Hello World!");
>>>>             var saticCache = CacheInstance.Instance.InstanceObject;
>>>>
>>>>             var res = CacheUtilsTest.ComputeTest_OnIgnite("A");
>>>>             int ans= res.Count();
>>>>             Console.ReadKey();
>>>>
>>>>         }
>>>>     }
>>>>
>>>> Regards,
>>>> Charlin
>>>>
>>>>
>>>>

Reply via email to