Reputation: 367
I have a spark API calll like
substr($"fmt_num",(length($"mobile_num")).-(5), 4)
but it will throw an error like
java.lang.ClassCastException: org.apache.spark.sql.Column cannot be cast to java.lang.Integer
How can I get the length of the mobile_num
as integer to use as the start index of the substring
function?
Upvotes: 1
Views: 783
Reputation: 25909
All you need to do is import org.apache.spark.sql.functions._
and you'd get a substring function that works with Column
Upvotes: 1