Skip to content

Add built-in scalar function for date intervals. #523

@bmyerz

Description

@bmyerz

I would like the following template to work with TPC-H qgen.

Relevant portion is date_plus_months.

lineitem = scan('lineitem');
orders = scan('orders');

-- $ID$
-- TPC-H/TPC-R Order Priority Checking Query (Q4)
-- Functional Query Definition
-- Approved February 1998
exist = select 
    o_orderkey as e_key,
    COUNT(o_orderkey) as e_count
    from lineitem,
         orders
    where
        l_orderkey = o_orderkey
        and l_commitdate < l_receiptdate;

q4 = select 
    o_orderpriority,
    count(o_orderpriority) as order_count
    from
        orders,
        exist
    where
        e_key = o_orderkey
        and o_orderdate >= ':1'
        and o_orderdate < date_plus_months(':1', 3);
        and e_count > 0;
store(q4, q4);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions