You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Jesus Camacho Rodriguez <jc...@apache.org> on 2017/04/24 19:32:33 UTC
Lossless cast
Hi all,
Are you aware of any utility methods in Calcite core to identify 'lossless' casts, i.e., casts from which the original value of the field can be certainly recovered?
For instance, int -> bigint is true (as you can cast back to int without loss of information), however bigint -> int is false.
Thanks,
Jesús
Re: Lossless cast
Posted by Jesus Camacho Rodriguez <jc...@apache.org>.
Thanks Julian, I just wanted to make sure there was not one before implementing it. I will add it.
--
Jesús
On 4/24/17, 8:46 PM, "Julian Hyde" <jh...@apache.org> wrote:
>RexUtil.gatherConstraint deals with “widening” casts, which are similar. (Every widening cast is lossless, but not every lossless cast is widening.)
>
>But I don’t see an actual method, with unit tests, that tests for lossless casts. (The obvious places to look would be RexUtil and RexProgramTest.) Feel free to add one. It would be useful.
>
>Julian
>
>
>
>> On Apr 24, 2017, at 12:32 PM, Jesus Camacho Rodriguez <jc...@apache.org> wrote:
>>
>> Hi all,
>>
>> Are you aware of any utility methods in Calcite core to identify 'lossless' casts, i.e., casts from which the original value of the field can be certainly recovered?
>>
>> For instance, int -> bigint is true (as you can cast back to int without loss of information), however bigint -> int is false.
>>
>> Thanks,
>> Jesús
>>
>>
>
>
Re: Lossless cast
Posted by Julian Hyde <jh...@apache.org>.
RexUtil.gatherConstraint deals with “widening” casts, which are similar. (Every widening cast is lossless, but not every lossless cast is widening.)
But I don’t see an actual method, with unit tests, that tests for lossless casts. (The obvious places to look would be RexUtil and RexProgramTest.) Feel free to add one. It would be useful.
Julian
> On Apr 24, 2017, at 12:32 PM, Jesus Camacho Rodriguez <jc...@apache.org> wrote:
>
> Hi all,
>
> Are you aware of any utility methods in Calcite core to identify 'lossless' casts, i.e., casts from which the original value of the field can be certainly recovered?
>
> For instance, int -> bigint is true (as you can cast back to int without loss of information), however bigint -> int is false.
>
> Thanks,
> Jesús
>
>