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

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

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



##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/OnDuplicateKeyIT.java
##########
@@ -745,6 +744,70 @@ public void testComplexDuplicateKeyExpression() throws 
Exception {
         }
     }
 
+    @Test
+    public void testRowStampCol() throws Exception {
+        // ROW_TIMESTAMP is not supported for tables with indexes
+        if (indexDDL.length() > 0) {
+            return;
+        }
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        String tableName = generateUniqueName();
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            String ddl = "create table " + tableName +
+                "(\n" +
+                "ORGANIZATION_ID CHAR(15) NOT NULL,\n" +
+                "USER_ID CHAR(15) NOT NULL,\n" +
+                "TIME_STAMP DATE NOT NULL,\n" +
+                "STATUS VARCHAR,\n" +
+                "CONSTRAINT PK PRIMARY KEY \n" +
+                "    (\n" +
+                "        ORGANIZATION_ID, \n" +
+                "        USER_ID,\n" +
+                "        TIME_STAMP ROW_TIMESTAMP\n" + // ROW_TIMESTAMP col
+                "    ) \n" +
+                ")\n";
+
+            conn.createStatement().execute(ddl);
+            String orgid = "ORG1";
+            String userid = "USER1";
+            String original = "ORIGINAL";
+            String updated = "UPDATED";
+            String duplicate = "DUPLICATE";
+            long rowTimestamp = EnvironmentEdgeManager.currentTimeMillis() - 
10;

Review comment:
       @ankitjain64  We just wanted a value that is less than the current time. 
10 is chosen arbitarily.




-- 
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 Jira aims to restore parity 
> with the old behavior of conditional upserts with regards to ROW_TIMESTAMP.  



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

Reply via email to