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

Data loss occurs when multiple tables are join with different bucket_version

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.0
    • Fix Version/s: None
    • Component/s: Operators
    • Labels:
      None
    • Target Version/s:

      Description

      When different bucketVersion of tables do join and  reducers number greater than 2, result is easy to lose data.
      Scenario 1: Three tables join. The temporary result data of table_a in the first table and table_b in the second table joins result is recorded as tmp_a_b, When it joins with the third table, the bucket_version=2 of the table created by default after hive-3.0.0, temporary data tmp_a_b initialized the bucketVerison=-1, and then ReduceSinkOperator Verketison=-1 is joined. In the init method, the hash algorithm of selecting join column is selected according to bucketVersion. If bucketVersion = 2 and is not an acid operation, it will acquired the new algorithm of hash. Otherwise, the old algorithm of hash is acquired. Because of the inconsistency of the algorithm of hash, the partition of data allocation caused are different. At stage of Reducer, Data with the same key can not be paired resulting in data loss.

      Scenario 2: create two test tables, create table table_bucketversion_1(col_1 string, col_2 string) TBLPROPERTIES ('bucketing_version'='1'); table_bucketversion_2(col_1 string, col_2 string) TBLPROPERTIES ('bucketing_version'='2');
      when use table_bucketversion_1 to join table_bucketversion_2, partial result data will be loss due to bucketVerison is different.

       

        Attachments

        1. HIVE-22098.1.patch
          3 kB
          LuGuangMing
        2. image-2019-08-12-18-45-15-771.png
          8 kB
          LuGuangMing
        3. join_test.sql
          0.9 kB
          LuGuangMing
        4. table_a_data.orc
          0.4 kB
          LuGuangMing
        5. table_b_data.orc
          0.4 kB
          LuGuangMing
        6. table_c_data.orc
          0.4 kB
          LuGuangMing

          Activity

            People

            • Assignee:
              luguangming LuGuangMing
              Reporter:
              luguangming LuGuangMing
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: