You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/05/03 19:49:55 UTC
[GitHub] [phoenix] tkhurana commented on a change in pull request #1215: PHOENIX-6387 Conditional updates on tables with indexes
tkhurana commented on a change in pull request #1215:
URL: https://github.com/apache/phoenix/pull/1215#discussion_r625325621
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/OnDuplicateKeyIT.java
##########
@@ -498,18 +508,29 @@ public void run() {
exec.shutdownNow();
int finalResult = nThreads * nCommits * nIncrementsPerCommit;
- //assertEquals(finalResult,resultHolder[0]);
- ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + tableName + " WHERE counter1 >= 0");
+ boolean isIndexCreated = this.indexDDL != null && this.indexDDL.length() > 0;
+
+ ResultSet rs;
+ String selectSql = "SELECT * FROM " + tableName + " WHERE counter1 >= 0";
+ if (isIndexCreated) {
+ rs = conn.createStatement().executeQuery("EXPLAIN " + selectSql);
+ String actualExplainPlan = QueryUtil.getExplainPlan(rs);
+ IndexToolIT.assertExplainPlan(this.indexDDL.contains("local"), actualExplainPlan,
+ tableName, tableName + "_IDX");
+ }
+ rs = conn.createStatement().executeQuery(selectSql);
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(finalResult,rs.getInt(2));
assertFalse(rs.next());
- rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ * FROM " + tableName + " WHERE counter1 >= 0");
- assertTrue(rs.next());
- assertEquals("a",rs.getString(1));
- assertEquals(finalResult,rs.getInt(2));
- assertFalse(rs.next());
+ if (isIndexCreated) {
+ rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ * FROM " + tableName + " WHERE counter1 >= 0");
Review comment:
We are already doing one query which asserts that the index is used. This one is to verify that the data table has the same value for the column as the index table.
--
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:
users@infra.apache.org