In general, the logic in CosmosSqlTranslatingEV.VisitUnary for ExpressionType.Convert. See e.g. test Equality_operator_int_to_long.