Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 288FC113EF for ; Fri, 5 Sep 2014 22:09:29 +0000 (UTC) Received: (qmail 34906 invoked by uid 500); 5 Sep 2014 22:09:28 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 34835 invoked by uid 500); 5 Sep 2014 22:09:28 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 34824 invoked by uid 500); 5 Sep 2014 22:09:28 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 34821 invoked by uid 99); 5 Sep 2014 22:09:28 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2014 22:09:28 +0000 Date: Fri, 5 Sep 2014 22:09:28 +0000 (UTC) From: "Gunther Hagleitner (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-7991) Incorrect calculation of number of rows in JoinStatsRule.process results in overflow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-7991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14123685#comment-14123685 ] Gunther Hagleitner commented on HIVE-7991: ------------------------------------------ +1 > Incorrect calculation of number of rows in JoinStatsRule.process results in overflow > ------------------------------------------------------------------------------------ > > Key: HIVE-7991 > URL: https://issues.apache.org/jira/browse/HIVE-7991 > Project: Hive > Issue Type: Sub-task > Components: Statistics > Affects Versions: 0.13.1 > Reporter: Mostafa Mokhtar > Assignee: Prasanth J > Priority: Minor > Attachments: HIVE-7991.1.patch > > > This loop results in adding the parent twice incase of a 3 way join of store_sales x date_dim x store > {code} > for (int pos = 0; pos < parents.size(); pos++) { > ReduceSinkOperator parent = (ReduceSinkOperator) jop.getParentOperators().get(pos); > Statistics parentStats = parent.getStatistics(); > List keyExprs = parent.getConf().getKeyCols(); > // Parent RS may have column statistics from multiple parents. > // Populate table alias to row count map, this will be used later to > // scale down/up column statistics based on new row count > // NOTE: JOIN with UNION as parent of RS will not have table alias > // propagated properly. UNION operator does not propagate the table > // alias of subqueries properly to expression nodes. Hence union20.q > // will have wrong number of rows. > Set tableAliases = StatsUtils.getAllTableAlias(parent.getColumnExprMap()); > for (String tabAlias : tableAliases) { > rowCountParents.put(tabAlias, parentStats.getNumRows()); > } > {code} > In the first join we have rowCountParents with {store_sales=120464862, date_dim=36524} which is correct. > For the second join result rowCountParents ends up with {store=212, store_sales=120464862, date_dim=120464862} where it should be {store=212, store_sales=120464862, date_dim=36524}. > The result of this is that computeNewRowCount ends up multiplying row count of store_sales x store_sales which makes the number of rows really high and eventually over flow. > Plan snippet : > {code} > Map 1 > Map Operator Tree: > TableScan > alias: store_sales > filterExpr: (((ss_sold_date_sk is not null and ss_store_sk is not null) and ss_item_sk is not null) and ss_sold_date BETWEEN '1999-06-01' AND '2000-05-31') (type: boolean) > Statistics: Num rows: 110339135 Data size: 4817453454 Basic stats: COMPLETE Column stats: COMPLETE > Filter Operator > predicate: ((ss_sold_date_sk is not null and ss_store_sk is not null) and ss_item_sk is not null) (type: boolean) > Statistics: Num rows: 107740258 Data size: 2124353556 Basic stats: COMPLETE Column stats: COMPLETE > Map Join Operator > condition map: > Inner Join 0 to 1 > condition expressions: > 0 {ss_sold_date_sk} {ss_item_sk} {ss_store_sk} {ss_quantity} {ss_sales_price} {ss_sold_date} > 1 {d_date_sk} {d_month_seq} {d_year} {d_moy} {d_qoy} > keys: > 0 ss_sold_date_sk (type: int) > 1 d_date_sk (type: int) > outputColumnNames: _col0, _col2, _col7, _col10, _col13, _col23, _col27, _col30, _col33, _col35, _col37 > input vertices: > 1 Map 6 > Statistics: Num rows: 120464862 Data size: 26984129088 Basic stats: COMPLETE Column stats: COMPLETE > Map Join Operator > condition map: > Inner Join 0 to 1 > condition expressions: > 0 {_col0} {_col2} {_col7} {_col10} {_col13} {_col23} {_col27} {_col30} {_col33} {_col35} {_col37} > 1 {s_store_sk} {s_store_id} > keys: > 0 _col7 (type: int) > 1 s_store_sk (type: int) > outputColumnNames: _col0, _col2, _col7, _col10, _col13, _col23, _col27, _col30, _col33, _col35, _col37, _col58, _col59 > input vertices: > 1 Map 5 > Statistics: Num rows: 17886616227069518 Data size: 5866810122478801920 Basic stats: COMPLETE Column stats: COMPLETE > Map Join Operator > condition map: > Inner Join 0 to 1 > condition expressions: > 0 {_col0} {_col2} {_col7} {_col10} {_col13} {_col23} {_col27} {_col30} {_col33} {_col35} {_col37} {_col58} {_col59} > 1 {i_item_sk} {i_brand} {i_class} {i_category} {i_product_name} > keys: > 0 _col2 (type: int) > 1 i_item_sk (type: int) > outputColumnNames: _col0, _col2, _col7, _col10, _col13, _col23, _col27, _col30, _col33, _col35, _col37, _col58, _col59, _col90, _col98, _col100, _col102, _col111 > input vertices: > 1 Map 7 > Statistics: Num rows: -9223372036854775808 Data size: 0 Basic stats: NONE Column stats: COMPLETE > Filter Operator > predicate: (((((_col0 = _col27) and (_col2 = _col90)) and (_col7 = _col58)) and _col30 BETWEEN 1193 AND 1204) and _col23 BETWEEN '1999-06-01' AND '2000-05-31') (type: boolean) > Statistics: Num rows: -9223372036854775808 Data size: 0 Basic stats: NONE Column stats: COMPLETE > Select Operator > expressions: _col102 (type: string), _col100 (type: string), _col98 (type: string), _col111 (type: string), _col33 (type: int), _col37 (type: int), _col35 (type: int), _col59 (type: string), _col13 (type: float), _col10 (type: int) > outputColumnNames: _col102, _col100, _col98, _col111, _col33, _col37, _col35, _col59, _col13, _col10 > Statistics: Num rows: -9223372036854775808 Data size: 0 Basic stats: NONE Column stats: COMPLETE > Group By Operator > aggregations: sum(COALESCE((_col13 * _col10),0)) > keys: _col102 (type: string), _col100 (type: string), _col98 (type: string), _col111 (type: string), _col33 (type: int), _col37 (type: int), _col35 (type: int), _col59 (type: string), '0' (type: string) > mode: hash > outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9 > Statistics: Num rows: -9223372036854775808 Data size: 0 Basic stats: NONE Column stats: COMPLETE > Reduce Output Operator > key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: string) > sort order: +++++++++ > Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: string) > Statistics: Num rows: -9223372036854775808 Data size: 0 Basic stats: NONE Column stats: COMPLETE > value expressions: _col9 (type: double) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)