hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Phillips (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HIVE-179) SUBSTR function should work like other databases
Date Thu, 08 Jan 2009 15:50:59 GMT

     [ https://issues.apache.org/jira/browse/HIVE-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

David Phillips updated HIVE-179:
--------------------------------

    Attachment: hive-substr.patch

This patch is tentative.  All tests pass except these two due to HIVE-215:

ant -Dtestcase=TestCliDriver -Dqfile=groupby2_map.q test
ant -Dtestcase=TestCliDriver -Dqfile=groupby3_map.q test



> 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
>         Attachments: hive-substr.patch
>
>
> 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): <empty>
>      SUBSTR('ABC',0,2): <empty>
>      SUBSTR('ABC',1,0): <empty>
>     SUBSTR('ABC',1,-1): <empty>
> Oracle:
>      SUBSTR('ABC',0,1): A
>      SUBSTR('ABC',0,2): AB
>      SUBSTR('ABC',1,0): <null>
>     SUBSTR('ABC',1,-1): <null>
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message