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

Rui Li commented on HIVE-10261:
-------------------------------

Hi [~mmokhtar],

Here's a simple query to reproduce it:
{code}
explain select ss_sales_price from store_sales,customer where 
ss_customer_sk=c_customer_sk and ss_sold_date_sk between 2452633 and 2452642;
{code}
The plan is:
{noformat}
STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

STAGE PLANS:
  Stage: Stage-1
    Tez
      Edges:
        Map 2 <- Map 1 (BROADCAST_EDGE)
      DagName: root_20150409032323_e100ede8-da5c-4b08-8693-cafc73a487b3:1
      Vertices:
        Map 1 
            Map Operator Tree:
                TableScan
                  alias: store_sales
                  Statistics: Num rows: 9602042 Data size: 826919856 Basic 
stats: COMPLETE Column stats: PARTIAL
                  Filter Operator
                    predicate: ss_customer_sk is not null (type: boolean)
                    Statistics: Num rows: 4801021 Data size: 19204084 Basic 
stats: COMPLETE Column stats: PARTIAL
                    Reduce Output Operator
                      key expressions: ss_customer_sk (type: int)
                      sort order: +
                      Map-reduce partition columns: ss_customer_sk (type: int)
                      Statistics: Num rows: 4801021 Data size: 19204084 Basic 
stats: COMPLETE Column stats: PARTIAL
                      value expressions: ss_sales_price (type: float), 
ss_sold_date_sk (type: int)
            Execution mode: vectorized
        Map 2 
            Map Operator Tree:
                TableScan
                  alias: customer
                  Statistics: Num rows: 300000 Data size: 258006136 Basic 
stats: COMPLETE Column stats: NONE
                  Filter Operator
                    predicate: c_customer_sk is not null (type: boolean)
                    Statistics: Num rows: 150000 Data size: 129003068 Basic 
stats: COMPLETE Column stats: NONE
                    Map Join Operator
                      condition map:
                           Inner Join 0 to 1
                      keys:
                        0 ss_customer_sk (type: int)
                        1 c_customer_sk (type: int)
                      outputColumnNames: _col2, _col12, _col22, _col26
                      input vertices:
                        0 Map 1
                      Statistics: Num rows: 5281123 Data size: 21124492 Basic 
stats: COMPLETE Column stats: NONE
                      Filter Operator
                        predicate: ((_col2 = _col26) and _col22 BETWEEN 2452633 
AND 2452642) (type: boolean)
                        Statistics: Num rows: 1320280 Data size: 5281120 Basic 
stats: COMPLETE Column stats: NONE
                        Select Operator
                          expressions: _col12 (type: float)
                          outputColumnNames: _col0
                          Statistics: Num rows: 1320280 Data size: 5281120 
Basic stats: COMPLETE Column stats: NONE
                          File Output Operator
                            compressed: false
                            Statistics: Num rows: 1320280 Data size: 5281120 
Basic stats: COMPLETE Column stats: NONE
                            table:
                                input format: 
org.apache.hadoop.mapred.TextInputFormat
                                output format: 
org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
                                serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
            Execution mode: vectorized

  Stage: Stage-0
    Fetch Operator
      limit: -1
      Processor Tree:
        ListSink
{noformat}
I'm using 320GB TPC-DS and the 10 partitions from store_sales are over 380M in 
file size, while customer is 18M in file size. However, in the filter operator 
for store_sales, the data size is estimated with column stats. I suppose it 
underestimates the data size, because while num rows is half of the parent 
operator, the data size is only about 1/43 of the parent.

> Data size can be underestimated when computed with partial column stats
> -----------------------------------------------------------------------
>
>                 Key: HIVE-10261
>                 URL: https://issues.apache.org/jira/browse/HIVE-10261
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Rui Li
>
> With {{hive.stats.fetch.column.stats=true}}, we'll estimate data size with 
> column  stats when annotating operators with statistics. However, when column 
> stats is partial, we're likely to underestimate data size, which may hurt 
> performance, e.g. picking an inappropriate small table for map join.



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

Reply via email to