Return-Path: Delivered-To: apmail-hadoop-hive-dev-archive@locus.apache.org Received: (qmail 1193 invoked from network); 7 Jan 2009 13:49:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jan 2009 13:49:08 -0000 Received: (qmail 80741 invoked by uid 500); 7 Jan 2009 13:49:08 -0000 Delivered-To: apmail-hadoop-hive-dev-archive@hadoop.apache.org Received: (qmail 80717 invoked by uid 500); 7 Jan 2009 13:49:08 -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 80706 invoked by uid 99); 7 Jan 2009 13:49:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2009 05:49:08 -0800 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; Wed, 07 Jan 2009 13:49:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9CBA1234C4AF for ; Wed, 7 Jan 2009 05:48:47 -0800 (PST) Message-ID: <947344664.1231336127641.JavaMail.jira@brutus> Date: Wed, 7 Jan 2009 05:48:47 -0800 (PST) From: "Ashish Thusoo (JIRA)" To: hive-dev@hadoop.apache.org Subject: [jira] Updated: (HIVE-179) SUBSTR function should work like other databases In-Reply-To: <152149140.1229386184240.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HIVE-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ashish Thusoo updated HIVE-179: ------------------------------- Priority: Critical (was: Major) > SUBSTR function should work like other databases > ------------------------------------------------ > > Key: HIVE-179 > URL: https://issues.apache.org/jira/browse/HIVE-179 > Project: Hadoop Hive > Issue Type: Bug > Components: Query Processor > Reporter: David Phillips > Assignee: David Phillips > Priority: Critical > > Positions start at 1, not 0. Negative positions start at the end of the string and count backwards. > Oracle returns null for lengths less than 1 or non-existent substrings (any empty strings are null). MySQL and PostgreSQL return empty strings, never null. PostgreSQL errors for negative lengths. I suggest we follow the MySQL behavior. > Oracle treats position 0 the same as 1. Perhaps we should too? > {noformat} > SUBSTR('ABCDEFG',3,4): CDEF > SUBSTR('ABCDEFG',-5,4): CDEF > SUBSTR('ABCDEFG',3): CDEFG > SUBSTR('ABCDEFG',-5): CDEFG > SUBSTR('ABC',1,1): A > MySQL: > SUBSTR('ABC',0,1): > SUBSTR('ABC',0,2): > SUBSTR('ABC',1,0): > SUBSTR('ABC',1,-1): > Oracle: > SUBSTR('ABC',0,1): A > SUBSTR('ABC',0,2): AB > SUBSTR('ABC',1,0): > SUBSTR('ABC',1,-1): > {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.