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

Union All of different types resolves to incorrect data

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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.2.0
    • Query Planning
    • None
    • Hide
      With this change, Hive will only perform implicit conversion within each type groups including string group, number group or date group, not across groups. So in order to union a string type with a date type, a explicit cast from string to date or from date to string is needed.
      Show
      With this change, Hive will only perform implicit conversion within each type groups including string group, number group or date group, not across groups. So in order to union a string type with a date type, a explicit cast from string to date or from date to string is needed.

    Description

      create table src(c1 date, c2 int, c3 double);
      insert into src values ('2016-01-01',5,1.25);
      select * from
      (select c1 from src union all
      select c2 from src union all
      select c3 from src) t;

      It will return NULL for the c1 values. Seems the common data type is resolved to the last c3 which is double.

      Attachments

        1. HIVE-14251.6.patch
          145 kB
          Aihua Xu
        2. HIVE-14251.5.patch
          144 kB
          Aihua Xu
        3. HIVE-14251.4.patch
          142 kB
          Aihua Xu
        4. HIVE-14251.3.patch
          140 kB
          Aihua Xu
        5. HIVE-14251.2.patch
          49 kB
          Aihua Xu
        6. HIVE-14251.1.patch
          8 kB
          Aihua Xu

        Activity

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

          People

            aihuaxu Aihua Xu Assign to me
            aihuaxu Aihua Xu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment