You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Brian Adams <Br...@chacha.com> on 2010/09/27 20:35:49 UTC

Group By Hour

I have a timestamp of 2010-09-05 23:52:11,567

And I want to group by hour. 

Anyone have a udf that works for that format?

-----Original Message-----
From: Russell Jurney [mailto:russell.jurney@gmail.com] 
Sent: Sunday, September 26, 2010 1:50 PM
To: pig-user@hadoop.apache.org
Subject: NOT matches

How do you filter a relation by a field NOT matching a regex?

You would think this would work, but it does not:  B = FILTER A BY field_foo
NOT matches 'test'

Russ

Re: Group By Hour

Posted by Kim Vogt <ki...@simplegeo.com>.
Check out the datetime UDFs in piggybank.  If you
convert<http://hadoop.apache.org/pig/docs/r0.7.0/api/org/apache/pig/piggybank/evaluation/datetime/convert/CustomFormatToISO.html>your
timestamps to ISO format you can use
ISOToHour<http://hadoop.apache.org/pig/docs/r0.7.0/api/org/apache/pig/piggybank/evaluation/datetime/truncate/ISOToHour.html>
.

-Kim

On Mon, Sep 27, 2010 at 11:35 AM, Brian Adams <Br...@chacha.com>wrote:

> I have a timestamp of 2010-09-05 23:52:11,567
>
> And I want to group by hour.
>
> Anyone have a udf that works for that format?
>
> -----Original Message-----
> From: Russell Jurney [mailto:russell.jurney@gmail.com]
> Sent: Sunday, September 26, 2010 1:50 PM
> To: pig-user@hadoop.apache.org
> Subject: NOT matches
>
> How do you filter a relation by a field NOT matching a regex?
>
> You would think this would work, but it does not:  B = FILTER A BY
> field_foo
> NOT matches 'test'
>
> Russ
>