Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-24598

Trim function should return null if any of its parameter is null

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Hive throws exception when null is passed as a parameter of trim/rtrim/ltrim

      select trim(null);
      
      org.apache.hadoop.hive.ql.parse.SemanticException: Line 1:7 Wrong arguments 'TOK_NULL': trim takes only STRING/CHAR/VARCHAR types. Found VOID
      

       

      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.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            soubhik-c Soubhik Chakraborty Assign to me
            kkasa Krisztian Kasa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 20m
              20m

              Slack

                Issue deployment