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

Damien Carol updated HIVE-9510:
-------------------------------
    Description: 
Setting log level in logging.properties file as following:
{noformat}
handlers=java.util.logging.ConsoleHandler.level=INFO
org.apache.calcite.plan.RelOptPlanner.level=ALL
java.util.logging.ConsoleHandler.level=ALL
{noformat}

Running Q3 in TPCH-full  after modifying , in order to  test join reorder,
but running  failed.
QL:
{code:sql}
set  hive.cbo.enable=true;
--ANALYZE TABLE customer COMPUTE STATISTICS for columns;
--ANALYZE TABLE orders COMPUTE STATISTICS for columns;
--ANALYZE TABLE lineitem COMPUTE STATISTICS for columns;

--Q3
-- the query
select 
  l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, o_orderdate, 
o_shippriority 
from 
  lineitem l join orders o 
    on l.l_orderkey = o.o_orderkey
  join customer c
    on c.c_mktsegment = 'BUILDING' and c.c_custkey = o.o_custkey 
where 
  o_orderdate < '1995-03-15' and l_shipdate > '1995-03-15' 
group by l_orderkey, o_orderdate, o_shippriority 
order by revenue desc, o_orderdate 
limit 10;
{code}

LOG:






  was:
Setting log level in logging.properties file as following:
{noformat}
handlers=java.util.logging.ConsoleHandler.level=INFO
org.apache.calcite.plan.RelOptPlanner.level=ALL
java.util.logging.ConsoleHandler.level=ALL
{noformat}

Running Q3 in TPCH-full  after modifying , in order to  test join reorder,
but running  failed.
QL:
set  hive.cbo.enable=true;
--ANALYZE TABLE customer COMPUTE STATISTICS for columns;
--ANALYZE TABLE orders COMPUTE STATISTICS for columns;
--ANALYZE TABLE lineitem COMPUTE STATISTICS for columns;

--Q3
-- the query
{code:sql}
select 
  l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, o_orderdate, 
o_shippriority 
from 
  lineitem l join orders o 
    on l.l_orderkey = o.o_orderkey
  join customer c
    on c.c_mktsegment = 'BUILDING' and c.c_custkey = o.o_custkey 
where 
  o_orderdate < '1995-03-15' and l_shipdate > '1995-03-15' 
group by l_orderkey, o_orderdate, o_shippriority 
order by revenue desc, o_orderdate 
limit 10;
{code}

LOG:
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner fireRule
FINE: call#15: Apply rule [FilterProjectTransposeRule] to 
[rel#107:HiveFilter.HIVE.[](input=HepRelVertex#106,condition=<($2, 
'1995-03-15')), 
rel#105:HiveProject.HIVE.[](input=HepRelVertex#104,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)]
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#138
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#139
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyTransformation
FINE: call#15: Rule FilterProjectTransposeRule arguments 
[rel#107:HiveFilter.HIVE.[](input=HepRelVertex#106,condition=<($2, 
'1995-03-15')), 
rel#105:HiveProject.HIVE.[](input=HepRelVertex#104,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)]
 produced HiveProject#139
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#140
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#141
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#142
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($0, $4)], joinType=[inner])
  HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
    HiveFilter(condition=[>($10, '1995-03-15')])
      HiveTableScan(table=[[default.lineitem]])
  HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
    HiveFilter(condition=[<($4, '1995-03-15')])
      HiveTableScan(table=[[default.orders]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($8, $5)], joinType=[inner])
  HiveJoin(condition=[=($0, $4)], joinType=[inner])
    HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
      HiveFilter(condition=[>($10, '1995-03-15')])
        HiveTableScan(table=[[default.lineitem]])
    HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
      HiveFilter(condition=[<($4, '1995-03-15')])
        HiveTableScan(table=[[default.orders]])
  HiveProject(c_custkey=[$0], c_mktsegment=[$6])
    HiveFilter(condition=[=($6, 'BUILDING')])
      HiveTableScan(table=[[default.customer]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner dumpGraph
FINER: 
Breadth-first from root:  {
    HepRelVertex#127 = 
rel#126:HiveSort.HIVE.[](input=HepRelVertex#125,fetch=10), rowcount=1.0, 
cumulative cost={36.0 rows, 2.0 cpu, 0.0 io}
    HepRelVertex#125 = rel#124:HiveSort.HIVE.[1 DESC, 
2](input=HepRelVertex#123,sort0=$1,sort1=$2,dir0=DESC,dir1=ASC), rowcount=1.0, 
cumulative cost={20.0 rows, 1.0 cpu, 0.0 io}
    HepRelVertex#123 = 
rel#122:HiveProject.HIVE.[](input=HepRelVertex#121,l_orderkey=$0,revenue=$3,o_orderdate=$1,o_shippriority=$2),
 rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#121 = 
rel#120:HiveAggregate.HIVE.[](input=HepRelVertex#119,group={0, 1, 
2},agg#0=sum($3)), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#119 = 
rel#118:HiveProject.HIVE.[](input=HepRelVertex#117,$f0=$0,$f1=$6,$f2=$7,$f3=*($1,
 -(CAST(1):DOUBLE, $2))), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 
