[ 
https://issues.apache.org/jira/browse/PHOENIX-6714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827198#comment-17827198
 ] 

Jing Yu edited comment on PHOENIX-6714 at 3/19/24 6:59 PM:
-----------------------------------------------------------

Design document: 

https://docs.google.com/document/d/19-_cHJbh2yVpzrxR_rEz4GqfGDmi3Ht4W60dhV0rKIU/edit?usp=sharing


was (Author: JIRAUSER300295):
Design document: 
https://docs.google.com/document/d/1K9lttBvDXwWQXihp1XhWL8qZuSH0pBduc6P3ZLd7LoI/edit?usp=sharing

> Return update status from Conditional Upserts
> ---------------------------------------------
>
>                 Key: PHOENIX-6714
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6714
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Tanuj Khurana
>            Assignee: Jing Yu
>            Priority: Major
>
> {code:java}
> 0: jdbc:phoenix:localhost> upsert into T1 values ('cd', 123);
> 1 row affected (0.005 seconds)
> 0: jdbc:phoenix:localhost> upsert into T1 values ('cd', 123) on duplicate key 
> ignore;
> 1 row affected (0.008 seconds){code}
> Even when the row already exists, we return “1” row updated.
> {code:java}
> 0: jdbc:phoenix:localhost> upsert into T1 values ('cd', 123) on duplicate key 
> update
> val=val;
> 1 row affected (0.01 seconds) {code}
> In this case, the value of column ‘val’ does not change so we could return 
> “0“ to denote that fact. I mentioned ”could“ because as per the current 
> implementation even though from the application perspective the value of the 
> column is the same, from HBase perspective we are doing another PUT mutation 
> which adds another version to the underlying cell and updates the cell 
> timestamp. We also update the timestamp of the empty cell. So, technically 
> this is an update from HBase perspective.
> Referring MYSQL which has similar conditional update constructs, its 
> documentation says: “ With ON DUPLICATE KEY UPDATE, the affected-rows value 
> per row is 1 if the row is inserted as a new row, 2 if an existing row is 
> updated, and 0 if an existing row is set to its current values.”



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

Reply via email to