Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

Jens Hoffmann
It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
V> with a custom key K.

I thought this would be a nice task to pick as a first (attempt of a)
contribution, however there is a ticket for this already assigned to
someone: https://issues.apache.org/jira/browse/IGNITE-2852

I haven't seen much activity on it though. Would it be possible for me
to pick it?

Thanks
Jens
Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

Denis Magda
Hi Jens,

This is not the best candidate for the first contribution and presently I don’t think that this feature should be supported at all.

I would recommend you picking up one of the tickets with “newbie” filter.
https://issues.apache.org/jira/issues/?filter=12338037 <https://issues.apache.org/jira/issues/?filter=12338037>

Regards,
Denis

> On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <[hidden email]> wrote:
>
> It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
> V> with a custom key K.
>
> I thought this would be a nice task to pick as a first (attempt of a)
> contribution, however there is a ticket for this already assigned to
> someone: https://issues.apache.org/jira/browse/IGNITE-2852
>
> I haven't seen much activity on it though. Would it be possible for me
> to pick it?
>
> Thanks
> Jens

Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

Jens Hoffmann
Hi Denis,

thanks for clarifying. I'll take a look around Jira instead.

Thanks
Jens

On Wed, Jul 20, 2016 at 1:45 PM, Denis Magda <[hidden email]> wrote:

> Hi Jens,
>
> This is not the best candidate for the first contribution and presently I don’t think that this feature should be supported at all.
>
> I would recommend you picking up one of the tickets with “newbie” filter.
> https://issues.apache.org/jira/issues/?filter=12338037 <https://issues.apache.org/jira/issues/?filter=12338037>
>
> Regards,
> Denis
>
>> On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <[hidden email]> wrote:
>>
>> It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
>> V> with a custom key K.
>>
>> I thought this would be a nice task to pick as a first (attempt of a)
>> contribution, however there is a ticket for this already assigned to
>> someone: https://issues.apache.org/jira/browse/IGNITE-2852
>>
>> I haven't seen much activity on it though. Would it be possible for me
>> to pick it?
>>
>> Thanks
>> Jens
>
Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

dsetrakyan
In reply to this post by Denis Magda
On Wed, Jul 20, 2016 at 2:45 PM, Denis Magda <[hidden email]> wrote:

> Hi Jens,
>
> This is not the best candidate for the first contribution and presently I
> don’t think that this feature should be supported at all.
>

Denis, why not?


>
> I would recommend you picking up one of the tickets with “newbie” filter.
> https://issues.apache.org/jira/issues/?filter=12338037 <
> https://issues.apache.org/jira/issues/?filter=12338037>
>
> Regards,
> Denis
>
> > On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <[hidden email]>
> wrote:
> >
> > It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
> > V> with a custom key K.
> >
> > I thought this would be a nice task to pick as a first (attempt of a)
> > contribution, however there is a ticket for this already assigned to
> > someone: https://issues.apache.org/jira/browse/IGNITE-2852
> >
> > I haven't seen much activity on it though. Would it be possible for me
> > to pick it?
> >
> > Thanks
> > Jens
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

Denis Magda
Dmitriy,

Presently even the guys who spent bunch the time developing and improving binary marshaller don’t have a view on how to implement this feature. So initially we should discuss how to implement it in general and after that decide if the ticket can be taken over by new contributors.


Denis

> On Jul 21, 2016, at 1:18 PM, Dmitriy Setrakyan <[hidden email]> wrote:
>
> On Wed, Jul 20, 2016 at 2:45 PM, Denis Magda <[hidden email]> wrote:
>
>> Hi Jens,
>>
>> This is not the best candidate for the first contribution and presently I
>> don’t think that this feature should be supported at all.
>>
>
> Denis, why not?
>
>
>>
>> I would recommend you picking up one of the tickets with “newbie” filter.
>> https://issues.apache.org/jira/issues/?filter=12338037 <
>> https://issues.apache.org/jira/issues/?filter=12338037>
>>
>> Regards,
>> Denis
>>
>>> On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <[hidden email]>
>> wrote:
>>>
>>> It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
>>> V> with a custom key K.
>>>
>>> I thought this would be a nice task to pick as a first (attempt of a)
>>> contribution, however there is a ticket for this already assigned to
>>> someone: https://issues.apache.org/jira/browse/IGNITE-2852
>>>
>>> I haven't seen much activity on it though. Would it be possible for me
>>> to pick it?
>>>
>>> Thanks
>>> Jens
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

