You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by " Kaige Liu (JIRA)" <ji...@apache.org> on 2017/02/03 08:24:51 UTC

[jira] [Commented] (KYLIN-2406) TPC-H query 20, can triggers NPE

    [ https://issues.apache.org/jira/browse/KYLIN-2406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15851216#comment-15851216 ] 

 Kaige Liu commented on KYLIN-2406:
-----------------------------------

Above query will get this execution plan:
{code}
OLAPToEnumerableConverter
  EnumerableCalc(expr#0..17=[{inputs}], expr#18=[>($t2, $t9)], S_NAME=[$t12], S_ADDRESS=[$t13], $condition=[$t18])
    EnumerableJoin(condition=[=($1, $11)], joinType=[inner])
      EnumerableJoin(condition=[AND(=($0, $8), =($1, $10))], joinType=[inner])
        *OLAPTableScan(table=[[TPCH_FLAT_ORC_2, V_PARTSUPP]], fields=[[0, 1, 2, 3, 4, 5, 6, 7]])*
        EnumerableCalc(expr#0..2=[{inputs}], expr#3=[0.5], expr#4=[*($t3, $t2)], L_PARTKEY=[$t0], SUM_QUANTITY=[$t4], L_SUPPKEY=[$t1])
          EnumerableAggregate(group=[{0, 1}], agg#0=[SUM($2)])
            EnumerableCalc(expr#0..36=[{inputs}], expr#37=['1992-01-01'], expr#38=[>=($t8, $t37)], expr#39=['1995-01-01'], expr#40=[<=($t8, $t39)], expr#41=['CANADA'], expr#42=[=($t28, $t41)], expr#43=['forest%'], expr#44=[LIKE($t31, $t43)], expr#45=[AND($t38, $t40, $t42, $t44)], L_PARTKEY=[$t1], L_SUPPKEY=[$t2], L_QUANTITY=[$t3], $condition=[$t45])
              OLAPJoinRel(condition=[=($1, $30)], joinType=[inner])
                OLAPJoinRel(condition=[=($23, $27)], joinType=[inner])
                  OLAPJoinRel(condition=[=($2, $20)], joinType=[inner])
                    OLAPTableScan(table=[[TPCH_FLAT_ORC_2, V_LINEITEM]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]])
                    OLAPTableScan(table=[[TPCH_FLAT_ORC_2, SUPPLIER]], fields=[[0, 1, 2, 3, 4, 5, 6]])
                  OLAPTableScan(table=[[TPCH_FLAT_ORC_2, NATION]], fields=[[0, 1, 2]])
                OLAPTableScan(table=[[TPCH_FLAT_ORC_2, PART]], fields=[[0, 1, 2, 3, 4, 5, 6]])
      *OLAPTableScan(table=[[TPCH_FLAT_ORC_2, SUPPLIER]], fields=[[0, 1, 2, 3, 4, 5, 6]])*
{code}

The two OLAPTableScan in same OLAPContext do not match join relation defined in model.
Need to give a clear error message here.

> TPC-H query 20, can triggers NPE
> --------------------------------
>
>                 Key: KYLIN-2406
>                 URL: https://issues.apache.org/jira/browse/KYLIN-2406
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: liyang
>            Assignee:  Kaige Liu
>
> Below query triggers NPE
> {code}
> with tmp3 as (
>     select l_partkey, 0.5 * sum(l_quantity) as sum_quantity, l_suppkey
>     from v_lineitem
>     inner join supplier on l_suppkey = s_suppkey
>     inner join nation on s_nationkey = n_nationkey
>     inner join part on l_partkey = p_partkey
>     where l_shipdate >= '1992-01-01' and l_shipdate <= '1995-01-01'
>     and n_name = 'CANADA'
>     and p_name like 'forest%'
>     group by l_partkey, l_suppkey
> )
> select
>     s_name,
>     s_address
> from
>     v_partsupp
>     inner join tmp3 on ps_partkey = l_partkey and ps_suppkey = l_suppkey
>     inner join supplier on ps_suppkey = s_suppkey
> where
>     ps_availqty > sum_quantity
> group by
>     s_name, s_address
> order by
>     s_name
> {code}
> While below query is OK. Only difference being the order of "inner join tmp3" and "inner join supplier"
> {code}
> with tmp3 as (
>     select l_partkey, 0.5 * sum(l_quantity) as sum_quantity, l_suppkey
>     from v_lineitem
>     inner join supplier on l_suppkey = s_suppkey
>     inner join nation on s_nationkey = n_nationkey
>     inner join part on l_partkey = p_partkey
>     where l_shipdate >= '1992-01-01' and l_shipdate <= '1995-01-01'
>     and n_name = 'CANADA'
>     and p_name like 'forest%'
>     group by l_partkey, l_suppkey
> )
> select
>     s_name,
>     s_address
> from
>     v_partsupp
>     inner join supplier on ps_suppkey = s_suppkey
>     inner join tmp3 on ps_partkey = l_partkey and ps_suppkey = l_suppkey
> where
>     ps_availqty > sum_quantity
> group by
>     s_name, s_address
> order by
>     s_name
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)