[ 
https://issues.apache.org/jira/browse/PHOENIX-5179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xinyi Yan updated PHOENIX-5179:
-------------------------------
    Description: 
In order to have a better user experience, we could offer a few useful 
syntactic sugar functions for customers, especially for e-commerce users. They 
use the date range to fetch last a few days/months expressions, GMV, unique 
buyers a lot. Many internal tools have very good date wraps on top of it, such 
as 

1. DATE_RANGE

 
{code:java}
select * from table where DATE_RANGE(date, '2019-03-01') 
# date is equal or greater than the date.
select * from table where DATE_RANGE(date,'', '2019-03-01') 
# date is equal or less than the date.
select * from table where DATE_RANGE(date,'2018-05-12', '2019-03-01') 
# in range select
select * from table where DATE_RANGE(date,'2018-05-12', '2019-03-01', 'PST') 
# timezone option{code}
 2. DATE_INTERVAL

 
{code:java}
SELECT * from table where DATE_INTERVAL(time, '-7d')
# last 7 days
SELECT * from table where DATE_INTERVAL(time, '-1w')
# last week
SELECT * from table where DATE_INTERVAL(time, '-1m')
# last month{code}
3.DATE_ADD
{code:java}
select * from table where DATE_RANGE(date, '2019-03-01', 
         DATE_ADD('2019-03-01', '7d')) {code}
 

 

 

 

  was:
In order to have a better user experience, we could offer a few useful 
syntactic surge functions for customers, especially for e-commerce users. They 
use the date range to fetch last a few days/months expressions, GMV, unique 
buyers a lot. Many internal tools have very good date wraps on top of it, such 
as 

1. DATE_RANGE

 
{code:java}
select * from table where DATE_RANGE(date, '2019-03-01') 
# date is equal or greater than the date.
select * from table where DATE_RANGE(date,'', '2019-03-01') 
# date is equal or less than the date.
select * from table where DATE_RANGE(date,'2018-05-12', '2019-03-01') 
# in range select
select * from table where DATE_RANGE(date,'2018-05-12', '2019-03-01', 'PST') 
# timezone option{code}
 2. DATE_INTERVAL

 
{code:java}
SELECT * from table where DATE_INTERVAL(time, '-7d')
# last 7 days
SELECT * from table where DATE_INTERVAL(time, '-1w')
# last week
SELECT * from table where DATE_INTERVAL(time, '-1m')
# last month{code}
3.DATE_ADD
{code:java}
select * from table where DATE_RANGE(date, '2019-03-01', 
         DATE_ADD('2019-03-01', '7d')) {code}
 

 

 

 


> empower/add more DateType related functions
> -------------------------------------------
>
>                 Key: PHOENIX-5179
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5179
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Xinyi Yan
>            Priority: Minor
>
> In order to have a better user experience, we could offer a few useful 
> syntactic sugar functions for customers, especially for e-commerce users. 
> They use the date range to fetch last a few days/months expressions, GMV, 
> unique buyers a lot. Many internal tools have very good date wraps on top of 
> it, such as 
> 1. DATE_RANGE
>  
> {code:java}
> select * from table where DATE_RANGE(date, '2019-03-01') 
> # date is equal or greater than the date.
> select * from table where DATE_RANGE(date,'', '2019-03-01') 
> # date is equal or less than the date.
> select * from table where DATE_RANGE(date,'2018-05-12', '2019-03-01') 
> # in range select
> select * from table where DATE_RANGE(date,'2018-05-12', '2019-03-01', 'PST') 
> # timezone option{code}
>  2. DATE_INTERVAL
>  
> {code:java}
> SELECT * from table where DATE_INTERVAL(time, '-7d')
> # last 7 days
> SELECT * from table where DATE_INTERVAL(time, '-1w')
> # last week
> SELECT * from table where DATE_INTERVAL(time, '-1m')
> # last month{code}
> 3.DATE_ADD
> {code:java}
> select * from table where DATE_RANGE(date, '2019-03-01', 
>          DATE_ADD('2019-03-01', '7d')) {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to