ChinmaySKulkarni commented on a change in pull request #724: PHOENIX-5629
Phoenix Function to Return HBase row timestamp
URL: https://github.com/apache/phoenix/pull/724#discussion_r392445610
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixRowTimestampFunctionIT.java
##########
@@ -191,4 +192,158 @@ public void testRowTimestampColumn() throws Exception {
}
}
+ @Test
+ public void testRowTimestampColumnAndPredicates() throws Exception {
+ String tableName = generateUniqueName();
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ String ddl = "CREATE TABLE IF NOT EXISTS " + tableName
+ + " (PK1 INTEGER NOT NULL, PK2 DATE NOT NULL, KV1 VARCHAR,
KV2 VARCHAR"
+ + " CONSTRAINT PK PRIMARY KEY(PK1, PK2))" +
this.tableDDLOptions;
+ conn.createStatement().execute(ddl);
+
+ String dml = "UPSERT INTO " + tableName + " (PK1, PK2, KV1, KV2)
VALUES (?, ?, ?, ?)";
+
+ long rowTimestamp = EnvironmentEdgeManager.currentTimeMillis();
+ Date rowTimestampDate1 = new Date(rowTimestamp - 120000);
+ PreparedStatement stmt = conn.prepareStatement(dml);
+
+ int count = 5;
+ for (int id = 0; id < count; ++id) {
+ int idValue = id;
+ stmt.setInt(1, idValue);
+ stmt.setDate(2, rowTimestampDate1);
+ stmt.setString(3, "KV1_" + idValue);
+ stmt.setString(4, "KV2_" + idValue);
+ stmt.executeUpdate();
+ }
+ conn.commit();
+
+ // case: No rows should be selected
+ // Since we used a past date for column PK2
+ String dql1 = "SELECT PHOENIX_ROW_TIMESTAMP(), KV1 FROM " +
tableName +
+ " WHERE PHOENIX_ROW_TIMESTAMP() = PK2";
+
+ ResultSet rs1 = conn.createStatement().executeQuery(dql1);
+ assertTrue(!rs1.next());
Review comment:
Use assertFalse instead
----------------------------------------------------------------
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]
With regards,
Apache Git Services