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 DD7F8100E1 for ; Thu, 5 Dec 2013 13:33:48 +0000 (UTC) Received: (qmail 81925 invoked by uid 500); 5 Dec 2013 13:33:44 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 81882 invoked by uid 500); 5 Dec 2013 13:33:42 -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 81827 invoked by uid 500); 5 Dec 2013 13:33:40 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 81718 invoked by uid 99); 5 Dec 2013 13:33:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 13:33:35 +0000 Date: Thu, 5 Dec 2013 13:33:35 +0000 (UTC) From: "dima machlin (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HIVE-5964) Hive missing a filter predicate causing wrong results joining tables after sort by MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 dima machlin created HIVE-5964: ---------------------------------- Summary: Hive missing a filter predicate causing wrong results joining tables after sort by Key: HIVE-5964 URL: https://issues.apache.org/jira/browse/HIVE-5964 Project: Hive Issue Type: Bug Components: Query Processor Affects Versions: 0.11.0, 0.10.0 Reporter: dima machlin It seems like the optimization of predicate pushdown is failing under certain conditions causing wrong results as a filter predicate appears to be completely disregarded by the query processor for some reason. Here is the scenario (assuming "dual" table exists) : set hive.optimize.ppd=true; drop table if exists test_tbl ; create table test_tbl (id string,name string); insert into table test_tbl select 'a','b' from dual; test_tbl now contains : a b the following query : select t2.* from (select id,name from (select id,name from test_tbl) t1 sort by id) t2 join test_tbl t3 on (t2.id=t3.id ) where t2.name='c' and t3.id='a'; returns : a b The filter :" t2.name='c' " is missing from the execution plan and obviously doesn't apply. The filter "t3.id='a' " does appear in the plan and is being applied before the join. If the query changes a little bit like removing the sort by, removing the t1 sub-query or disabling hive.optimize.ppd then the predicate appears. I'm able to reproduce the problem both in Hive 0.10 and Hive 0.11 although It seems to work fine in Hive 0.7 -- This message was sent by Atlassian JIRA (v6.1#6144)