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 0A9ECE174 for ; Wed, 19 Dec 2012 06:31:17 +0000 (UTC) Received: (qmail 74822 invoked by uid 500); 19 Dec 2012 06:31:16 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 74709 invoked by uid 500); 19 Dec 2012 06:31:16 -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 74425 invoked by uid 500); 19 Dec 2012 06:31:15 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 74369 invoked by uid 99); 19 Dec 2012 06:31:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Dec 2012 06:31:15 +0000 Date: Wed, 19 Dec 2012 06:31:15 +0000 (UTC) From: "Ashutosh Chauhan (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-3558) UDF LEFT(string,position) to HIVE 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-3558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ashutosh Chauhan updated HIVE-3558: ----------------------------------- Fix Version/s: (was: 0.10.0) > UDF LEFT(string,position) to HIVE > ---------------------------------- > > Key: HIVE-3558 > URL: https://issues.apache.org/jira/browse/HIVE-3558 > Project: Hive > Issue Type: New Feature > Components: UDF > Affects Versions: 0.9.0 > Reporter: Aruna Babu > Priority: Minor > > Introduction > UDF (User Defined Function) to obtain the left most 'n' characters from a string in HIVE. > Relevance > Current releases of Hive lacks a function which would returns the leftmost len characters from the string str, or NULL if any argument is NULL. > The function LEFT(string,length) would return the leftmost 'n' characters from the string , or NULL if any argument is NULL which would be useful while using HiveQL. This would find its use in all the technical aspects where the concept of strings are used. > Functionality :- > Function Name: LEFT(string,length) > > Returns the leftmost length characters from the string or NULL if any argument is NULL. > Example: hive>SELECT LEFT('https://www.irctc.co.in',5); > -> 'https' > Usage :- > Case 1: To query a table to find details based on an https request > Table :-Transaction > Request_id|date|period_id|url_name > 0001|01/07/2012|110001|https://www.irctc.co.in > 0002|02/07/2012|110001|https://nextstep.tcs.com > 0003|03/07/2012|110001|https://www.hdfcbank.com > 0005|01/07/2012|110001|http://www.lmnm.co.in > 0006|08/07/2012|110001|http://nextstart.com > 0007|10/07/2012|110001|https://netbanking.icicibank.com > 0012|21/07/2012|110001|http://www.people.co.in > 0026|08/07/2012|110001|http://nextprobs.com > 00023|25/07/2012|110001|https://netbanking.canarabank.com > Query : select * from transaction where LEFT(url_name,5)='https'; > Result :- > 0001|01/07/2012|110001|https://www.irctc.com > 0002|02/07/2012|110001|https://nextstep.tcs.com > 0003|03/07/2012|110001|https://www.hdfcbank.com > 0007|10/07/2012|110001|https://netbanking.icicibank.com > 00023|25/07/2012|110001|https://netbanking.canarabank.com -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira