Hello Aron,
sorry I forgot to cover the part regarding the modulo operation.

Calcite again follows the standard on that respect, and the SQL standard
says:

<modulus expression> operates on two exact numeric arguments with scale 0
> (zero) and returns
> the modulus (remainder) of the first argument divided by the second
> argument as an exact
> numeric with scale 0 (zero).


I am under the impression that you are trying to apply the modulus (mod)
operator over an approximate number, which is not supported as we have seen
above.

Best regards,
Alessandro

On Fri, 16 Oct 2020 at 05:02, JiaTao Tao <taojia...@gmail.com> wrote:

> Thanks, Alessandro Solimando
> Got it, very clear explanation.
> My main question here becomes that calcite doesn't support double mod.
>
> Regards!
>
> Aron Tao
>
>
> Alessandro Solimando <alessandro.solima...@gmail.com> 于2020年10月15日周四
> 下午10:32写道:
>
> > Hi Aron Tao,
> > Calcite adheres to SQL standard in that respect (citing):
> >
> > The data types NUMERIC, DECIMAL, INTEGER and SMALLINT are collectively
> > > referred to
> > > as exact numeric types.
> >
> >
> >
> > The data types FLOAT, REAL, and DOUBLE PRECISION are collectively
> referred
> > > to as approx-
> > > imate numeric types.
> >
> >
> > In practice the way we represent a number can lead to an exact (scale +
> > precision) or an approximate (base + mantissa) representation, which
> suits
> > very different needs.
> >
> > Best regards,
> > Alessandro
> >
> > On Thu, 15 Oct 2020 at 16:16, JiaTao Tao <taojia...@gmail.com> wrote:
> >
> > > In calcite, you can not mod doubles. In Java, you can, in C you can't
> use
> > > "%" to mod doubles, but you can use fmod.
> > >
> > > Regards!
> > >
> > > Aron Tao
> > >
> > >
> > > JiaTao Tao <taojia...@gmail.com> 于2020年10月15日周四 下午10:00写道:
> > >
> > > > org.apache.calcite.sql.type.SqlTypeName#APPROX_TYPES
> > > > org.apache.calcite.sql.type.SqlTypeName#NUMERIC_TYPES
> > > >
> > > > Regards!
> > > >
> > > > Aron Tao
> > > >
> > >
> >
>

Reply via email to