[
https://issues.apache.org/jira/browse/PHOENIX-6434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17325403#comment-17325403
]
ASF GitHub Bot commented on PHOENIX-6434:
-----------------------------------------
lhofhansl commented on a change in pull request #1194:
URL: https://github.com/apache/phoenix/pull/1194#discussion_r616266445
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexCheckerIT.java
##########
@@ -167,6 +169,129 @@ public void testDelete() throws Exception {
}
}
+ @Test
+ public void testPhoenixRowTimestamp() throws Exception {
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ String dataTableName = generateUniqueName();
+ String indexTableName = generateUniqueName();
+ Timestamp initial = new
Timestamp(EnvironmentEdgeManager.currentTimeMillis() - 1);
+ conn.createStatement().execute("create table " + dataTableName +
+ " (id varchar(10) not null primary key, val1 varchar(10),
val2 varchar(10), val3 varchar(10))" + tableDDLOptions);
+ conn.createStatement().execute("upsert into " + dataTableName + "
values ('a', 'ab', 'abc', 'abcd')");
+ conn.commit();
+ Timestamp before = new
Timestamp(EnvironmentEdgeManager.currentTimeMillis());
+ // Sleep 1ms to get a different row timestamps
+ Thread.sleep(1);
+ conn.createStatement().execute("upsert into " + dataTableName + "
values ('b', 'bc', 'bcd', 'bcde')");
+ conn.commit();
+ Timestamp after = new
Timestamp(EnvironmentEdgeManager.currentTimeMillis() + 1);
+ conn.createStatement().execute("CREATE INDEX " + indexTableName +
" on " +
+ dataTableName + " (val1, PHOENIX_ROW_TIMESTAMP()) " +
"include (val2, val3) " + (async ? "ASYNC" : "")+ this.indexDDLOptions);
+ if (async) {
+ // Run the index MR job to rebuild the index and verify that
index is built correctly
+ IndexToolIT.runIndexTool(true, false, null, dataTableName,
+ indexTableName, null, 0,
IndexTool.IndexVerifyType.AFTER);
+ }
+
+ String timeZoneID = Calendar.getInstance().getTimeZone().getID();
+ // Write a query to get the val2 = 'bc' with a time range query
+ String query = "SELECT val1, val2, PHOENIX_ROW_TIMESTAMP() from "
+ dataTableName + " WHERE val1 = 'bc' AND " +
Review comment:
Yeah... I found in my tests that these fail as well. Maybe comment them
with a jira number... Not important, though.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> Secondary Indexes on PHOENIX_ROW_TIMESTAMP()
> --------------------------------------------
>
> Key: PHOENIX-6434
> URL: https://issues.apache.org/jira/browse/PHOENIX-6434
> Project: Phoenix
> Issue Type: Improvement
> Affects Versions: 5.1.0, 4.16.0
> Reporter: Kadir Ozdemir
> Priority: Major
> Attachments: PHOENIX-6434.4.x.001.patch, PHOENIX-6434.4.x.002.patch,
> PHOENIX-6434.4.x.003.patch, PHOENIX-6434.4.x.004.patch,
> PHOENIX-6434.master.001.patch
>
>
> PHOENIX-5629 introduced the function PHOENIX_ROW_TIMESTAMP() that returns the
> last modified time of a row. PHOENIX_ROW_TIMESTAMP() can be used as a
> projection column and referred in a WHERE clause. It is desirable to have
> indexes on row timestamps. This will result in fast time range queries.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)