You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Maksim Timonin <ti...@gmail.com> on 2021/08/10 21:07:55 UTC

[DISCUSSION] Allow use QuerySqlField.precision for varlen types

Hi, Igniters!

I dived to the precision param of QuerySqlField and SQL data types. The
javadocs of QuerySqlField say that the param is for decimal type only. But
actually it works for String fields out of the box. So it looks like an
easter egg. I think we should either document it or forbid it.

Also I wonder why it works for String, but not for byte[] (analogue of
binary SQL data type). I made a few minor fixes and then it started to work
[1].

I think that QuerySqlField precision should work the same way as for SQL
variable length types - varchar, binary. Then I propose to allow apply
QuerySqlField.precision on String and byte[]. Is there a known reason to
avoid it?

WDYT?

[1] I've prepared a PR with patch for binary types, and tests for precision
(QuerySqlField and SQL), and fix the javadoc -
https://github.com/apache/ignite/pull/9315

P.S. I discovered that IgniteDataStreamer ignores the precision parameter
for QuerySqlField. I found a ticket that is also broken for notNull -
https://issues.apache.org/jira/browse/IGNITE-10999. It just doesn't work at
all, not only about notNull.

Re: [DISCUSSION] Allow use QuerySqlField.precision for varlen types

Posted by Maksim Timonin <ti...@gmail.com>.
Hi, Ivan!

I prepared a ticket [1] for this patch, and got the TC bot visa. Could you
please have a look at it?

[1] https://issues.apache.org/jira/browse/IGNITE-15302

On Thu, Aug 12, 2021 at 8:52 PM Ivan Daschinsky <iv...@gmail.com> wrote:

> Max, i've the same thoughts about varbinary.
>
> чт, 12 авг. 2021 г. в 18:27, Maksim Timonin <ti...@gmail.com>:
>
> > Hi, Ivan!
> >
> > I agree about String. It looks like there is someone who just forgot to
> > document it.
> >
> > But what about binary? H2 supports varbinary type (along with varchar).
> So
> > I think we can easily support it.
> >
> > Also it will open the door to an improved inline size calculation for
> > binary types the same way as it's aiming to do for varchar (ticket [1]
> > "Improve inline index defaults").
> >
> > Igniters, WDYT?
> >
> > [1] https://issues.apache.org/jira/browse/IGNITE-13364
> >
> > On Wed, Aug 11, 2021 at 1:12 PM Ivan Daschinsky <iv...@gmail.com>
> > wrote:
> >
> > > Hi, I suppose that we should add javadoc to QuerySqlFileds. It is weird
> > > that this feature is not documented.
> > >
> > > ср, 11 авг. 2021 г. в 00:08, Maksim Timonin <ti...@gmail.com>:
> > >
> > > > Hi, Igniters!
> > > >
> > > > I dived to the precision param of QuerySqlField and SQL data types.
> The
> > > > javadocs of QuerySqlField say that the param is for decimal type
> only.
> > > But
> > > > actually it works for String fields out of the box. So it looks like
> an
> > > > easter egg. I think we should either document it or forbid it.
> > > >
> > > > Also I wonder why it works for String, but not for byte[] (analogue
> of
> > > > binary SQL data type). I made a few minor fixes and then it started
> to
> > > work
> > > > [1].
> > > >
> > > > I think that QuerySqlField precision should work the same way as for
> > SQL
> > > > variable length types - varchar, binary. Then I propose to allow
> apply
> > > > QuerySqlField.precision on String and byte[]. Is there a known reason
> > to
> > > > avoid it?
> > > >
> > > > WDYT?
> > > >
> > > > [1] I've prepared a PR with patch for binary types, and tests for
> > > precision
> > > > (QuerySqlField and SQL), and fix the javadoc -
> > > > https://github.com/apache/ignite/pull/9315
> > > >
> > > > P.S. I discovered that IgniteDataStreamer ignores the precision
> > parameter
> > > > for QuerySqlField. I found a ticket that is also broken for notNull -
> > > > https://issues.apache.org/jira/browse/IGNITE-10999. It just doesn't
> > work
> > > > at
> > > > all, not only about notNull.
> > > >
> > >
> > >
> > > --
> > > Sincerely yours, Ivan Daschinskiy
> > >
> >
>
>
> --
> Sincerely yours, Ivan Daschinskiy
>

Re: [DISCUSSION] Allow use QuerySqlField.precision for varlen types

Posted by Ivan Daschinsky <iv...@gmail.com>.
Max, i've the same thoughts about varbinary.

чт, 12 авг. 2021 г. в 18:27, Maksim Timonin <ti...@gmail.com>:

