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

ASF GitHub Bot commented on PHOENIX-6541:
-----------------------------------------

ankitjain64 commented on a change in pull request #1300:
URL: https://github.com/apache/phoenix/pull/1300#discussion_r706509985



##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/OnDuplicateKeyIT.java
##########
@@ -754,6 +817,28 @@ private void assertRow(Connection conn, String tableName, 
String expectedPK, int
         assertFalse(rs.next());
     }
 
+    private void upsertRecord(Connection conn, String dml, String orgid, 
String userid, long ts, String status) throws SQLException {
+        try(PreparedStatement stmt = conn.prepareStatement(dml)) { // regular 
upsert
+            stmt.setString(1, orgid);
+            stmt.setString(2, userid);
+            stmt.setDate(3, new Date(ts));
+            stmt.setString(4, status); // status should change now
+            stmt.executeUpdate();
+            conn.commit();
+        }
+    }
+
+    private void assertNumRecords(int count, Connection conn, String dql, 
String... params)
+        throws Exception {
+        PreparedStatement stmt = conn.prepareStatement(dql);
+        int counter = 1;
+        for (String param : params) {
+            stmt.setString(counter++, param);
+        }
+        ResultSet rs = stmt.executeQuery();
+        assertTrue(rs.next());
+        assertEquals(count, rs.getInt(1));

Review comment:
       from the jira description looks like we want to make sure correct 
timestamps are used for the mutation but we are not validating that in the test 
case and just the row count. Is that sufficient @tkhurana ?




-- 
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]


> Use ROW_TIMESTAMP column value as timestamps for conditional upsert mutations
> -----------------------------------------------------------------------------
>
>                 Key: PHOENIX-6541
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6541
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.16.1, 5.1.2
>            Reporter: Tanuj Khurana
>            Assignee: Tanuj Khurana
>            Priority: Major
>
> For tables without indexes if ROW_TIMESTAMP is specified in the table DDL, 
> the mutations generated by conditional upserts don't have the correct 
> timestamp. This was introduced as part of [PHOENIX-6387]
> For tables with indexes, Phoenix doesn't allow specifying a PK column as 
> ROW_TIMESTAMP so this bug doesn't apply.
>  



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

Reply via email to