-Re: Review Request 20742: Allow implicit cast to be applied in both directions for certain data types
This is an automatically generated e-mail. To reply, visit:
(Updated May 7, 2014, 1:28 a.m.)
Review request for drill, Jacques Nadeau and Jinfeng Ni.
Added costs to the secondary casts.
Currently implicit cast works as per the precedence rules. However based on some functions it might be useful allow the implicit cast to work in the opposite direction as specified by the precedence map.
For example: As per the precedence rules, we can implicitly cast from VARCHAR ---> BIGINT. However for some functions (eg: substr, concat) it might be useful to implicitly cast from BIGINT ---> VARCHAR.
Added a new set of secondary rules that allow for implicit cast to work in the other direction. Currently these secondary set of rules only allow to cast to VARCHAR, so we don't have cost, if we add more rules here we can add cost to determine which cast function to pick.
Fixed bug in visitFunctionCall() that does not add an argument(length) while casting to variable width types
Added logic to see if we can apply implicit cast based on the secondary rules while matching a given call to a DrillFuncHolder.
Added test to check that implicit cast works both ways.
8 + '2'
substr(10123, 1, 3)