Igniters, 

Want to clarify my proposal about new array store format.
I think we should store array in special binary wrapper that will keep original 
component type

```
public class BinaryArrayWrapper implements BinaryObjectEx, Externalizable {
    /** Type ID. */
    private int compTypeId;

    /** Raw data. */
    private String compClsName;

    /** Value. */
    private Object[] arr;
    
    // Further implementation.
}
```


> 30 апр. 2021 г., в 16:31, Nikolay Izhikov <nizhikov....@gmail.com> написал(а):
> 
> Hello, Igniters.
> 
> Currently, binary marshaller works as follows(Say, we have a class `User` 
> then):
> 
> IgniteBinary#toBinary(User)` -> BinaryObject
> IgniteBinary#toBinary(User[])` -> Object[]
> IgniteBinary#toBinary(Object[])` -> Object[]
> 
> This means, that we lose array component type information during binary 
> serialization.
> AFAIK, it’s a design choice made during binary infrastructure development.
> 
> This lead to the following disadvantages:
> 
> 1. `IgniteBinary` can’t be used as a universal SerDe mechanism.
> 2. Ignite internals(service grid, .Net calls) contains many tweaks and hacks 
> to deal with custom user array and still has many issues [1]
> 
> I propose to make breaking changes and fix the custom user array SeDe as 
> follows:
> 
>       1. Implement binary serialization that correctly Ser and Deser array 
> using some kind of the wrapper (BinaryArrayWrapper).
> 
>               IgniteBinary#toBinary(User)` -> BinaryObject 
>               IgniteBinary#toBinary(User[])` -> BinaryObject
>               IgniteBinary#toBinary(Object[])` -> BinaryObject
> 
>       2. Introduce system flag `IGNITE_USE_BINARY_ARRAY` that enables correct 
> SerDe of arrays. The default value is false to keep backward compatibility in 
> the next Ignite release(2.11).
> 
>       3. Set  `IGNITE_USE_BINARY_ARRAY` to `true` in the ongoing Ignite 
> releases (2.12).
> 
> WDYT?
> 
> [1] https://issues.apache.org/jira/browse/IGNITE-14299

Reply via email to