dsetrakyan
Well, in my view we should have that discussion or close this ticket. What
are the challenges there? Is there a dev thread I can review?

On Thu, Jul 21, 2016 at 5:41 AM, Denis Magda <[hidden email]> wrote:

> Dmitriy,
>
> Presently even the guys who spent bunch the time developing and improving
> binary marshaller don’t have a view on how to implement this feature. So
> initially we should discuss how to implement it in general and after that
> decide if the ticket can be taken over by new contributors.
>
> —
> Denis
>
> > On Jul 21, 2016, at 1:18 PM, Dmitriy Setrakyan <[hidden email]>
> wrote:
> >
> > On Wed, Jul 20, 2016 at 2:45 PM, Denis Magda <[hidden email]>
> wrote:
> >
> >> Hi Jens,
> >>
> >> This is not the best candidate for the first contribution and presently
> I
> >> don’t think that this feature should be supported at all.
> >>
> >
> > Denis, why not?
> >
> >
> >>
> >> I would recommend you picking up one of the tickets with “newbie”
> filter.
> >> https://issues.apache.org/jira/issues/?filter=12338037 <
> >> https://issues.apache.org/jira/issues/?filter=12338037>
> >>
> >> Regards,
> >> Denis
> >>
> >>> On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <
> [hidden email]>
> >> wrote:
> >>>
> >>> It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
> >>> V> with a custom key K.
> >>>
> >>> I thought this would be a nice task to pick as a first (attempt of a)
> >>> contribution, however there is a ticket for this already assigned to
> >>> someone: https://issues.apache.org/jira/browse/IGNITE-2852
> >>>
> >>> I haven't seen much activity on it though. Would it be possible for me
> >>> to pick it?
> >>>
> >>> Thanks
> >>> Jens
> >>
> >>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

Jens Hoffmann
A new TreeMap<K, V> gets created when toBinary() is called, and keys
as well as values are converted to binary objects and added to it.
This fails with a CCE because binary objects are not comparable (so
the comparison logic for the keys is lost after conversion).

Not sure whether there are discussions going on in the background due
to the non-newbie nature of this, but my thought was that you force
the programmer to provide the logic how the binary versions of the
keys should be compared. Maybe by requiring the original keys to
implement a org.apache.ignite.binary.BinaryComparable interface
(basically Comparable<BinaryObject>)

Would that make any sense?





On Thu, Jul 21, 2016 at 9:28 PM, Dmitriy Setrakyan
<[hidden email]> wrote:

> Well, in my view we should have that discussion or close this ticket. What
> are the challenges there? Is there a dev thread I can review?
>
> On Thu, Jul 21, 2016 at 5:41 AM, Denis Magda <[hidden email]> wrote:
>
>> Dmitriy,
>>
>> Presently even the guys who spent bunch the time developing and improving
>> binary marshaller don’t have a view on how to implement this feature. So
>> initially we should discuss how to implement it in general and after that
>> decide if the ticket can be taken over by new contributors.
>>
>> —
>> Denis
>>
>> > On Jul 21, 2016, at 1:18 PM, Dmitriy Setrakyan <[hidden email]>
>> wrote:
>> >
>> > On Wed, Jul 20, 2016 at 2:45 PM, Denis Magda <[hidden email]>
>> wrote:
>> >
>> >> Hi Jens,
>> >>
>> >> This is not the best candidate for the first contribution and presently
>> I
>> >> don’t think that this feature should be supported at all.
>> >>
>> >
>> > Denis, why not?
>> >
>> >
>> >>
>> >> I would recommend you picking up one of the tickets with “newbie”
>> filter.
>> >> https://issues.apache.org/jira/issues/?filter=12338037 <
>> >> https://issues.apache.org/jira/issues/?filter=12338037>
>> >>
>> >> Regards,
>> >> Denis
>> >>
>> >>> On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <
>> [hidden email]>
>> >> wrote:
>> >>>
>> >>> It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
>> >>> V> with a custom key K.
>> >>>
>> >>> I thought this would be a nice task to pick as a first (attempt of a)
>> >>> contribution, however there is a ticket for this already assigned to
>> >>> someone: https://issues.apache.org/jira/browse/IGNITE-2852
>> >>>
>> >>> I haven't seen much activity on it though. Would it be possible for me
>> >>> to pick it?
>> >>>
>> >>> Thanks
>> >>> Jens
>> >>
>> >>
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Converting TreeMap to BinaryObject causes ClassCastException (IGNITE-2852)

