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 5B50A18A4B for ; Tue, 13 Oct 2015 00:23:05 +0000 (UTC) Received: (qmail 73304 invoked by uid 500); 13 Oct 2015 00:23:05 -0000 Delivered-To: apmail-hive-issues-archive@hive.apache.org Received: (qmail 73279 invoked by uid 500); 13 Oct 2015 00:23:05 -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 73269 invoked by uid 99); 13 Oct 2015 00:23:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2015 00:23:05 +0000 Date: Tue, 13 Oct 2015 00:23:05 +0000 (UTC) From: "Szehon Ho (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-12082) Null comparison for greatest and least operator 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-12082?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Szehon Ho updated HIVE-12082: ----------------------------- Description: In mysql comparisons if any of the entries are null, then the result is null. [https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html|https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html] and [https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html|https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html]. This can be demonstrated by the following mysql query: {noformat} mysql> select greatest(1, null) from test; +-------------------+ | greatest(1, null) | +-------------------+ | NULL | +-------------------+ 1 row in set (0.00 sec) mysql> select greatest(-1, null) from test; +--------------------+ | greatest(-1, null) | +--------------------+ | NULL | +--------------------+ 1 row in set (0.00 sec) {noformat} This is in contrast to Hive, where null does not win in greatest, least over values: {noformat} hive> select greatest(null, 1) from test; OK 1 {noformat} was: In mysql comparisons if any of the entries are null, then the result is null. [https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html|https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html] and [https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html|https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html]. This can be demonstrated by the following mysql query: {noformat} mysql> select greatest(1, null) from test; +-------------------+ | greatest(1, null) | +-------------------+ | NULL | +-------------------+ 1 row in set (0.00 sec) mysql> select greatest(-1, null) from test; +--------------------+ | greatest(-1, null) | +--------------------+ | NULL | +--------------------+ 1 row in set (0.00 sec) {noformat} This is in contrast to Hive, where null does not win in greatest, least over values. > Null comparison for greatest and least operator > ----------------------------------------------- > > Key: HIVE-12082 > URL: https://issues.apache.org/jira/browse/HIVE-12082 > Project: Hive > Issue Type: Bug > Components: UDF > Reporter: Szehon Ho > Assignee: Szehon Ho > Attachments: HIVE-12082.patch > > > In mysql comparisons if any of the entries are null, then the result is null. > [https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html|https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html] and [https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html|https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html]. > This can be demonstrated by the following mysql query: > {noformat} > mysql> select greatest(1, null) from test; > +-------------------+ > | greatest(1, null) | > +-------------------+ > | NULL | > +-------------------+ > 1 row in set (0.00 sec) > mysql> select greatest(-1, null) from test; > +--------------------+ > | greatest(-1, null) | > +--------------------+ > | NULL | > +--------------------+ > 1 row in set (0.00 sec) > {noformat} > This is in contrast to Hive, where null does not win in greatest, least over values: > {noformat} > hive> select greatest(null, 1) from test; > OK > 1 > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)