From issues-return-123624-archive-asf-public=cust-asf.ponee.io@hive.apache.org Wed Jun 13 16:55:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C7A74180789 for ; Wed, 13 Jun 2018 16:55:03 +0200 (CEST) Received: (qmail 8676 invoked by uid 500); 13 Jun 2018 14:55:02 -0000 Mailing-List: contact issues-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 issues@hive.apache.org Received: (qmail 8663 invoked by uid 99); 13 Jun 2018 14:55:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2018 14:55:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 3CC67C0334 for ; Wed, 13 Jun 2018 14:55:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id bZtomneA5dMC for ; Wed, 13 Jun 2018 14:55:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id EDA7F5F30E for ; Wed, 13 Jun 2018 14:55:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 66EA4E0234 for ; Wed, 13 Jun 2018 14:55:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2674D2109E for ; Wed, 13 Jun 2018 14:55:00 +0000 (UTC) Date: Wed, 13 Jun 2018 14:55:00 +0000 (UTC) From: "Zoltan Haindrich (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-19097) related equals and in operators may cause inaccurate stats estimations 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-19097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16511256#comment-16511256 ] Zoltan Haindrich commented on HIVE-19097: ----------------------------------------- I have to note that with HIVE-19500 in; the original problem, which caused {{NDV^-2}} estimations is now gone...maybe I should re-label this ticket... > related equals and in operators may cause inaccurate stats estimations > ---------------------------------------------------------------------- > > Key: HIVE-19097 > URL: https://issues.apache.org/jira/browse/HIVE-19097 > Project: Hive > Issue Type: Bug > Reporter: Zoltan Haindrich > Assignee: Zoltan Haindrich > Priority: Major > Attachments: HIVE-19097.01.patch, HIVE-19097.02.patch, HIVE-19097.partial.patch > > > tpcds#74 is optimized in a way that for date_dim the condition contains IN and = for the same column > {code:java} > | Map Operator Tree: | > | TableScan | > | alias: date_dim | > | filterExpr: (((d_year) IN (2001, 2002) and (d_year = 2002) and d_date_sk is not null) or ((d_year) IN (2001, 2002) and (d_year = 2001) and d_date_sk is not null)) (type: boolean) | > | Statistics: Num rows: 73049 Data size: 876588 Basic stats: COMPLETE Column stats: COMPLETE | > | Filter Operator | > | predicate: ((d_year) IN (2001, 2002) and (d_year = 2002) and d_date_sk is not null) (type: boolean) | > | Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE | > {code} > the "real" row count will be 365 > for separate {{IN}} and {{=}} the estimation is very good; but if both are present it becomes (very) underestimated. > {code:java} > set hive.query.results.cache.enabled=false; > drop table if exists t1; > drop table if exists t8; > create table t1 (a integer,b integer); > create table t8 like t1; > insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5); > insert into t8 > select * from t1 union all select * from t1 union all select * from t1 union all select * from t1 union all > select * from t1 union all select * from t1 union all select * from t1 union all select * from t1 > ; > analyze table t1 compute statistics for columns; > analyze table t8 compute statistics for columns; > explain analyze select sum(a) from t8 where b in (2,3) group by b; > explain analyze select sum(a) from t8 where b=2 group by b; > explain analyze select sum(a) from t1 where b in (2,3) and b=2 group by b; > explain analyze select sum(a) from t8 where b in (2,3) and b=2 group by b; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)