> Hi, Ivan!
>
> I agree about String. It looks like there is someone who just forgot to
> document it.
>
> But what about binary? H2 supports varbinary type (along with varchar). So
> I think we can easily support it.
>
> Also it will open the door to an improved inline size calculation for
> binary types the same way as it's aiming to do for varchar (ticket [1]
> "Improve inline index defaults").
>
> Igniters, WDYT?
>
> [1] https://issues.apache.org/jira/browse/IGNITE-13364
>
> On Wed, Aug 11, 2021 at 1:12 PM Ivan Daschinsky <iv...@gmail.com>
> wrote:
>
> > Hi, I suppose that we should add javadoc to QuerySqlFileds. It is weird
> > that this feature is not documented.
> >
> > ср, 11 авг. 2021 г. в 00:08, Maksim Timonin <ti...@gmail.com>:
> >
> > > Hi, Igniters!
> > >
> > > I dived to the precision param of QuerySqlField and SQL data types. The
> > > javadocs of QuerySqlField say that the param is for decimal type only.
> > But
> > > actually it works for String fields out of the box. So it looks like an
> > > easter egg. I think we should either document it or forbid it.
> > >
> > > Also I wonder why it works for String, but not for byte[] (analogue of
> > > binary SQL data type). I made a few minor fixes and then it started to
> > work
> > > [1].
> > >
> > > I think that QuerySqlField precision should work the same way as for
> SQL
> > > variable length types - varchar, binary. Then I propose to allow apply
> > > QuerySqlField.precision on String and byte[]. Is there a known reason
> to
> > > avoid it?
> > >
> > > WDYT?
> > >
> > > [1] I've prepared a PR with patch for binary types, and tests for
> > precision
> > > (QuerySqlField and SQL), and fix the javadoc -
> > > https://github.com/apache/ignite/pull/9315
> > >
> > > P.S. I discovered that IgniteDataStreamer ignores the precision
> parameter
> > > for QuerySqlField. I found a ticket that is also broken for notNull -
> > > https://issues.apache.org/jira/browse/IGNITE-10999. It just doesn't
> work
> > > at
> > > all, not only about notNull.
> > >
> >
> >
> > --
> > Sincerely yours, Ivan Daschinskiy
> >
>


-- 
Sincerely yours, Ivan Daschinskiy

Re: [DISCUSSION] Allow use QuerySqlField.precision for varlen types

Posted by Maksim Timonin <ti...@gmail.com>.
Hi, Ivan!

I agree about String. It looks like there is someone who just forgot to
document it.

But what about binary? H2 supports varbinary type (along with varchar). So
I think we can easily support it.

Also it will open the door to an improved inline size calculation for
binary types the same way as it's aiming to do for varchar (ticket [1]
"Improve inline index defaults").

Igniters, WDYT?

[1] https://issues.apache.org/jira/browse/IGNITE-13364

On Wed, Aug 11, 2021 at 1:12 PM Ivan Daschinsky <iv...@gmail.com> wrote:

> Hi, I suppose that we should add javadoc to QuerySqlFileds. It is weird
> that this feature is not documented.
>
> ср, 11 авг. 2021 г. в 00:08, Maksim Timonin <ti...@gmail.com>:
>
> > Hi, Igniters!
> >
> > I dived to the precision param of QuerySqlField and SQL data types. The
> > javadocs of QuerySqlField say that the param is for decimal type only.
> But
> > actually it works for String fields out of the box. So it looks like an
> > easter egg. I think we should either document it or forbid it.
> >
> > Also I wonder why it works for String, but not for byte[] (analogue of
> > binary SQL data type). I made a few minor fixes and then it started to
> work
> > [1].
> >
> > I think that QuerySqlField precision should work the same way as for SQL
> > variable length types - varchar, binary. Then I propose to allow apply
> > QuerySqlField.precision on String and byte[]. Is there a known reason to
> > avoid it?
> >
> > WDYT?
> >
> > [1] I've prepared a PR with patch for binary types, and tests for
> precision
> > (QuerySqlField and SQL), and fix the javadoc -
> > https://github.com/apache/ignite/pull/9315
> >
> > P.S. I discovered that IgniteDataStreamer ignores the precision parameter
> > for QuerySqlField. I found a ticket that is also broken for notNull -
> > https://issues.apache.org/jira/browse/IGNITE-10999. It just doesn't work
> > at
> > all, not only about notNull.
> >
>
>
> --
> Sincerely yours, Ivan Daschinskiy
>

Re: [DISCUSSION] Allow use QuerySqlField.precision for varlen types

Posted by Ivan Daschinsky <iv...@gmail.com>.
Hi, I suppose that we should add javadoc to QuerySqlFileds. It is weird
that this feature is not documented.

ср, 11 авг. 2021 г. в 00:08, Maksim Timonin <ti...@gmail.com>:

> Hi, Igniters!
>
> I dived to the precision param of QuerySqlField and SQL data types. The
> javadocs of QuerySqlField say that the param is for decimal type only. But
> actually it works for String fields out of the box. So it looks like an
> easter egg. I think we should either document it or forbid it.
>
> Also I wonder why it works for String, but not for byte[] (analogue of
> binary SQL data type). I made a few minor fixes and then it started to work
> [1].
>
> I think that QuerySqlField precision should work the same way as for SQL
> variable length types - varchar, binary. Then I propose to allow apply
> QuerySqlField.precision on String and byte[]. Is there a known reason to
> avoid it?
>
> WDYT?
>
> [1] I've prepared a PR with patch for binary types, and tests for precision
> (QuerySqlField and SQL), and fix the javadoc -
> https://github.com/apache/ignite/pull/9315
>
> P.S. I discovered that IgniteDataStreamer ignores the precision parameter
> for QuerySqlField. I found a ticket that is also broken for notNull -
> https://issues.apache.org/jira/browse/IGNITE-10999. It just doesn't work
> at
> all, not only about notNull.
>


-- 
Sincerely yours, Ivan Daschinskiy