Jihoon Son created TAJO-2118:
--------------------------------

             Summary: The join cost calculation before join order optimization 
should be same with that of after optimization
                 Key: TAJO-2118
                 URL: https://issues.apache.org/jira/browse/TAJO-2118
             Project: Tajo
          Issue Type: Bug
          Components: Planner/Optimizer
            Reporter: Jihoon Son
            Priority: Minor
             Fix For: 0.12.0


See the title. 
When you run the below query, 
{noformat}
// TPC-H Q10
default> select
    c_custkey,
    c_name,
    sum(l_extendedprice * (1 - l_discount)) as revenue,
    c_acctbal,
    n_name,
    c_address,
    c_phone,
    c_comment
from
    customer as c
    join nation as n
        on c.c_nationkey = n.n_nationkey
    join orders as o
        on c.c_custkey = o.o_custkey and o.o_orderdate >= '1993-10-01'::date 
and o.o_orderdate < '1994-01-01'::date
    join lineitem as l
        on l.l_orderkey = o.o_orderkey and l.l_returnflag = 'R'
group by
    c_custkey, c_name, c_acctbal, c_phone, n_name, c_address, c_comment
order by
    revenue desc
{noformat}

you can find the below log. The cost of before optimization is smaller than 
that after optimization. This is because the different cost calculation methods 
are used for each unoptimized and optimized plans.
{noformat}
...
Query Block Graph
-----------------------------
|-#ROOT
-----------------------------
Optimization Log:
[#ROOT]
        > Non-optimized join order: (((default.customer200 ⋈θ 
default.nation200) ⋈θ default.orders200) ⋈θ default.lineitem200) (cost: 
3.19186301858328E32)
        > Optimized join order    : ((default.lineitem200 ⋈θ default.orders200) 
⋈θ (default.customer200 ⋈θ default.nation200)) (cost: 1.0772537685263547E33)
-----------------------------
...
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to