Description
In ArrayPosition, we currently cast the right hand side expression to match the element type of the left hand side Array. This may result in down casting and may return wrong result or questionable result.
Example :
spark-sql> select array_position(array(1), 1.34);
1
spark-sql> select array_position(array(1), 'foo');
null
We should safely coerce both left and right hand side expressions.
Attachments
Issue Links
- is cloned by
-
SPARK-25519 ArrayRemove function may return incorrect result when right expression is implicitly downcasted.
- Resolved
-
SPARK-25522 Improve type promotion for input arguments of elementAt function
- Resolved
- links to