io}
    HepRelVertex#117 = 
rel#116:HiveJoin.HIVE.[](left=HepRelVertex#110,right=HepRelVertex#132,condition==($8,
 $5),joinType=inner), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#110 = 
rel#109:HiveJoin.HIVE.[](left=HepRelVertex#137,right=HepRelVertex#142,condition==($0,
 $4),joinType=inner), rowcount=1.0, cumulative cost={2.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#132 = 
rel#131:HiveProject.HIVE.[](input=HepRelVertex#130,c_custkey=$0,c_mktsegment=$6),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#137 = 
rel#136:HiveProject.HIVE.[](input=HepRelVertex#135,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#142 = 
rel#141:HiveProject.HIVE.[](input=HepRelVertex#140,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#130 = 
rel#128:HiveFilter.HIVE.[](input=HepRelVertex#111,condition==($6, 'BUILDING')), 
rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#135 = 
rel#133:HiveFilter.HIVE.[](input=HepRelVertex#99,condition=>($10, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#140 = 
rel#138:HiveFilter.HIVE.[](input=HepRelVertex#104,condition=<($4, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#111 = rel#2:HiveTableScan.HIVE.[](table=[default.customer]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#99 = rel#0:HiveTableScan.HIVE.[](table=[default.lineitem]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#104 = rel#1:HiveTableScan.HIVE.[](table=[default.orders]), 
rowcount=1.0, cumulative cost={0}
}
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner collectGarbage
FINEST: collecting garbage
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#126:HiveSort.HIVE.[](input=HepRelVertex#125,fetch=10)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using rel#124:HiveSort.HIVE.[1 DESC, 
2](input=HepRelVertex#123,sort0=$1,sort1=$2,dir0=DESC,dir1=ASC)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#122:HiveProject.HIVE.[](input=HepRelVertex#121,l_orderkey=$0,revenue=$3,o_orderdate=$1,o_shippriority=$2)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#120:HiveAggregate.HIVE.[](input=HepRelVertex#119,group={0, 1, 
2},agg#0=sum($3))
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#118:HiveProject.HIVE.[](input=HepRelVertex#117,$f0=$0,$f1=$6,$f2=$7,$f3=*($1,
 -(CAST(1):DOUBLE, $2)))
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#116:HiveJoin.HIVE.[](left=HepRelVertex#110,right=HepRelVertex#132,condition==($8,
 $5),joinType=inner)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#109:HiveJoin.HIVE.[](left=HepRelVertex#137,right=HepRelVertex#142,condition==($0,
 $4),joinType=inner)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#136:HiveProject.HIVE.[](input=HepRelVertex#135,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#133:HiveFilter.HIVE.[](input=HepRelVertex#99,condition=>($10, '1995-03-15'))
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#0:HiveTableScan.HIVE.[](table=[default.lineitem])
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#141:HiveProject.HIVE.[](input=HepRelVertex#140,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#138:HiveFilter.HIVE.[](input=HepRelVertex#104,condition=<($4, '1995-03-15'))
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using rel#1:HiveTableScan.HIVE.[](table=[default.orders])
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#131:HiveProject.HIVE.[](input=HepRelVertex#130,c_custkey=$0,c_mktsegment=$6)
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#128:HiveFilter.HIVE.[](input=HepRelVertex#111,condition==($6, 'BUILDING'))
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyChosen
FINE: For final plan, using 
rel#2:HiveTableScan.HIVE.[](table=[default.customer])
>>>>>>>>>>>>>>>> Apply Pre Join Order optimizations finished!
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#143
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#144
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#145
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#146
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#147
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#148
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#149
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#150
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#151
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#152
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveJoin#153
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#154
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#155
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#156
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#157
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#158
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#159
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveJoin#160
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#161
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#162
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#163
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveAggregate#164
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#165
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#166
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#167
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveSort#168
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#169
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveSort#170
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#171
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($0, $4)], joinType=[inner])
  HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
    HiveFilter(condition=[>($10, '1995-03-15')])
      HiveTableScan(table=[[default.lineitem]])
  HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
    HiveFilter(condition=[<($4, '1995-03-15')])
      HiveTableScan(table=[[default.orders]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($8, $5)], joinType=[inner])
  HiveJoin(condition=[=($0, $4)], joinType=[inner])
    HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
      HiveFilter(condition=[>($10, '1995-03-15')])
        HiveTableScan(table=[[default.lineitem]])
    HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
      HiveFilter(condition=[<($4, '1995-03-15')])
        HiveTableScan(table=[[default.orders]])
  HiveProject(c_custkey=[$0], c_mktsegment=[$6])
    HiveFilter(condition=[=($6, 'BUILDING')])
      HiveTableScan(table=[[default.customer]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner dumpGraph
FINER: 
Breadth-first from root:  {
    HepRelVertex#171 = 
rel#170:HiveSort.HIVE.[](input=HepRelVertex#169,fetch=10), rowcount=1.0, 
cumulative cost={36.0 rows, 2.0 cpu, 0.0 io}
    HepRelVertex#169 = rel#168:HiveSort.HIVE.[1 DESC, 
2](input=HepRelVertex#167,sort0=$1,sort1=$2,dir0=DESC,dir1=ASC), rowcount=1.0, 
cumulative cost={20.0 rows, 1.0 cpu, 0.0 io}
    HepRelVertex#167 = 
rel#166:HiveProject.HIVE.[](input=HepRelVertex#165,l_orderkey=$0,revenue=$3,o_orderdate=$1,o_shippriority=$2),
 rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#165 = 
rel#164:HiveAggregate.HIVE.[](input=HepRelVertex#163,group={0, 1, 
2},agg#0=sum($3)), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#163 = 
rel#162:HiveProject.HIVE.[](input=HepRelVertex#161,$f0=$0,$f1=$6,$f2=$7,$f3=*($1,
 -(CAST(1):DOUBLE, $2))), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 
