You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@griffin.apache.org by Secfree Teng <se...@gmail.com> on 2019/04/29 11:54:36 UTC

How to set a date range in the "where" field?

Hi all,

When creating a measure, I know I can specify the data of one day by
setting “where” as

date = '#YYYYMMdd#'

But sometimes I need to set a date range, such as

date >= '2019-04-21' and date < '2019-04-23'

How can I achieve this?

Any help is appreciated.
Thank you.

Re: How to set a date range in the "where" field?

Posted by Secfree Teng <se...@gmail.com>.
Hi all,

Just want to make this question complete.

The general way to set a time range in the “where” field is “convert the
current date to a unix timestamp and then add/minus corresponding seconds”.

event_timestamp >= unix_timestamp('#YYYY-MM-dd# 00:00:00') and
event_timestamp < (unix_timestamp('#YYYY-MM-dd# 00:00:00') + 86400)
and date_partition >= from_unixtime(unix_timestamp('$date 00:00:00') -
86400 * 2, 'yyyy-MM-dd')

Thank you.

On Mon, 29 Apr 2019 at 20:51, Secfree Teng <se...@gmail.com> wrote:

> Hi Vikram,
>
> Thanks for your answer. It helps me.
>
> The related field in my case is a timestamp in seconds. So I set the where
> clause as
>
> create_time >= unix_timestamp('#YYYY-MM-dd# 00:00:00') and create_time < unix_timestamp('#YYYY-MM-dd# 23:59:59')
>
> And then I can set the date range with the method you replyed when
> creating the job.
>
> Thanks you once again.
>
>
> On Mon, 29 Apr 2019 at 20:22, Vikram Jain <vi...@enquero.com> wrote:
>
>> Hi,
>>
>> While creating a measure you only specify the format of your partition
>> like “day=#yyyy-MM-dd#”
>>
>> While creating a job, you select the date range on which you want to
>> execute your job. That range can be adjusted using the slider that you see
>> when you configure the job. 0 on that slider means today, -1 means
>> yesterday and so on.
>>
>> Hope that helps.
>>
>>
>>
>> Regards,
>>
>> Vikram
>>
>>
>>
>> *From:* Secfree Teng <se...@gmail.com>
>> *Sent:* Monday, April 29, 2019 5:25 PM
>> *To:* users@griffin.apache.org
>> *Subject:* How to set a date range in the "where" field?
>>
>>
>>
>> *WARNING: *This email originated outside of Enquero. DO NOT CLICK links
>> or attachments unless you recognize the sender and know the content is
>> safe.
>>
>> Hi all,
>>
>> When creating a measure, I know I can specify the data of one day by
>> setting “where” as
>>
>> date = '#YYYYMMdd#'
>>
>> But sometimes I need to set a date range, such as
>>
>> date >= '2019-04-21' and date < '2019-04-23'
>>
>> How can I achieve this?
>>
>> Any help is appreciated.
>> Thank you.
>>
>

Re: How to set a date range in the "where" field?

Posted by Secfree Teng <se...@gmail.com>.
Hi Vikram,

Thanks for your answer. It helps me.

The related field in my case is a timestamp in seconds. So I set the where
clause as

create_time >= unix_timestamp('#YYYY-MM-dd# 00:00:00') and create_time
< unix_timestamp('#YYYY-MM-dd# 23:59:59')

And then I can set the date range with the method you replyed when creating
the job.

Thanks you once again.


On Mon, 29 Apr 2019 at 20:22, Vikram Jain <vi...@enquero.com> wrote:

> Hi,
>
> While creating a measure you only specify the format of your partition
> like “day=#yyyy-MM-dd#”
>
> While creating a job, you select the date range on which you want to
> execute your job. That range can be adjusted using the slider that you see
> when you configure the job. 0 on that slider means today, -1 means
> yesterday and so on.
>
> Hope that helps.
>
>
>
> Regards,
>
> Vikram
>
>
>
> *From:* Secfree Teng <se...@gmail.com>
> *Sent:* Monday, April 29, 2019 5:25 PM
> *To:* users@griffin.apache.org
> *Subject:* How to set a date range in the "where" field?
>
>
>
> *WARNING: *This email originated outside of Enquero. DO NOT CLICK links
> or attachments unless you recognize the sender and know the content is
> safe.
>
> Hi all,
>
> When creating a measure, I know I can specify the data of one day by
> setting “where” as
>
> date = '#YYYYMMdd#'
>
> But sometimes I need to set a date range, such as
>
> date >= '2019-04-21' and date < '2019-04-23'
>
> How can I achieve this?
>
> Any help is appreciated.
> Thank you.
>