Return-Path: X-Original-To: apmail-phoenix-dev-archive@minotaur.apache.org Delivered-To: apmail-phoenix-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6EFC417E4D for ; Tue, 28 Apr 2015 08:19:32 +0000 (UTC) Received: (qmail 53938 invoked by uid 500); 28 Apr 2015 08:19:32 -0000 Delivered-To: apmail-phoenix-dev-archive@phoenix.apache.org Received: (qmail 53885 invoked by uid 500); 28 Apr 2015 08:19:32 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 53874 invoked by uid 99); 28 Apr 2015 08:19:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 08:19:32 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: message received from 54.191.145.13 which is an MX secondary for dev@phoenix.apache.org) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 08:19:27 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id E3957283F1 for ; Tue, 28 Apr 2015 08:19:07 +0000 (UTC) Received: (qmail 52735 invoked by uid 99); 28 Apr 2015 08:19:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 08:19:07 +0000 Date: Tue, 28 Apr 2015 08:19:07 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@phoenix.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-538) Support UDFs 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/PHOENIX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14516635#comment-14516635 ] ASF GitHub Bot commented on PHOENIX-538: ---------------------------------------- Github user chrajeshbabu closed the pull request at: https://github.com/apache/phoenix/pull/77 > Support UDFs > ------------ > > Key: PHOENIX-538 > URL: https://issues.apache.org/jira/browse/PHOENIX-538 > Project: Phoenix > Issue Type: Task > Reporter: James Taylor > Assignee: Rajeshbabu Chintaguntla > Fix For: 5.0.0, 4.4.0 > > Attachments: PHOENIX-538-wip.patch, PHOENIX-538_v1.patch, PHOENIX-538_v2.patch, PHOENIX-538_v3.patch, PHOENIX-538_v4.patch, PHOENIX-538_v5.patch, PHOENIX-538_v6.patch, PHOENIX-538_v6.patch > > > Phoenix allows built-in functions to be added (as described [here](http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html)) with the restriction that they must be in the phoenix jar. We should improve on this and allow folks to declare new functions through a CREATE FUNCTION command like this: > CREATE FUNCTION mdHash(anytype) > RETURNS binary(16) > LOCATION 'hdfs://path-to-my-jar' 'com.me.MDHashFunction' > Since HBase supports loading jars dynamically, this would not be too difficult. The function implementation class would be required to extend our ScalarFunction base class. Here's how I could see it being implemented: > * modify the phoenix grammar to support the new CREATE FUNCTION syntax > * create a new UTFParseNode class to capture the parse state > * add a new method to the MetaDataProtocol interface > * add a new method in ConnectionQueryServices to invoke the MetaDataProtocol method > * add a new method in MetaDataClient to invoke the ConnectionQueryServices method > * persist functions in a new "SYSTEM.FUNCTION" table > * add a new client-side representation to cache functions called PFunction > * modify ColumnResolver to dynamically resolve a function in the same way we dynamically resolve and load a table > * create and register a new ExpressionType called UDFExpression > * at parse time, check for the function name in the built in list first (as is currently done), and if not found in the PFunction cache. If not found there, then use the new UDFExpression as a placeholder and have the ColumnResolver attempt to resolve it at compile time and throw an error if unsuccessful. -- This message was sent by Atlassian JIRA (v6.3.4#6332)