io}
    HepRelVertex#161 = 
rel#160:HiveJoin.HIVE.[](left=HepRelVertex#154,right=HepRelVertex#159,condition==($8,
 $5),joinType=inner), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#154 = 
rel#153:HiveJoin.HIVE.[](left=HepRelVertex#147,right=HepRelVertex#152,condition==($0,
 $4),joinType=inner), rowcount=1.0, cumulative cost={2.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#159 = 
rel#158:HiveProject.HIVE.[](input=HepRelVertex#157,c_custkey=$0,c_mktsegment=$6),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#147 = 
rel#146:HiveProject.HIVE.[](input=HepRelVertex#145,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#152 = 
rel#151:HiveProject.HIVE.[](input=HepRelVertex#150,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#157 = 
rel#156:HiveFilter.HIVE.[](input=HepRelVertex#155,condition==($6, 'BUILDING')), 
rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#145 = 
rel#144:HiveFilter.HIVE.[](input=HepRelVertex#143,condition=>($10, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#150 = 
rel#149:HiveFilter.HIVE.[](input=HepRelVertex#148,condition=<($4, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#155 = rel#2:HiveTableScan.HIVE.[](table=[default.customer]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#143 = rel#0:HiveTableScan.HIVE.[](table=[default.lineitem]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#148 = rel#1:HiveTableScan.HIVE.[](table=[default.orders]), 
rowcount=1.0, cumulative cost={0}
}
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#172
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#173
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#174
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#175
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#176
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#177
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#178
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#179
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveJoin#180
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#181
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveFilter#182
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#183
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#184
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#185
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveJoin#186
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#187
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#188
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#189
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveAggregate#190
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#191
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveProject#192
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#193
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveSort#194
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#195
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HiveSort#196
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#197
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($0, $4)], joinType=[inner])
  HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
    HiveFilter(condition=[>($10, '1995-03-15')])
      HiveTableScan(table=[[default.lineitem]])
  HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
    HiveFilter(condition=[<($4, '1995-03-15')])
      HiveTableScan(table=[[default.orders]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($8, $5)], joinType=[inner])
  HiveJoin(condition=[=($0, $4)], joinType=[inner])
    HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
      HiveFilter(condition=[>($10, '1995-03-15')])
        HiveTableScan(table=[[default.lineitem]])
    HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
      HiveFilter(condition=[<($4, '1995-03-15')])
        HiveTableScan(table=[[default.orders]])
  HiveProject(c_custkey=[$0], c_mktsegment=[$6])
    HiveFilter(condition=[=($6, 'BUILDING')])
      HiveTableScan(table=[[default.customer]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner dumpGraph
FINER: 
Breadth-first from root:  {
    HepRelVertex#197 = 
rel#196:HiveSort.HIVE.[](input=HepRelVertex#195,fetch=10), rowcount=1.0, 
cumulative cost={36.0 rows, 2.0 cpu, 0.0 io}
    HepRelVertex#195 = rel#194:HiveSort.HIVE.[1 DESC, 
2](input=HepRelVertex#193,sort0=$1,sort1=$2,dir0=DESC,dir1=ASC), rowcount=1.0, 
cumulative cost={20.0 rows, 1.0 cpu, 0.0 io}
    HepRelVertex#193 = 
rel#192:HiveProject.HIVE.[](input=HepRelVertex#191,l_orderkey=$0,revenue=$3,o_orderdate=$1,o_shippriority=$2),
 rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#191 = 
rel#190:HiveAggregate.HIVE.[](input=HepRelVertex#189,group={0, 1, 
2},agg#0=sum($3)), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#189 = 
rel#188:HiveProject.HIVE.[](input=HepRelVertex#187,$f0=$0,$f1=$6,$f2=$7,$f3=*($1,
 -(CAST(1):DOUBLE, $2))), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 
