Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2DDE611FC0 for ; Sat, 23 Aug 2014 04:31:09 +0000 (UTC) Received: (qmail 92450 invoked by uid 500); 23 Aug 2014 04:31:08 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 92407 invoked by uid 500); 23 Aug 2014 04:31:08 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 92396 invoked by uid 99); 23 Aug 2014 04:31:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Aug 2014 04:31:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Aug 2014 04:31:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 16AC823888FE; Sat, 23 Aug 2014 04:30:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1619965 - in /hive/branches/cbo/ql/src: java/org/apache/hadoop/hive/ql/optimizer/optiq/RelOptHiveTable.java test/queries/clientpositive/cbo_correctness.q test/results/clientpositive/cbo_correctness.q.out Date: Sat, 23 Aug 2014 04:30:46 -0000 To: commits@hive.apache.org From: rhbutani@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140823043047.16AC823888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhbutani Date: Sat Aug 23 04:30:46 2014 New Revision: 1619965 URL: http://svn.apache.org/r1619965 Log: HIVE-7864 [CBO] Query fails if it refers only partitioning column (Ashutosh Chauhan) Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/RelOptHiveTable.java hive/branches/cbo/ql/src/test/queries/clientpositive/cbo_correctness.q hive/branches/cbo/ql/src/test/results/clientpositive/cbo_correctness.q.out Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/RelOptHiveTable.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/RelOptHiveTable.java?rev=1619965&r1=1619964&r2=1619965&view=diff ============================================================================== --- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/RelOptHiveTable.java (original) +++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/RelOptHiveTable.java Sat Aug 23 04:30:46 2014 @@ -176,16 +176,16 @@ public class RelOptHiveTable extends Rel } } + if (null == partitionList) { + // We could be here either because its an unpartitioned table or because + // there are no pruning predicates on a partitioned table. + computePartitionList(m_hiveConf, null); + } + // 2. Obtain Col Stats for Non Partition Cols if (nonPartColNamesThatRqrStats.size() > 0) { List hiveColStats; - if (null == partitionList) { - // We could be here either because its an unpartitioned table or because - // there are no pruning predicates on a partitioned table. - computePartitionList(m_hiveConf, null); - } - if (!m_hiveTblMetadata.isPartitioned()) { // 2.1 Handle the case for unpartitioned table. hiveColStats = StatsUtils.getTableColumnStats(m_hiveTblMetadata, m_hiveNonPartitionCols, Modified: hive/branches/cbo/ql/src/test/queries/clientpositive/cbo_correctness.q URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/queries/clientpositive/cbo_correctness.q?rev=1619965&r1=1619964&r2=1619965&view=diff ============================================================================== --- hive/branches/cbo/ql/src/test/queries/clientpositive/cbo_correctness.q (original) +++ hive/branches/cbo/ql/src/test/queries/clientpositive/cbo_correctness.q Sat Aug 23 04:30:46 2014 @@ -220,3 +220,6 @@ select null from t3; -- 14. unary operator select key from t1 where c_int = -6 or c_int = +6; + +-- 15. query referencing only partition columns +select count(t1.dt) from t1 join t2 on t1.dt = t2.dt where t1.dt = '2014' ; Modified: hive/branches/cbo/ql/src/test/results/clientpositive/cbo_correctness.q.out URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/clientpositive/cbo_correctness.q.out?rev=1619965&r1=1619964&r2=1619965&view=diff ============================================================================== --- hive/branches/cbo/ql/src/test/results/clientpositive/cbo_correctness.q.out (original) +++ hive/branches/cbo/ql/src/test/results/clientpositive/cbo_correctness.q.out Sat Aug 23 04:30:46 2014 @@ -17894,3 +17894,20 @@ POSTHOOK: type: QUERY POSTHOOK: Input: default@t1 POSTHOOK: Input: default@t1@dt=2014 #### A masked pattern was here #### +PREHOOK: query: -- 15. query referencing only partition columns +select count(t1.dt) from t1 join t2 on t1.dt = t2.dt where t1.dt = '2014' +PREHOOK: type: QUERY +PREHOOK: Input: default@t1 +PREHOOK: Input: default@t1@dt=2014 +PREHOOK: Input: default@t2 +PREHOOK: Input: default@t2@dt=2014 +#### A masked pattern was here #### +POSTHOOK: query: -- 15. query referencing only partition columns +select count(t1.dt) from t1 join t2 on t1.dt = t2.dt where t1.dt = '2014' +POSTHOOK: type: QUERY +POSTHOOK: Input: default@t1 +POSTHOOK: Input: default@t1@dt=2014 +POSTHOOK: Input: default@t2 +POSTHOOK: Input: default@t2@dt=2014 +#### A masked pattern was here #### +400