Return-Path: X-Original-To: apmail-hive-issues-archive@minotaur.apache.org Delivered-To: apmail-hive-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E89318A23 for ; Mon, 14 Dec 2015 22:13:47 +0000 (UTC) Received: (qmail 20127 invoked by uid 500); 14 Dec 2015 22:13:47 -0000 Delivered-To: apmail-hive-issues-archive@hive.apache.org Received: (qmail 20105 invoked by uid 500); 14 Dec 2015 22:13:47 -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 20048 invoked by uid 99); 14 Dec 2015 22:13:46 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Dec 2015 22:13:46 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C820E2C1F76 for ; Mon, 14 Dec 2015 22:13:46 +0000 (UTC) Date: Mon, 14 Dec 2015 22:13:46 +0000 (UTC) From: "Matt McCline (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-12435) SELECT COUNT(CASE WHEN...) GROUPBY returns 1 for 'NULL' in a case of ORC and vectorization is enabled. 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-12435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15056818#comment-15056818 ] Matt McCline commented on HIVE-12435: ------------------------------------- Committed to branch-1 > SELECT COUNT(CASE WHEN...) GROUPBY returns 1 for 'NULL' in a case of ORC and vectorization is enabled. > ------------------------------------------------------------------------------------------------------ > > Key: HIVE-12435 > URL: https://issues.apache.org/jira/browse/HIVE-12435 > Project: Hive > Issue Type: Bug > Components: Vectorization > Affects Versions: 2.0.0 > Reporter: Takahiko Saito > Assignee: Matt McCline > Priority: Critical > Fix For: 1.3.0, 2.1.0 > > Attachments: HIVE-12435.01.patch, HIVE-12435.02.patch, HIVE-12435.03.patch, HIVE-12435.04.patch > > > Run the following query: > {noformat} > create table count_case_groupby (key string, bool boolean) STORED AS orc; > insert into table count_case_groupby values ('key1', true),('key2', false),('key3', NULL),('key4', false),('key5',NULL); > {noformat} > The table contains the following: > {noformat} > key1 true > key2 false > key3 NULL > key4 false > key5 NULL > {noformat} > The below query returns: > {noformat} > SELECT key, COUNT(CASE WHEN bool THEN 1 WHEN NOT bool THEN 0 ELSE NULL END) AS cnt_bool0_ok FROM count_case_groupby GROUP BY key; > key1 1 > key2 1 > key3 1 > key4 1 > key5 1 > {noformat} > while it expects the following results: > {noformat} > key1 1 > key2 1 > key3 0 > key4 1 > key5 0 > {noformat} > The query works with hive ver 1.2. Also it works when a table is not orc format. > Also even if it's an orc table, when vectorization is disabled, the query works. -- This message was sent by Atlassian JIRA (v6.3.4#6332)