io}
    HepRelVertex#187 = 
rel#186:HiveJoin.HIVE.[](left=HepRelVertex#181,right=HepRelVertex#185,condition==($8,
 $5),joinType=inner), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#181 = 
rel#180:HiveJoin.HIVE.[](left=HepRelVertex#175,right=HepRelVertex#179,condition==($0,
 $4),joinType=inner), rowcount=1.0, cumulative cost={2.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#185 = 
rel#184:HiveProject.HIVE.[](input=HepRelVertex#183,c_custkey=$0,c_mktsegment=$6),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#175 = 
rel#174:HiveProject.HIVE.[](input=HepRelVertex#173,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#179 = 
rel#178:HiveProject.HIVE.[](input=HepRelVertex#177,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#183 = 
rel#182:HiveFilter.HIVE.[](input=HepRelVertex#155,condition==($6, 'BUILDING')), 
rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#173 = 
rel#172:HiveFilter.HIVE.[](input=HepRelVertex#143,condition=>($10, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#177 = 
rel#176:HiveFilter.HIVE.[](input=HepRelVertex#148,condition=<($4, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#155 = rel#2:HiveTableScan.HIVE.[](table=[default.customer]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#143 = rel#0:HiveTableScan.HIVE.[](table=[default.lineitem]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#148 = rel#1:HiveTableScan.HIVE.[](table=[default.orders]), 
rowcount=1.0, cumulative cost={0}
}
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner 
executeInstruction
FINEST: Setting match limit to BOTTOM_UP
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner applyRules
FINEST: Applying rule set [JoinToMultiJoinRule]
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner fireRule
FINE: call#16: Apply rule [JoinToMultiJoinRule] to 
[rel#153:HiveJoin.HIVE.[](left=HepRelVertex#147,right=HepRelVertex#152,condition==($0,
 $4),joinType=inner), 
rel#146:HiveProject.HIVE.[](input=HepRelVertex#145,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 
rel#151:HiveProject.HIVE.[](input=HepRelVertex#150,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)]
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new MultiJoin#198
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyTransformation
FINE: call#16: Rule JoinToMultiJoinRule arguments 
[rel#153:HiveJoin.HIVE.[](left=HepRelVertex#147,right=HepRelVertex#152,condition==($0,
 $4),joinType=inner), 
rel#146:HiveProject.HIVE.[](input=HepRelVertex#145,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 
rel#151:HiveProject.HIVE.[](input=HepRelVertex#150,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)]
 produced MultiJoin#198
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new MultiJoin#199
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#200
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($0, $4)], joinType=[inner])
  HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
    HiveFilter(condition=[>($10, '1995-03-15')])
      HiveTableScan(table=[[default.lineitem]])
  HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
    HiveFilter(condition=[<($4, '1995-03-15')])
      HiveTableScan(table=[[default.orders]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Identified Primary - 
Foreign Key relation:
15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: 
HiveJoin(condition=[=($8, $5)], joinType=[inner])
  HiveJoin(condition=[=($0, $4)], joinType=[inner])
    HiveProject(l_orderkey=[$0], l_extendedprice=[$5], l_discount=[$6], 
l_shipdate=[$10])
      HiveFilter(condition=[>($10, '1995-03-15')])
        HiveTableScan(table=[[default.lineitem]])
    HiveProject(o_orderkey=[$0], o_custkey=[$1], o_orderdate=[$4], 
o_shippriority=[$7])
      HiveFilter(condition=[<($4, '1995-03-15')])
        HiveTableScan(table=[[default.orders]])
  HiveProject(c_custkey=[$0], c_mktsegment=[$6])
    HiveFilter(condition=[=($6, 'BUILDING')])
      HiveTableScan(table=[[default.customer]])

15/01/29 11:48:04 [main]: DEBUG stats.HiveRelMdRowCount: Primary - Foreign Key 
join:
        fkSide = 1
        FKInfo:FKInfo(rowCount=1.00,ndv=-1.00)
        PKInfo:PKInfo(rowCount=1.00,ndv=-1.00,selectivity=1.00)
        isPKSideSimple:false
        NDV Scaling Factor:1.00

Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner dumpGraph
FINER: 
Breadth-first from root:  {
    HepRelVertex#197 = 
rel#196:HiveSort.HIVE.[](input=HepRelVertex#195,fetch=10), rowcount=1.0, 
cumulative cost={36.0 rows, 2.0 cpu, 0.0 io}
    HepRelVertex#195 = rel#194:HiveSort.HIVE.[1 DESC, 
2](input=HepRelVertex#193,sort0=$1,sort1=$2,dir0=DESC,dir1=ASC), rowcount=1.0, 
cumulative cost={20.0 rows, 1.0 cpu, 0.0 io}
    HepRelVertex#193 = 
rel#192:HiveProject.HIVE.[](input=HepRelVertex#191,l_orderkey=$0,revenue=$3,o_orderdate=$1,o_shippriority=$2),
 rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#191 = 
rel#190:HiveAggregate.HIVE.[](input=HepRelVertex#189,group={0, 1, 
2},agg#0=sum($3)), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#189 = 
rel#188:HiveProject.HIVE.[](input=HepRelVertex#187,$f0=$0,$f1=$6,$f2=$7,$f3=*($1,
 -(CAST(1):DOUBLE, $2))), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 
io}
    HepRelVertex#187 = 
