[ 
https://issues.apache.org/jira/browse/HIVE-26371?focusedWorklogId=788189&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-788189
 ]

ASF GitHub Bot logged work on HIVE-26371:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Jul/22 11:32
            Start Date: 06/Jul/22 11:32
    Worklog Time Spent: 10m 
      Work Description: kasakrisz opened a new pull request, #3415:
URL: https://github.com/apache/hive/pull/3415

   ### What changes were proposed in this pull request?
   Enable constant propagation for merge statments after predicate push down 
even if CBO succeeded.
   
   ### Why are the changes needed?
   CBO can not handle merge statements and enforce constraint call is added 
after CBO. This case the constant propagator delivered by Hive is called only 
with the option `ConstantPropagateOption.SHORTCUT` but with this setting the 
algorithm does not evaluate deterministic functions like `BETWEEN`.
   As a result constraint checks having expressions with constants are also 
evaluated at execution time only.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest.output.overwrite -Dtest=TestNegativeLlapCliDriver 
-Dqfile=check_merge.q -pl itests/qtest -Pitests
   ```




Issue Time Tracking
-------------------

            Worklog Id:     (was: 788189)
    Remaining Estimate: 0h
            Time Spent: 10m

> Constant propagation does not evaluate constraint expressions at merge when 
> CBO is enabled
> ------------------------------------------------------------------------------------------
>
>                 Key: HIVE-26371
>                 URL: https://issues.apache.org/jira/browse/HIVE-26371
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO, Logical Optimizer
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>             Fix For: 4.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code}
> 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;
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to