Return-Path: Delivered-To: apmail-hive-user-archive@www.apache.org Received: (qmail 51564 invoked from network); 5 Apr 2011 18:20:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Apr 2011 18:20:49 -0000 Received: (qmail 60220 invoked by uid 500); 5 Apr 2011 18:20:49 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 60178 invoked by uid 500); 5 Apr 2011 18:20:49 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 60170 invoked by uid 99); 5 Apr 2011 18:20:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Apr 2011 18:20:49 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of larry@bizo.com designates 74.125.82.176 as permitted sender) Received: from [74.125.82.176] (HELO mail-wy0-f176.google.com) (74.125.82.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Apr 2011 18:20:43 +0000 Received: by wyb40 with SMTP id 40so886759wyb.35 for ; Tue, 05 Apr 2011 11:20:21 -0700 (PDT) Received: by 10.216.254.82 with SMTP id g60mr196287wes.90.1302027621142; Tue, 05 Apr 2011 11:20:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.152.104 with HTTP; Tue, 5 Apr 2011 11:20:01 -0700 (PDT) From: Larry Ogrodnek Date: Tue, 5 Apr 2011 11:20:01 -0700 Message-ID: Subject: UDF constructor params? To: user@hive.apache.org Content-Type: text/plain; charset=ISO-8859-1 For some UDFs I'm working on now it feels like it would be handy to be able to pass in parameters during construction. It's an integration with an external reporting API... e.g. -- include last 30 days from april 4th create temporary function orders_last_month as 'com.example.OrderSearch("20110404", 30)' -- get orders for customer 11 select order_last_month(11), ... Obviously I can perform the same logic passing everything into the UDF: select orders_last_month("20110404", 30, 11), ... but this doesn't feel as nice.. additionally, having the information available in the constructor might give the UDF more information on how to perform caching, allow it to do more complex initialization, etc. Just wondering if this has ever been thought about, discussed, or needed by anyone else.... thanks, larry