Valentin Kulichenko
Hi Jens,

The main purpose of binary format is to avoid deploying any classes on
server nodes, but with your approach you will need to deploy the comparator
class. You will also not be able to dynamically change this.

All,

This issue becomes more and more critical as more users face with it in
different situations. I think we should finally come up with some simple
solution which we can then improve. How about we provide an option to
define an ordered set of fields for comparison and save this information in
metadata, so that it can be dynamically changed? Will this work? By default
we can compare all fields in alphabetical order.

Thoughts?

-Val

On Fri, Aug 5, 2016 at 7:27 AM, NoTrueScotsman <[hidden email]>
wrote:

> A new TreeMap<K, V> gets created when toBinary() is called, and keys
> as well as values are converted to binary objects and added to it.
> This fails with a CCE because binary objects are not comparable (so
> the comparison logic for the keys is lost after conversion).
>
> Not sure whether there are discussions going on in the background due
> to the non-newbie nature of this, but my thought was that you force
> the programmer to provide the logic how the binary versions of the
> keys should be compared. Maybe by requiring the original keys to
> implement a org.apache.ignite.binary.BinaryComparable interface
> (basically Comparable<BinaryObject>)
>
> Would that make any sense?
>
>
>
>
>
> On Thu, Jul 21, 2016 at 9:28 PM, Dmitriy Setrakyan
> <[hidden email]> wrote:
> > Well, in my view we should have that discussion or close this ticket.
> What
> > are the challenges there? Is there a dev thread I can review?
> >
> > On Thu, Jul 21, 2016 at 5:41 AM, Denis Magda <[hidden email]>
> wrote:
> >
> >> Dmitriy,
> >>
> >> Presently even the guys who spent bunch the time developing and
> improving
> >> binary marshaller don’t have a view on how to implement this feature. So
> >> initially we should discuss how to implement it in general and after
> that
> >> decide if the ticket can be taken over by new contributors.
> >>
> >> —
> >> Denis
> >>
> >> > On Jul 21, 2016, at 1:18 PM, Dmitriy Setrakyan <[hidden email]
> >
> >> wrote:
> >> >
> >> > On Wed, Jul 20, 2016 at 2:45 PM, Denis Magda <[hidden email]>
> >> wrote:
> >> >
> >> >> Hi Jens,
> >> >>
> >> >> This is not the best candidate for the first contribution and
> presently
> >> I
> >> >> don’t think that this feature should be supported at all.
> >> >>
> >> >
> >> > Denis, why not?
> >> >
> >> >
> >> >>
> >> >> I would recommend you picking up one of the tickets with “newbie”
> >> filter.
> >> >> https://issues.apache.org/jira/issues/?filter=12338037 <
> >> >> https://issues.apache.org/jira/issues/?filter=12338037>
> >> >>
> >> >> Regards,
> >> >> Denis
> >> >>
> >> >>> On Jul 19, 2016, at 9:00 PM, NoTrueScotsman <
> >> [hidden email]>
> >> >> wrote:
> >> >>>
> >> >>> It happens when applying ignite.binary().toBinary(m) to a TreeMap<K,
> >> >>> V> with a custom key K.
> >> >>>
> >> >>> I thought this would be a nice task to pick as a first (attempt of
> a)
> >> >>> contribution, however there is a ticket for this already assigned to
> >> >>> someone: https://issues.apache.org/jira/browse/IGNITE-2852
> >> >>>
> >> >>> I haven't seen much activity on it though. Would it be possible for
> me
> >> >>> to pick it?
> >> >>>
> >> >>> Thanks
> >> >>> Jens
> >> >>
> >> >>
> >>
> >>
>