Hi Dulitha,

Can you provide the query that you are using?

That would help us give you a better solution I guess.

Regards,
Sachith

On Thu, Jun 9, 2016 at 2:34 PM, Dulitha Wijewantha <[email protected]> wrote:

> 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       [email protected] <[email protected]>*
> *  ~Mobile     +94712112165 <%2B94712112165>*
> *  ~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>*
>



-- 
Sachith Withana
Software Engineer; WSO2 Inc.; http://wso2.com
E-mail: sachith AT wso2.com
M: +94715518127
Linked-In: <http://goog_416592669>https://lk.linkedin.com/in/sachithwithana
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to