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 <[email protected]> 
> 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
> 
> 

Reply via email to