[ https://issues.apache.org/jira/browse/HIVE-24598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Krisztian Kasa updated HIVE-24598: ---------------------------------- Description: Hive throws exception when null is passed as a parameter of trim/rtrim/ltrim {code} select trim(null); {code} {code} org.apache.hadoop.hive.ql.parse.SemanticException: Line 1:7 Wrong arguments 'TOK_NULL': trim takes only STRING/CHAR/VARCHAR types. Found VOID {code} However null should be returned. From SQL11 standard: a) Let S be the value of the <trim source>. b) If <trim character> is specified, then let SC be the value of <trim character>; otherwise, let SC be <space>. c) If at least one of S and SC is the null value, then the result of the <trim function> is the null value. was: Hive throws exception when null is passed as a parameter of trim/rtrim/ltrim However null should be returned. From SQL11 standard: a) Let S be the value of the <trim source>. b) If <trim character> is specified, then let SC be the value of <trim character>; otherwise, let SC be <space>. c) If at least one of S and SC is the null value, then the result of the <trim function> is the null value. > Trim function should return null if any of its parameter is null > ---------------------------------------------------------------- > > Key: HIVE-24598 > URL: https://issues.apache.org/jira/browse/HIVE-24598 > Project: Hive > Issue Type: Improvement > Reporter: Krisztian Kasa > Priority: Minor > > Hive throws exception when null is passed as a parameter of trim/rtrim/ltrim > {code} > select trim(null); > {code} > {code} > org.apache.hadoop.hive.ql.parse.SemanticException: Line 1:7 Wrong arguments > 'TOK_NULL': trim takes only STRING/CHAR/VARCHAR types. Found VOID > {code} > However null should be returned. From SQL11 standard: > a) Let S be the value of the <trim source>. > b) If <trim character> is specified, then let SC be the value of <trim > character>; otherwise, let SC be > <space>. > c) If at least one of S and SC is the null value, then the result of the > <trim function> is the null value. -- This message was sent by Atlassian Jira (v8.3.4#803005)