phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [4/6] phoenix git commit: PHOENIX-3153 Convert join-related IT tests to be derived from BaseHBaseManagedTimeTableReuseIT
Date Wed, 28 Sep 2016 18:30:44 GMT
http://git-wip-us.apache.org/repos/asf/phoenix/blob/00231480/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java
index aa99886..ec05149 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java
@@ -17,11 +17,6 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.apache.phoenix.util.TestUtil.JOIN_CUSTOMER_TABLE_FULL_NAME;
-import static org.apache.phoenix.util.TestUtil.JOIN_ITEM_TABLE_DISPLAY_NAME;
-import static org.apache.phoenix.util.TestUtil.JOIN_ITEM_TABLE_FULL_NAME;
-import static org.apache.phoenix.util.TestUtil.JOIN_SUPPLIER_TABLE_DISPLAY_NAME;
-import static org.apache.phoenix.util.TestUtil.JOIN_SUPPLIER_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -33,59 +28,22 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.schema.TableAlreadyExistsException;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.ReadOnlyProps;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT {
-    
-    private String[] indexDDL;
-    private String[] plans;
+public class HashJoinLocalIndexIT extends BaseJoinIT {
     
     public HashJoinLocalIndexIT(String[] indexDDL, String[] plans) {
-        this.indexDDL = indexDDL;
-        this.plans = plans;
-    }
-    
-    @BeforeClass
-    @Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
-    public static void doSetup() throws Exception {
-        Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
-        // Forces server cache to be used
-        props.put(QueryServices.INDEX_MUTATE_BATCH_SIZE_THRESHOLD_ATTRIB, Integer.toString(2));
-        // Must update config before starting server
-        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
-    }
-    
-    @Before
-    public void initTable() throws Exception {
-        initJoinTableValues(getUrl(), null, null);
-        if (indexDDL != null && indexDDL.length > 0) {
-            Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-            Connection conn = DriverManager.getConnection(getUrl(), props);
-            for (String ddl : indexDDL) {
-                try {
-                    conn.createStatement().execute(ddl);
-                } catch (TableAlreadyExistsException e) {
-                }
-            }
-            conn.close();
-        }
+        super(indexDDL, plans);
     }
     
     @Parameters
@@ -97,30 +55,30 @@ public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT {
                 "CREATE LOCAL INDEX \"idx_item\" ON " + JOIN_ITEM_TABLE_FULL_NAME + " (name)",
                 "CREATE LOCAL INDEX \"idx_supplier\" ON " + JOIN_SUPPLIER_TABLE_FULL_NAME
+ " (name)"
                 }, {
-                "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME
+ " [1,'S1']\n" +
+                "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_SUPPLIER_TABLE_FULL_NAME
+ " [1,'S1']\n" +
                 "    SERVER FILTER BY FIRST KEY ONLY\n" + 
                 "CLIENT MERGE SORT\n" +
                 "    PARALLEL INNER-JOIN TABLE 0\n" +
-                "        CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ITEM_TABLE_DISPLAY_NAME
+ " [1,*] - [1,'T6']\n" +
+                "        CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ITEM_TABLE_FULL_NAME
+ " [1,*] - [1,'T6']\n" +
                 "            SERVER FILTER BY FIRST KEY ONLY\n" +
                 "        CLIENT MERGE SORT\n" +
                 "    DYNAMIC SERVER FILTER BY \"S.:supplier_id\" IN (\"I.supplier_id\")",
                 
-                "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME
+ " [1,'S1']\n" +
+                "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_SUPPLIER_TABLE_FULL_NAME
+ " [1,'S1']\n" +
                 "    SERVER FILTER BY FIRST KEY ONLY\n" + 
                 "    SERVER AGGREGATE INTO DISTINCT ROWS BY [\"S.PHONE\"]\n" +
                 "CLIENT MERGE SORT\n" +
                 "    PARALLEL INNER-JOIN TABLE 0\n" +
-                "        CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ITEM_TABLE_DISPLAY_NAME
+ " [1,*] - [1,'T6']\n" +
+                "        CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ITEM_TABLE_FULL_NAME
+ " [1,*] - [1,'T6']\n" +
                 "            SERVER FILTER BY FIRST KEY ONLY\n" + 
                 "        CLIENT MERGE SORT\n" +
                 "    DYNAMIC SERVER FILTER BY \"S.:supplier_id\" IN (\"I.supplier_id\")",
                 
-                "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME
+ " [1,*] - [1,'S3']\n" +
+                "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_SUPPLIER_TABLE_FULL_NAME
+ " [1,*] - [1,'S3']\n" +
                 "    SERVER FILTER BY FIRST KEY ONLY\n" + 
                 "    SERVER AGGREGATE INTO SINGLE ROW\n" +
                 "    PARALLEL LEFT-JOIN TABLE 0\n" +
-                "        CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ITEM_TABLE_DISPLAY_NAME
+ " [1,*] - [1,'T6']\n" +
+                "        CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_ITEM_TABLE_FULL_NAME
+ " [1,*] - [1,'T6']\n" +
                 "            SERVER FILTER BY FIRST KEY ONLY\n" + 
                 "        CLIENT MERGE SORT",
                 }});
