Below is an example usage -

insert overwrite table TABLE_NAME select date, count(distinct sessionKey)
as activity, appKey, role, first(y.dateDisplay) as dateDisplay from (select
sessionKey as sessionKey,  dateFormatter(timestamp, "MM/dd/yyyy HH:mm",
"yyyy-MM-dd:HH") as dateDisplay, appKey as appKey, clientModel as role,
dateConvertor(timestamp, "MM/dd/yyyy HH:mm", "HOUR") as date  from
eventStatData) as y group by y.date, y.appKey, y.role;



On Thu, Jun 9, 2016 at 4:13 PM, Sachith Withana <sach...@wso2.com> wrote:

> 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 <duli...@wso2.com>
> 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       duli...@wso2.com <duli...@wso2mobile.com>*
>> *  ~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
>



-- 
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

Reply via email to