Github user karanmehta93 commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/351#discussion_r218652492
--- Diff:
phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
---
@@ -736,6 +737,71 @@ public void
testEmptyGuidePostGeneratedWhenDataSizeLessThanGPWidth() throws Exce
}
}
+ @Test
+ public void testCollectingAllVersionsOfCells() throws Exception {
+ String tableName = generateUniqueName();
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ long guidePostWidth = 70;
+ String ddl =
+ "CREATE TABLE " + tableName + " (k INTEGER PRIMARY
KEY, c1.a bigint, c2.b bigint)"
+ + " GUIDE_POSTS_WIDTH=" + guidePostWidth
+ + ", USE_STATS_FOR_PARALLELIZATION=true" + ",
VERSIONS=3";
+ conn.createStatement().execute(ddl);
+ conn.createStatement().execute("upsert into " + tableName + "
values (100,100,3)");
+ conn.commit();
+ conn.createStatement().execute("UPDATE STATISTICS " +
tableName);
+
+ ConnectionQueryServices queryServices =
+
conn.unwrap(PhoenixConnection.class).getQueryServices();
+
+ // The table only has one row. All cells just has one version,
and the data size of the row
+ // is less than the guide post width, so we generate empty
guide post.
+ try (Table statsHTable =
--- End diff --
nit: Extract out similar looking pieces of test code into a method
---