@@ -133,7 +91,7 @@ public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {            
-            String query = "select phone, i.name from " + JOIN_SUPPLIER_TABLE_FULL_NAME +
" s join " + JOIN_ITEM_TABLE_FULL_NAME + " i on s.\"supplier_id\" = i.\"supplier_id\" where
s.name = 'S1' and i.name < 'T6'";
+            String query = "select phone, i.name from " + getTableName(conn, JOIN_SUPPLIER_TABLE_FULL_NAME)
+ " s join " + getTableName(conn, JOIN_ITEM_TABLE_FULL_NAME) + " i on s.\"supplier_id\" =
i.\"supplier_id\" where s.name = 'S1' and i.name < 'T6'";
             PreparedStatement statement = conn.prepareStatement(query);
             ResultSet rs = statement.executeQuery();
             assertTrue (rs.next());
@@ -142,9 +100,9 @@ public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT {
             assertEquals(rs.getString(1), "888-888-1111");
             assertFalse(rs.next());
             rs = conn.createStatement().executeQuery("EXPLAIN " + query);
-            assertEquals(plans[0], QueryUtil.getExplainPlan(rs));
+            assertPlansEqual(plans[0], QueryUtil.getExplainPlan(rs));
             
-            query = "select phone, max(i.name) from " + JOIN_SUPPLIER_TABLE_FULL_NAME + "
s join " + JOIN_ITEM_TABLE_FULL_NAME + " i on s.\"supplier_id\" = i.\"supplier_id\" where
s.name = 'S1' and i.name < 'T6' group by phone";
+            query = "select phone, max(i.name) from " + getTableName(conn, JOIN_SUPPLIER_TABLE_FULL_NAME)
+ " s join " + getTableName(conn, JOIN_ITEM_TABLE_FULL_NAME) + " i on s.\"supplier_id\" =
i.\"supplier_id\" where s.name = 'S1' and i.name < 'T6' group by phone";
             statement = conn.prepareStatement(query);
             rs = statement.executeQuery();
             assertTrue (rs.next());
@@ -152,9 +110,9 @@ public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT {
             assertEquals(rs.getString(2), "T2");
             assertFalse(rs.next());
             rs = conn.createStatement().executeQuery("EXPLAIN " + query);
-            assertEquals(plans[1], QueryUtil.getExplainPlan(rs));
+            assertPlansEqual(plans[1], QueryUtil.getExplainPlan(rs));
             
-            query = "select max(phone), max(i.name) from " + JOIN_SUPPLIER_TABLE_FULL_NAME
+ " s left join " + JOIN_ITEM_TABLE_FULL_NAME + " i on s.\"supplier_id\" = i.\"supplier_id\"
and i.name < 'T6' where s.name <= 'S3'";
+            query = "select max(phone), max(i.name) from " + getTableName(conn, JOIN_SUPPLIER_TABLE_FULL_NAME)
+ " s left join " + getTableName(conn, JOIN_ITEM_TABLE_FULL_NAME) + " i on s.\"supplier_id\"
= i.\"supplier_id\" and i.name < 'T6' where s.name <= 'S3'";
             statement = conn.prepareStatement(query);
             rs = statement.executeQuery();
             assertTrue (rs.next());
@@ -162,7 +120,7 @@ public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT {
             assertEquals(rs.getString(2), "T4");
             assertFalse(rs.next());
             rs = conn.createStatement().executeQuery("EXPLAIN " + query);
-            assertEquals(plans[2], QueryUtil.getExplainPlan(rs));
+            assertPlansEqual(plans[2], QueryUtil.getExplainPlan(rs));
         } finally {
             conn.close();
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/00231480/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelRunListener.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelRunListener.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelRunListener.java
index 6c3a7f5..27808f5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelRunListener.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelRunListener.java
@@ -24,7 +24,7 @@ import org.junit.runner.notification.RunListener;
 public class ParallelRunListener extends RunListener {
     // This causes output to go to the console when run through maven
     // private static final Log LOG = LogFactory.getLog(ParallelRunListener.class);
-    private static final int TEAR_DOWN_THRESHOLD = 200;
+    private static final int TEAR_DOWN_THRESHOLD = 150;
     
     private int testRuns = 0;
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/00231480/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
index cf8b0a9..17a5577 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
@@ -53,6 +53,7 @@ public class QueryWithLimitIT extends BaseOwnClusterIT {
         props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(1));
         props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.TRUE.toString());
         props.put(QueryServices.SEQUENCE_SALT_BUCKETS_ATTRIB, Integer.toString(0)); // Prevents
RejectedExecutionException when deleting sequences
+        props.put(QueryServices.THREAD_POOL_SIZE_ATTRIB, Integer.toString(4));
         setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     


Mime
View raw message