ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Daschinsky <ivanda...@gmail.com>
Subject Re: Ignite 3.0 Tuple API: how to check if value is null?
Date Tue, 06 Jul 2021 09:12:42 GMT
Ah, I see, you meant Optionals family. Yep, it is worth to think about.

вт, 6 июл. 2021 г., 10:06 Pavel Tupitsyn <ptupitsyn@apache.org>:

> Ivan,
>
> Nothing wrong except for performance concerns.
> The following code looks up the column by name twice:
>
> if (!tuple.isNull("weight"))
>    doSomething(tuple.floatValue("weight"))
>
> Whereas in other languages you could do it in one shot:
>
> if (tuple.TryGetFloatValue("weight", out var weight))
>     doSomething(weight)
>
> or Option<float> weight = tuple.floatValue("weight") and so on.
>
> On Tue, Jul 6, 2021 at 9:58 AM Ivan Daschinsky <ivandasch@gmail.com>
> wrote:
>
> > Sorry, but what is wrong with simple method isNull()
> >
> > вт, 6 июл. 2021 г., 09:55 Pavel Tupitsyn <ptupitsyn@apache.org>:
> >
> > > Val,
> > >
> > > > I don't think there is a significantly better way
> > > > of doing this in Java.
> > >
> > > Yep looks like there is no way to return two values without boxing.
> > > No ref, no out, no value types.
> > >
> > > > Schema already provides this information, doesn't it?
> > >
> > > It does, though we don't have an agreement on how to expose this on
> > public
> > > API yet,
> > > or do we?
> > >
> > > On Tue, Jul 6, 2021 at 12:44 AM Valentin Kulichenko <
> > > valentin.kulichenko@gmail.com> wrote:
> > >
> > > > Pavel,
> > > >
> > > > That's a good point, but I don't think there is a significantly
> better
> > > way
> > > > of doing this in Java.
> > > >
> > > > There should be a way to check if a field is nullable or not though.
> > > Schema
> > > > already provides this information, doesn't it?
> > > >
> > > > -Val
> > > >
> > > > On Mon, Jul 5, 2021 at 11:03 AM Pavel Tupitsyn <ptupitsyn@apache.org
> >
> > > > wrote:
> > > >
> > > > > Igniters,
> > > > >
> > > > > Looks like Tuple API has no efficient way to tell if a value for
a
> > > > nullable
> > > > > column of primitive type is null.
> > > > >
> > > > > - Tuple#intValue() will return 0 when the actual value is null =>
> not
> > > > clear
> > > > > if 0 is 0 or null.
> > > > > - Tuple#value() works, but is more expensive due to boxing and type
> > > > lookup.
> > > > >
> > > > > Any ideas on how to improve this?
> > > > >
> > > >
> > >
> >
>

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