ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Goncharuk <alexey.goncha...@gmail.com>
Subject Re: Sorting fields of Binarilyzable objects on write
Date Thu, 13 Apr 2017 10:56:57 GMT
Dmitriy,

How would then reader determine which field to read (a and b could the of
different size)? c in this case must be written first.

2017-04-13 0:29 GMT+03:00 Dmitriy Setrakyan <dsetrakyan@apache.org>:

> Vladimir,
>
> Would this be valid?
>
> *void writeBinary(BinaryWriter w) {*
>
> *    if (c)*
> *        w.writeInt("A", a)*
> *    else*
> *        w.writeInt("B", b)*
>
> *    w.writeBoolean("C", c);*
> *}*
>
> D.
>
> On Wed, Apr 12, 2017 at 1:07 AM, Vladimir Ozerov <vozerov@gridgain.com>
> wrote:
>
> > Consider the following code:
> >
> > void writeBinary(BinaryWriter w) {
> >     w.writeBoolean("C", c);
> >
> >     if (c)
> >         w.writeInt("A", a)
> >     else
> >         w.writeInt("B", b)
> > }
> >
> > How are we going to force user to follow the contract in this case?
> >
> > On Wed, Apr 12, 2017 at 9:16 AM, Dmitriy Setrakyan <
> dsetrakyan@apache.org>
> > wrote:
> >
> > > I think it is OK for users to do their own sorting, but we should
> > > definitely validate the correct order and throw an exception if it is
> > not.
> > >
> > > D.
> > >
> > > On Tue, Apr 11, 2017 at 11:02 PM, Pavel Tupitsyn <ptupitsyn@apache.org
> >
> > > wrote:
> > >
> > > > QueryEntity order is not only harder for the users, it will be
> > nightmare
> > > to
> > > > implement.
> > > > What if there is no QueryEntity defined? What if the same class is
> used
> > > in
> > > > multiple QueryEntity?
> > > > I don't think serialization code has to be tied to QueryEntity in any
> > > way,
> > > > this violates separation of concerns.
> > > >
> > > > So I guess we can agree on sorting fields alphabetically.
> > > >
> > > > Let's get to the initial question:
> > > > * Should we do the sorting for the user (performance hit)?
> > > > * Should we at least validate user-defined order?
> > > >
> > > > On Wed, Apr 12, 2017 at 2:12 AM, Dmitriy Setrakyan <
> > > dsetrakyan@apache.org>
> > > > wrote:
> > > >
> > > > > On Tue, Apr 11, 2017 at 1:28 PM, Sergi Vladykin <
> > > > sergi.vladykin@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > I'm just trying to understand the current state of things and
> > risks.
> > > > May
> > > > > be
> > > > > > we need to do some adjustments here before 2.0 to be on the
safe
> > > side.
> > > > > >
> > > > > > Actually looks like this not really important, we just have
to
> > > clearly
> > > > > > document that DML builds keys this way and require from user
to
> do
> > > the
> > > > > same
> > > > > > to be able to use cache API.
> > > > > >
> > > > >
> > > > >
> > > > > I think it is important from the usability stand point. A user can
> > > always
> > > > > sort fields alphabetically in his or her mind. However, trying to
> > > > remember
> > > > > the field order from some QueryEntity is a lot harder.
> > > > >
> > > >
> > >
> >
>

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