Return-Path: Delivered-To: apmail-hadoop-hive-dev-archive@minotaur.apache.org Received: (qmail 35651 invoked from network); 23 Apr 2009 21:21:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Apr 2009 21:21:51 -0000 Received: (qmail 60478 invoked by uid 500); 23 Apr 2009 21:20:54 -0000 Delivered-To: apmail-hadoop-hive-dev-archive@hadoop.apache.org Received: (qmail 60370 invoked by uid 500); 23 Apr 2009 21:20:54 -0000 Mailing-List: contact hive-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hadoop.apache.org Delivered-To: mailing list hive-dev@hadoop.apache.org Received: (qmail 59679 invoked by uid 99); 23 Apr 2009 21:16:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Apr 2009 21:16:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Apr 2009 21:15:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4B687234C003 for ; Thu, 23 Apr 2009 14:15:30 -0700 (PDT) Message-ID: <141854519.1240521330293.JavaMail.jira@brutus> Date: Thu, 23 Apr 2009 14:15:30 -0700 (PDT) From: "Zheng Shao (JIRA)" To: hive-dev@hadoop.apache.org Subject: [jira] Updated: (HIVE-164) Support CASE statement using GenericUDF In-Reply-To: <918402023.1228977704250.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HIVE-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Zheng Shao updated HIVE-164: ---------------------------- Attachment: HIVE-164.6.patch Simplified the interface for GenericUDF. I guess it's easy to write a GenericUDF without too much knowledge of Hive (the developer will still need to know about ObjectInspector). {code} @UDFType(deterministic=true) public abstract class GenericUDF { /** * A Defered Object allows us to do lazy-evaluation * and short-circuiting. * GenericUDF use DeferedObject to pass arguments. */ public static interface DeferredObject { public Object get() throws HiveException; }; /** * The constructor */ public GenericUDF() { } /** * Initialize this GenericUDF. This will be called once and only once per * GenericUDF instance. * * @param arguments The ObjectInspector for the arguments * @throws UDFArgumentTypeException * Thrown when arguments have wrong types * @return The ObjectInspector for the return value */ public abstract ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentTypeException; /** * Evaluate the GenericUDF with the arguments. * @param arguments The arguments as DeferedObject, use DeferedObject.get() to * get the actual argument Object. The Objects can be inspected * by the ObjectInspectors passed in the initialize call. * @return The */ public abstract Object evaluate(DeferredObject[] arguments) throws HiveException; /** * Get the String to be displayed in explain. */ public abstract String getDisplayString(String[] children); } {code} > Support CASE statement using GenericUDF > --------------------------------------- > > Key: HIVE-164 > URL: https://issues.apache.org/jira/browse/HIVE-164 > Project: Hadoop Hive > Issue Type: New Feature > Components: Query Processor > Reporter: Zheng Shao > Assignee: Zheng Shao > Attachments: HIVE-164.4.patch, HIVE-164.5.patch, HIVE-164.6.patch > > > See http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html for details. > Syntax: > {code} > CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN result ...] [ CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.