virajjasani opened a new pull request, #1985:
URL: https://github.com/apache/phoenix/pull/1985

   Jira: PHOENIX-7411
   
   PHOENIX-7398 introduces new PhoenixStatement API to return row for 
Atomic/Conditional Upserts. Phoenix already supports Upserts as Atomic 
operation by using ON DUPLICATE KEY clause. However, Deletes are not supported 
as atomic and single Delete query can also delete multiple rows based on the 
WHERE clause used.
   
   HBase does not provide API to return row state for atomic updates with Put 
and Delete mutations. HBase API checkAndMutate() also supports returning Result 
for Append and Increment mutations only, not for Put and Delete mutations.
   
   The purpose of this Jira is to introduce support for atomic delete of single 
row that can return the row only if it existed before executing the Delete 
mutation. If the row is already deleted, the API support is not expected to 
return any row. For single row delete to be atomic, IndexRegionObserver needs 
to take row lock for to be deleted row and also scan the row, similar to Atomic 
Put mutation(s).
   
    
   
   PhoenixStatement API signature is same as of PHOENIX-7398:
   
   ```
   /**
    * Executes the given SQL statement similar to JDBC API executeUpdate() but 
also returns the
    * updated or non-updated row as Result object back to the client. This must 
be used with
    * auto-commit Connection. This makes the operation atomic.
    * If the row is successfully updated, return the updated row, otherwise if 
the row
    * cannot be updated, return non-updated row.
    *
    * @param sql The SQL DML statement, UPSERT or DELETE for Phoenix.
    * @return The pair of int and Tuple, where int represents value 1 for 
successful row
    * update and 0 for non-successful row update, and Tuple represents the 
state of the row.
    * @throws SQLException If the statement cannot be executed.
    */
   public Pair<Integer, Tuple> executeUpdateReturnRow(String sql) throws 
SQLException {
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to