You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/09/10 09:48:00 UTC

[jira] [Work logged] (HIVE-25512) Merge statement does not enforce check constraints

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

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

                Author: ASF GitHub Bot
            Created on: 10/Sep/21 09:47
            Start Date: 10/Sep/21 09:47
    Worklog Time Spent: 10m 
      Work Description: kasakrisz opened a new pull request #2632:
URL: https://github.com/apache/hive/pull/2632


   ### What changes were proposed in this pull request?
   Generate constraint check Filter operator into physical plan for merge statements
   
   ### Why are the changes needed?
   CBO can not enforce constraint check in case of merge statements
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. When running some merge statements an error message will appear if a constraint would be violated.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest.output.overwrite -DskipSparkTests -Dtest=TestNegativeLlapLocalCliDriver -Dqfile=check_constraint_merge_update.q -pl itests/qtest -Pitests
   mvn test -Dtest.output.overwrite -DskipSparkTests -Dtest=TestMiniLlapLocalCliDriver -Dqfile=check_constraint.q -pl itests/qtest -Pitests
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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

> Merge statement does not enforce check constraints
> --------------------------------------------------
>
>                 Key: HIVE-25512
>                 URL: https://issues.apache.org/jira/browse/HIVE-25512
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code}
> set hive.support.concurrency=true;
> set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
> CREATE TABLE table_check_merge(
> 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 table_source( name string, age int, gpa double);
> insert into table_source(name, age, gpa) values ('student1', 16, null), (null, 20, 4.0);
> insert into table_check_merge(name, age, gpa) values ('student1', 16, 2.0);
> merge into table_check_merge using (select age from table_source)source
> on source.age=table_check_merge.age
> when matched then update set gpa=6;
> {code}
> Merge statement tries to update gpa to 6 which is not between 0.0 and 4.0.
> However the update succeeds.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)