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

Constant propagate returns string values in incorrect format

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
    • 1.0.0, 1.2.0
    • 2.0.1, 2.1.0
    • None
    • None

    Description

      STEP 1. Create and upload test data

      Execute in command line:

      nano stest.data
      

      Add to file:

      000126,000777
      000126,000778
      000126,000779
      000474,000888
      000468,000889
      000272,000880
      
      hadoop fs -put stest.data /
      
      hive> create table stest(x STRING, y STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
      hive> LOAD DATA  INPATH '/stest.data' OVERWRITE INTO TABLE stest;
      

      STEP 2. Execute test query (with cast for x)

      select x from stest where cast(x as int) = 126;
      

      EXPECTED RESULT:

      000126
      000126
      000126
      

      ACTUAL RESULT:

      126
      126
      126
      

      STEP 3. Execute test query (no cast for x)

      hive> select x from stest where  x = 126; 
      

      EXPECTED RESULT:

      000126
      000126
      000126
      

      ACTUAL RESULT:

      126
      126
      126
      

      In steps #2, #3 I expected '000126' because the origin type of x is STRING in stest table.

      Note, setting hive.optimize.constant.propagation=false fixes the issue.

      hive> set hive.optimize.constant.propagation=false;
      hive> select x from stest where  x = 126;
      OK
      000126
      000126
      000126
      

      Related to HIVE-11104, HIVE-8555

      Attachments

        1. HIVE-12749.1.patch
          3 kB
          Oleksiy Sayankin
        2. HIVE-12749.2.patch
          291 kB
          Oleksiy Sayankin
        3. HIVE-12749.3.patch
          3 kB
          Aleksey Vovchenko
        4. HIVE-12749.4.patch
          293 kB
          Aleksey Vovchenko
        5. HIVE-12749.5.patch
          253 kB
          Aleksey Vovchenko
        6. HIVE-12749.6.patch
          260 kB
          Aleksey Vovchenko
        7. HIVE-12749.7.patch
          263 kB
          Aleksey Vovchenko
        8. HIVE-12749.8.patch
          250 kB
          Aleksey Vovchenko

        Issue Links

        Activity

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

          People

            AleKsey Vovchenko Aleksey Vovchenko Assign to me
            osayankin Oleksiy Sayankin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment