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

org.apache.hadoop.hive.serde2.io.HiveVarcharWritable - Adds Superfluous Wrapper

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: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 3.0.0
    • None

    Description

      Class org.apache.hadoop.hive.serde2.io.HiveVarcharWritable creates a superfluous wrapper and then immediately unwraps it. Don't bother wrapping in this scenario.

        public void set(HiveVarchar val, int len) {
          set(val.getValue(), len);
        }
      
        public void set(String val, int maxLength) {
          value.set(HiveBaseChar.enforceMaxLength(val, maxLength));
        }
      
        public HiveVarchar getHiveVarchar() {
          return new HiveVarchar(value.toString(), -1);
        }
      
        // Here calls getHiveVarchar() which creates a new HiveVarchar object with a string in it
        // The object is passed to set(HiveVarchar val, int len)
        //  The string is pulled out
        public void enforceMaxLength(int maxLength) {
          // Might be possible to truncate the existing Text value, for now just do something simple.
          if (value.getLength()>maxLength && getCharacterLength()>maxLength)
            set(getHiveVarchar(), maxLength);
        }
      

      Attachments

        1. HIVE-16890.1.patch
          0.9 kB
          Naveen Gangam
        2. HIVE-16890.1.patch
          0.9 kB
          Naveen Gangam
        3. HIVE-16890.1.patch
          0.9 kB
          David Mollitor

        Activity

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

          People

            belugabehr David Mollitor Assign to me
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment