Re: Reasoning behind fail safe behaviour of cast expression

2020-03-18 Thread vatsal
The example query didn't get posted in the previous email. Adding it here: > spark.sql("select cast((id || 'name') as int) from range(10) ").show > +-+ |CAST(concat(CAST(id AS STRING), name) AS INT)| +-+ |

Reasoning behind fail safe behaviour of cast expression

2020-03-18 Thread vatsal
I noticed that Spark handles CAST operation in fail-safe manner. i.e. if the casting operation will fail for some record(s), Spark doesn't fail the entire query instead it returns null data value for those failures. For example following query: Looking at the code it seems that this behavior i