rel#186:HiveJoin.HIVE.[](left=HepRelVertex#181,right=HepRelVertex#185,condition==($8,
 $5),joinType=inner), rowcount=1.0, cumulative cost={4.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#181 = 
rel#180:HiveJoin.HIVE.[](left=HepRelVertex#175,right=HepRelVertex#179,condition==($0,
 $4),joinType=inner), rowcount=1.0, cumulative cost={2.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#185 = 
rel#184:HiveProject.HIVE.[](input=HepRelVertex#183,c_custkey=$0,c_mktsegment=$6),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#175 = 
rel#174:HiveProject.HIVE.[](input=HepRelVertex#173,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#179 = 
rel#178:HiveProject.HIVE.[](input=HepRelVertex#177,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7),
 rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#183 = 
rel#182:HiveFilter.HIVE.[](input=HepRelVertex#155,condition==($6, 'BUILDING')), 
rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#173 = 
rel#172:HiveFilter.HIVE.[](input=HepRelVertex#143,condition=>($10, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#177 = 
rel#176:HiveFilter.HIVE.[](input=HepRelVertex#148,condition=<($4, 
'1995-03-15')), rowcount=1.0, cumulative cost={0.0 rows, 0.0 cpu, 0.0 io}
    HepRelVertex#155 = rel#2:HiveTableScan.HIVE.[](table=[default.customer]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#143 = rel#0:HiveTableScan.HIVE.[](table=[default.lineitem]), 
rowcount=1.0, cumulative cost={0}
    HepRelVertex#148 = rel#1:HiveTableScan.HIVE.[](table=[default.orders]), 
rowcount=1.0, cumulative cost={0}
}
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.hep.HepPlanner collectGarbage
FINEST: collecting garbage
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner fireRule
FINE: call#17: Apply rule [JoinToMultiJoinRule] to 
[rel#180:HiveJoin.HIVE.[](left=HepRelVertex#175,right=HepRelVertex#179,condition==($0,
 $4),joinType=inner), 
rel#174:HiveProject.HIVE.[](input=HepRelVertex#173,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 
rel#178:HiveProject.HIVE.[](input=HepRelVertex#177,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)]
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new MultiJoin#201
Jan 29, 2015 11:48:04 AM org.apache.calcite.plan.AbstractRelOptPlanner 
notifyTransformation
FINE: call#17: Rule JoinToMultiJoinRule arguments 
[rel#180:HiveJoin.HIVE.[](left=HepRelVertex#175,right=HepRelVertex#179,condition==($0,
 $4),joinType=inner), 
rel#174:HiveProject.HIVE.[](input=HepRelVertex#173,l_orderkey=$0,l_extendedprice=$5,l_discount=$6,l_shipdate=$10),
 
rel#178:HiveProject.HIVE.[](input=HepRelVertex#177,o_orderkey=$0,o_custkey=$1,o_orderdate=$4,o_shippriority=$7)]
 produced MultiJoin#201
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new MultiJoin#202
Jan 29, 2015 11:48:04 AM org.apache.calcite.rel.AbstractRelNode <init>
FINEST: new HepRelVertex#203
15/01/29 11:48:04 [main]: ERROR parse.CalcitePlanner: CBO failed, skipping CBO. 
java.lang.NullPointerException
        at 
org.apache.calcite.rel.metadata.RelMdUtil.getJoinDistinctRowCount(RelMdUtil.java:653)
        at 
org.apache.hadoop.hive.ql.optimizer.calcite.stats.HiveRelMdDistinctRowCount.getDistinctRowCount(HiveRelMdDistinctRowCount.java:102)
        at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getDistinctRowCount(RelMetadataQuery.java:314)
        at 
org.apache.calcite.rel.metadata.RelMdDistinctRowCount.getDistinctRowCount(RelMdDistinctRowCount.java:230)
        at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getDistinctRowCount(RelMetadataQuery.java:314)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:88)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:64)
        at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:68)
        at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:68)
        at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at org.apache.calcite.plan.hep.HepPlanner.dumpGraph(HepPlanner.java:958)
        at 
org.apache.calcite.plan.hep.HepPlanner.applyTransformationResults(HepPlanner.java:723)
        at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:518)
        at 
org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:392)
        at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:255)
        at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:125)
        at 
org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:207)
        at 
org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:194)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:736)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:658)
        at org.apache.calcite.tools.Frameworks$1.apply(Frameworks.java:109)
        at 
