Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-10924 add support for MERGE statement
  3. HIVE-14949

Add Cardinality Violation check in SQL MERGE stmt

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: Transactions
    • Labels:

      Description

      If > 1 row on source side matches the same row on target side that means that we are forced update (or delete) the same row in target more than once as part of the same SQL statement. This should raise an error per SQL Spec
      ISO/IEC 9075-2:2011(E)
      Section 14.2 under "General Rules" Item 6/Subitem a/Subitem 2/Subitem B

      There is no sure way to do this via static analysis of the query.

      Can we add something to ROJ operator to pay attention to ROW_ID of target side row and compare it with ROW_ID of target side of previous row output? If they are the same, that means > 1 source row matched.
      Or perhaps just mark each row in the hash table that it matched. And if it matches again, throw an error.

        Attachments

        1. HIVE-14949.01.patch
          12 kB
          Eugene Koifman
        2. HIVE-14949.02.patch
          10 kB
          Eugene Koifman
        3. HIVE-14949.03.patch
          18 kB
          Eugene Koifman
        4. HIVE-14949.03.patch
          16 kB
          Eugene Koifman
        5. HIVE-14949.04.patch
          27 kB
          Eugene Koifman
        6. HIVE-14949.05.patch
          27 kB
          Eugene Koifman

          Issue Links

            Activity

              People

              • Assignee:
                ekoifman Eugene Koifman
                Reporter:
                ekoifman Eugene Koifman
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: