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

   [PHOENIX-7398](https://issues.apache.org/jira/browse/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.
   
   Similarly, 
[PHOENIX-7411](https://issues.apache.org/jira/browse/PHOENIX-7411) and 
[PHOENIX-7434](https://issues.apache.org/jira/browse/PHOENIX-7434) introduce 
Atomic Delete support for the single row deletion. It returns result (row) back 
to the client (using new API) only if the given client initiated Delete 
operation deleted the row when the row was alive. In the context of atomicity, 
this means that the delete operation is already idempotent and will continue to 
be idempotent, however the client that was able to successfully delete the row 
by taking lock on the live row (row without delete marker) is expected to be 
the only client that can retrieve the old row result back.
   
   The purpose of this Jira is to update the API signature for the 
PhoenixStatement API such that the abstract level ResultSet object can be 
returned for the returned row instead of Tuple object.
   
   Old API signature:
   
   ```
   /**
    * 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 {
   ```
   
   New API signature:
   
   ```
   /**
    * Executes the given SQL statement similar to JDBC API executeUpdate() but 
also returns the
    * updated or non-updated row as ResultSet 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 ResultSet, where int represents value 1 for 
successful row
    * update and 0 for non-successful row update, and ResultSet represents the 
state of the row.
    * @throws SQLException If the statement cannot be executed.
    */
   public Pair<Integer, ResultSet> executeAtomicUpdateReturnRow(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