org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:691)
        at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:145)
        at org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:105)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.getOptimizedAST(CalcitePlanner.java:568)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:224)
        at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:9983)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:190)
        at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:224)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:420)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:306)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1106)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1154)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1043)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1033)
        at 
org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:207)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:305)
        at 
org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:403)
        at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:419)
        at 
org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:708)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
FAILED: NullPointerException null
15/01/29 11:48:04 [main]: ERROR ql.Driver: FAILED: NullPointerException null
java.lang.NullPointerException
        at 
org.apache.calcite.rel.metadata.RelMdUtil.getJoinDistinctRowCount(RelMdUtil.java:653)
        at 
org.apache.hadoop.hive.ql.optimizer.calcite.stats.HiveRelMdDistinctRowCount.getDistinctRowCount(HiveRelMdDistinctRowCount.java:102)
        at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getDistinctRowCount(RelMetadataQuery.java:314)
        at 
org.apache.calcite.rel.metadata.RelMdDistinctRowCount.getDistinctRowCount(RelMdDistinctRowCount.java:230)
        at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy23.getDistinctRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getDistinctRowCount(RelMetadataQuery.java:314)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:88)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:64)
        at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:68)
        at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at 
org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:68)
        at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider$2$1.invoke(ReflectiveRelMetadataProvider.java:147)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.calcite.rel.metadata.CachingRelMetadataProvider$CachingInvocationHandler.invoke(CachingRelMetadataProvider.java:131)
        at com.sun.proxy.$Proxy22.getRowCount(Unknown Source)
        at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:81)
        at org.apache.calcite.plan.hep.HepPlanner.dumpGraph(HepPlanner.java:958)
        at 
org.apache.calcite.plan.hep.HepPlanner.applyTransformationResults(HepPlanner.java:723)
        at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:518)
        at 
org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:392)
        at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:255)
        at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:125)
        at 
org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:207)
        at 
org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:194)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:736)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:658)
        at org.apache.calcite.tools.Frameworks$1.apply(Frameworks.java:109)
        at 
org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:691)
        at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:145)
        at org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:105)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.getOptimizedAST(CalcitePlanner.java:568)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:224)
        at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:9983)
        at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:190)
        at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:224)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:420)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:306)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1106)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1154)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1043)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1033)
        at 
org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:207)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:305)
        at 
org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:403)
        at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:419)
        at 
org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:708)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)






> Throwing null point exception , when get join distinct row count from 
> RelMdUtil.java class
> ------------------------------------------------------------------------------------------
>
>                 Key: HIVE-9510
>                 URL: https://issues.apache.org/jira/browse/HIVE-9510
>             Project: Hive
>          Issue Type: Bug
>            Reporter: asko
>            Assignee: Julian Hyde
>         Attachments: log3_cbo5
>
>
> Setting log level in logging.properties file as following:
> {noformat}
> handlers=java.util.logging.ConsoleHandler.level=INFO
> org.apache.calcite.plan.RelOptPlanner.level=ALL
> java.util.logging.ConsoleHandler.level=ALL
> {noformat}
> Running Q3 in TPCH-full  after modifying , in order to  test join reorder,
> but running  failed.
> QL:
> {code:sql}
> set  hive.cbo.enable=true;
> --ANALYZE TABLE customer COMPUTE STATISTICS for columns;
> --ANALYZE TABLE orders COMPUTE STATISTICS for columns;
> --ANALYZE TABLE lineitem COMPUTE STATISTICS for columns;
> --Q3
> -- the query
> select 
>   l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, o_orderdate, 
> o_shippriority 
> from 
>   lineitem l join orders o 
>     on l.l_orderkey = o.o_orderkey
>   join customer c
>     on c.c_mktsegment = 'BUILDING' and c.c_custkey = o.o_custkey 
> where 
>   o_orderdate < '1995-03-15' and l_shipdate > '1995-03-15' 
> group by l_orderkey, o_orderdate, o_shippriority 
> order by revenue desc, o_orderdate 
> limit 10;
> {code}
> LOG:



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

Reply via email to