ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergi Vladykin <sergi.vlady...@gmail.com>
Subject Re: Sorting fields of Binarilyzable objects on write
Date Mon, 10 Apr 2017 17:43:16 GMT
I'm sorry, looks like I do not really well understand this stuff, but it is
still not clear to me why wouldn't we just take the order of key fields
given in QueryEntity and use it for both cases irrespectively to the order
of fields in regular Class or in Binarylizable?

I mean lets say we have a Class (with unpredictable order of fields
according to reflection):

   Person implements Serializable
      {int age, double salary}

Or we have a Binarylizable (with some unknown user defined order of fields):

  Person implements Binarylizable {
     writeBinary(w) {w.writeDouble("salary", salary),  w.writeInt(''age",
age)}

Also we have a QueryEntity (age, salary)

Why we can not take key fields names from QueryEntity in the given order
(age, salary) and get values from either "regular" Class or from
Binarylizable and calculate hash code?

Sergi

2017-04-10 19:56 GMT+03:00 Vladimir Ozerov <vozerov@gridgain.com>:

> Guys,
>
> The problem is that order of fields serialization is unknown for regular
> objects, where "regular" stands for non-Binarilyzable class. Reflection
> returns fields in unpredictable order. For this reason you cannot match
> fields order between class and QueryEntity. This is why we introduced
> sorting, and this is why idea to rely on QueryEntity doesn't work.
>
> On Mon, Apr 10, 2017 at 7:01 PM, Sergi Vladykin <sergi.vladykin@gmail.com>
> wrote:
>
> > Why "regular" are different here?
> >
> > Sergi
> >
> > 2017-04-10 18:59 GMT+03:00 Pavel Tupitsyn <ptupitsyn@gridgain.com>:
> >
> > > QueryEntity sorting is not an option for "regular" classes with
> > reflective
> > > serialization.
> > > We have to use alphabetical.
> > > Also, same class can participate in multiple query entities.
> > >
> > > 10 апр. 2017 г. 18:52 пользователь "Dmitriy Setrakyan" <
> > > dsetrakyan@apache.org> написал:
> > >
> > > On Mon, Apr 10, 2017 at 8:28 AM, Sergi Vladykin <
> > sergi.vladykin@gmail.com>
> > > wrote:
> > >
> > > > The decision to use alphabetic order looks strange here. Using order
> > > > provided in QueryEntity and require from user to have the same order
> > > > in Binarylizable
> > > > looks more reasonable.
> > > >
> > >
> > > I think this would be much harder to verify. Alphabetical order is more
> > > intuitive, no?
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message