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

Constant propagation does not evaluate constraint expressions at merge when CBO is enabled

    XMLWordPrintableJSON

Details

    Description

      Prior HIVE-23089 check and not null constraint violations may detected faster when merging.

      CREATE TABLE t_target(
      name string CHECK (length(name)<=20),
      age int,
      gpa double CHECK (gpa BETWEEN 0.0 AND 4.0))
      stored as orc TBLPROPERTIES ('transactional'='true');
      
      CREATE TABLE t_source(
      name string,
      age int,
      gpa double);
      
      insert into t_source(name, age, gpa) values ('student1', 16, null);
      
      insert into t_target(name, age, gpa) values ('student1', 16, 2.0);
      
      merge into t_target using t_source source on source.age=t_target.age when matched then update set gpa=6;
      

      Currently CBO can not handle constraint checks when merging so the filter operator with the enforce_constraint call is added to the Hive operator plan after CBO is succeeded and ConstantPropagate optimization is called only from TezCompiler with ConstantPropagateOption.SHORTCUT.
      With this option ConstantPropagate does not evaluate deterministic functions.

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              kkasa Krisztian Kasa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m