Question:
Error in SQL statement: AnalysisException: Cannot up cast `test1` from string to test1 int: int as it may truncate
Answer:
This issue occurs when the column data types of view do not match the underlying table and have not been changed using explicit cast functions.
This issue occurs when the column data types of view do not match the underlying table and have not been changed using explicit cast functions.
The base table defined an int column which is cast to a string by a UDF on the view on top. This view is consumed by another view which attempts to typecast this string to an int which spark considers illegal. The solution is to change view such that if the UDF returned a non-int, the view returns a null / use a UDF that returns an int instead of a string.
Comments
0 comments
Please sign in to leave a comment.