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 03B3A109D9 for ; Mon, 2 Dec 2013 23:38:36 +0000 (UTC) Received: (qmail 8811 invoked by uid 500); 2 Dec 2013 23:38:35 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 8750 invoked by uid 500); 2 Dec 2013 23:38:35 -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 8681 invoked by uid 500); 2 Dec 2013 23:38:35 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 8642 invoked by uid 99); 2 Dec 2013 23:38:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Dec 2013 23:38:35 +0000 Date: Mon, 2 Dec 2013 23:38:35 +0000 (UTC) From: "Xuefu Zhang (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (HIVE-5802) Hive UDF pow limits the second input to integer when the first input is a decimal 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-5802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xuefu Zhang resolved HIVE-5802. ------------------------------- Resolution: Fixed > Hive UDF pow limits the second input to integer when the first input is a decimal > --------------------------------------------------------------------------------- > > Key: HIVE-5802 > URL: https://issues.apache.org/jira/browse/HIVE-5802 > Project: Hive > Issue Type: Improvement > Components: Types, UDF > Affects Versions: 0.12.0 > Reporter: Xuefu Zhang > Assignee: Xuefu Zhang > > For example, > {code} > hive> desc test; > OK > i int None > b boolean None > d double None > s string None > dec decimal(5,2) None > hive> explain select pow(dec, 2.5) from test; > FAILED: SemanticException [Error 10014]: Line 1:15 Wrong arguments '2.5': No matching method for class org.apache.hadoop.hive.ql.udf.UDFPower with (decimal(5,2), double). Possible choices: _FUNC_(decimal(65,30), int) _FUNC_(double, double) _FUNC_(double, int) > {code} > This seems too restrictive. MySQL, on the other hand, supports fractional power as the second input. > {code} > mysql> select pow(d, 2.5) from test; > mysql> desc test; > +-------+--------------+------+-----+---------+-------+ > | Field | Type | Null | Key | Default | Extra | > +-------+--------------+------+-----+---------+-------+ > | i | int(11) | YES | | NULL | | > | b | tinyint(1) | YES | | NULL | | > | d | double | YES | | NULL | | > | s | varchar(5) | YES | | NULL | | > | dd | decimal(5,2) | YES | | NULL | | > +-------+--------------+------+-----+---------+-------+ > 5 rows in set (0.00 sec) > mysql> select pow(dd, 2.5) from test; > +-------------------+ > | pow(dd, 2.5) | > +-------------------+ > | 2570.215713318881 | > +-------------------+ > 1 row in set (0.00 sec) > {code} > Hive should also support this. -- This message was sent by Atlassian JIRA (v6.1#6144)