Hi guys, I have written a customer Spark UDF function that allows me to convert a date string to a given input format. If there is a ParseException due to input being invalid - the whole spark script will stop execution. Is there away to skip that particular iteration and move on to the next in the record? (this function is used in where clauses). Or is there a better recommendation for this? Like validation in the EventReceiver?
public String dateFormatter(String input, String fromFormat, String toFormat) throws ParseException{ SimpleDateFormat sdf = new SimpleDateFormat(fromFormat); Date date = sdf.parse(input); SimpleDateFormat newFormatter = new SimpleDateFormat(toFormat); return newFormatter.format(date); } Cheers~ -- Dulitha Wijewantha (Chan) Software Engineer - Mobile Development WSO2 Inc Lean.Enterprise.Middleware * ~Email duli...@wso2.com <duli...@wso2mobile.com>* * ~Mobile +94712112165* * ~Website dulitha.me <http://dulitha.me>* * ~Twitter @dulitharw <https://twitter.com/dulitharw>* *~Github @dulichan <https://github.com/dulichan>* *~SO @chan <http://stackoverflow.com/users/813471/chan>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev