phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: PHOENIX-4103 Convert ColumnProjectionOptimizationIT to extend ParallelStatsDisabledIT
Date Fri, 18 Aug 2017 21:03:06 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 3c2bcde7d -> 371d23740


PHOENIX-4103 Convert ColumnProjectionOptimizationIT to extend ParallelStatsDisabledIT


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/371d2374
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/371d2374
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/371d2374

Branch: refs/heads/4.x-HBase-0.98
Commit: 371d237400c64a12f9aeb8d3c49b47089423aa4c
Parents: 3c2bcde
Author: Samarth Jain <samarth@apache.org>
Authored: Fri Aug 18 14:02:57 2017 -0700
Committer: Samarth Jain <samarth@apache.org>
Committed: Fri Aug 18 14:02:57 2017 -0700

----------------------------------------------------------------------
 .../end2end/ColumnProjectionOptimizationIT.java | 44 +++++++++++++-------
 1 file changed, 28 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/371d2374/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
index 3d808d2..423ad23 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
@@ -21,9 +21,6 @@ import static org.apache.phoenix.util.TestUtil.A_VALUE;
 import static org.apache.phoenix.util.TestUtil.B_VALUE;
 import static org.apache.phoenix.util.TestUtil.C_VALUE;
 import static org.apache.phoenix.util.TestUtil.E_VALUE;
-import static org.apache.phoenix.util.TestUtil.MDTEST_NAME;
-import static org.apache.phoenix.util.TestUtil.MDTEST_SCHEMA_NAME;
-import static org.apache.phoenix.util.TestUtil.MULTI_CF_NAME;
 import static org.apache.phoenix.util.TestUtil.ROW1;
 import static org.apache.phoenix.util.TestUtil.ROW2;
 import static org.apache.phoenix.util.TestUtil.ROW3;
@@ -60,7 +57,7 @@ import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.junit.Test;
 
-public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT {
+public class ColumnProjectionOptimizationIT extends ParallelStatsDisabledIT {
 
     @Test
     public void testSelect() throws Exception {
@@ -219,7 +216,8 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
         byte[] cfB = Bytes.toBytes(SchemaUtil.normalizeIdentifier("b"));
         byte[] cfC = Bytes.toBytes(SchemaUtil.normalizeIdentifier("c"));
         byte[][] familyNames = new byte[][] { cfB, cfC };
-        byte[] htableName = SchemaUtil.getTableNameAsBytes(MDTEST_SCHEMA_NAME, MDTEST_NAME);
+        String table = generateUniqueName();
+        byte[] htableName = SchemaUtil.getTableNameAsBytes("", table);
         HBaseAdmin admin = pconn.getQueryServices().getAdmin();
 
         @SuppressWarnings("deprecation")
@@ -235,7 +233,7 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5));
         Connection conn1 = DriverManager.getConnection(getUrl(), props);
 
-        String createStmt = "create view " + MDTEST_NAME + " (id integer not null primary
key,"
+        String createStmt = "create view " + table + " (id integer not null primary key,"
                 + " b.col1 integer, c.col2 bigint, c.col3 varchar(20))";
         conn1.createStatement().execute(createStmt);
         conn1.close();
@@ -268,7 +266,7 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
 
             props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10));
             Connection conn7 = DriverManager.getConnection(getUrl(), props);
-            String select = "SELECT id, b.col1 FROM " + MDTEST_NAME + " WHERE c.col2=?";
+            String select = "SELECT id, b.col1 FROM " + table + " WHERE c.col2=?";
             PreparedStatement ps = conn7.prepareStatement(select);
             ps.setInt(1, 10);
             ResultSet rs = ps.executeQuery();
@@ -282,7 +280,7 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
             assertFalse(rs.next());
 
             // Select contains only CF wildcards
-            select = "SELECT b.* FROM " + MDTEST_NAME + " WHERE c.col2=?";
+            select = "SELECT b.* FROM " + table + " WHERE c.col2=?";
             ps = conn7.prepareStatement(select);
             ps.setInt(1, 10);
             rs = ps.executeQuery();
@@ -293,7 +291,7 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
             assertEquals(3, rs.getInt(1));
             assertFalse(rs.next());
 
-            select = "SELECT b.* FROM " + MDTEST_NAME;
+            select = "SELECT b.* FROM " + table;
             ps = conn7.prepareStatement(select);
             rs = ps.executeQuery();
             assertTrue(rs.next());
@@ -313,17 +311,30 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
     }
 
     
-    private static void initMultiCFTable(long ts) throws Exception {
+    private static String initMultiCFTable(long ts) throws Exception {
         String url = getUrl();
-        ensureTableCreated(url, MULTI_CF_NAME, MULTI_CF_NAME, ts);
-
+        String tableName = generateUniqueName();
         Properties props = new Properties();
+        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
+        String ddl = "create table " + tableName +
+                "   (id char(15) not null primary key,\n" +
+                "    a.unique_user_count integer,\n" +
+                "    b.unique_org_count integer,\n" +
+                "    c.db_cpu_utilization decimal(31,10),\n" +
+                "    d.transaction_count bigint,\n" +
+                "    e.cpu_utilization decimal(31,10),\n" +
+                "    f.response_time bigint,\n" +
+                "    g.response_time bigint)";
+        try (Connection conn = DriverManager.getConnection(url, props)) {
+            conn.createStatement().execute(ddl);
+        }
+        props = new Properties();
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2));
         Connection conn = DriverManager.getConnection(url, props);
         try {
             PreparedStatement stmt = conn.prepareStatement(
-                    "upsert into " +
-                    "MULTI_CF(" +
+                    "upsert into " + tableName +
+                    "(" +
                     "    id, " +
                     "    a.unique_user_count, " +
                     "    b.unique_org_count, " +
@@ -341,6 +352,7 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
             stmt.setBigDecimal(4, BigDecimal.valueOf(20.9));
             stmt.execute();
             conn.commit();
+            return tableName;
         } finally {
             conn.close();
         }
@@ -349,13 +361,13 @@ public class ColumnProjectionOptimizationIT extends BaseClientManagedTimeIT
{
     @Test
     public void testSelectWithConditionOnMultiCF() throws Exception {
         long ts = nextTimestamp();
-        initMultiCFTable(ts);
+        String tableName = initMultiCFTable(ts);
         
         Properties props = new Properties();
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            String query = "SELECT c.db_cpu_utilization FROM MULTI_CF WHERE a.unique_user_count
= ? and b.unique_org_count = ?";
+            String query = "SELECT c.db_cpu_utilization FROM " + tableName + " WHERE a.unique_user_count
= ? and b.unique_org_count = ?";
             PreparedStatement statement = conn.prepareStatement(query);
             statement.setInt(1, 1);
             statement.setInt(2, 1);


Mime
View raw message