[ https://issues.apache.org/jira/browse/HIVE-24598?focusedWorklogId=774120&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-774120 ]
ASF GitHub Bot logged work on HIVE-24598: ----------------------------------------- Author: ASF GitHub Bot Created on: 24/May/22 16:35 Start Date: 24/May/22 16:35 Worklog Time Spent: 10m Work Description: soubhik-c opened a new pull request, #3322: URL: https://github.com/apache/hive/pull/3322 ### What changes were proposed in this pull request? NULL is a special value in SQL and therefore trim function should return NULL instead of error out. ### Why are the changes needed? Argument object inspector now accommodates NULL value as VOID type. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added ptest with additional cases. Issue Time Tracking ------------------- Worklog Id: (was: 774120) Remaining Estimate: 0h Time Spent: 10m > 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 > Labels: newbie > Time Spent: 10m > Remaining Estimate: 0h > > 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.20.7#820007)