phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject [13/15] phoenix git commit: Modify phoenix IT tests to extend BaseHBaseManagedTimeTableReuseIT (Prakul Agarwal, Samarth Jain)
Date Fri, 26 Aug 2016 23:16:17 GMT
http://git-wip-us.apache.org/repos/asf/phoenix/blob/14dab2f4/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java
index cf45724..17c6b72 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java
@@ -26,11 +26,12 @@ import java.sql.*;
 import org.apache.phoenix.schema.TypeMismatchException;
 import org.junit.Test;
 
-public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
-    private void initTables(Connection conn) throws Exception {
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[])";
+public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeTableReuseIT {
+    private String initTables(Connection conn) throws Exception {
+        String tableName = generateRandomString();
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[])";
         conn.createStatement().execute(ddl);
-        String dml = "UPSERT INTO regions(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2) VALUES('SF Bay Area'," +
+        String dml = "UPSERT INTO " + tableName + "(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2) VALUES('SF Bay Area'," +
                 "ARRAY['2345','46345','23234']," +
                 "ARRAY[2345,46345,23234,456]," +
                 "ARRAY[23.45,46.345,23.234,45.6,5.78]," +
@@ -44,12 +45,14 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
         PreparedStatement stmt = conn.prepareStatement(dml);
         stmt.execute();
         conn.commit();
+        return tableName;
     }
 
-    private void initTablesDesc(Connection conn, String type, String val) throws Exception {
-        String ddl = "CREATE TABLE regions (pk " + type + " PRIMARY KEY DESC,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],chars2 CHAR(15)[], bools BOOLEAN[])";
+    private String initTablesDesc(Connection conn, String type, String val) throws Exception {
+        String tableName = generateRandomString();
+        String ddl = "CREATE TABLE " + tableName + " (pk " + type + " PRIMARY KEY DESC,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],chars2 CHAR(15)[], bools BOOLEAN[])";
         conn.createStatement().execute(ddl);
-        String dml = "UPSERT INTO regions(pk,varchars,integers,doubles,bigints,chars,chars2,bools) VALUES(" + val + "," +
+        String dml = "UPSERT INTO " + tableName + "(pk,varchars,integers,doubles,bigints,chars,chars2,bools) VALUES(" + val + "," +
                 "ARRAY['2345','46345','23234']," +
                 "ARRAY[2345,46345,23234,456]," +
                 "ARRAY[23.45,46.345,23.234,45.6,5.78]," +
@@ -61,15 +64,17 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
         PreparedStatement stmt = conn.prepareStatement(dml);
         stmt.execute();
         conn.commit();
+        return tableName;
+
     }
 
     @Test
     public void testArrayAppendFunctionVarchar() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,'34567') FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,'34567') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"2345", "46345", "23234", "34567"};
@@ -83,10 +88,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInteger() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,1234) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,1234) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{2345, 46345, 23234, 456, 1234};
@@ -100,10 +105,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionDouble() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,double1) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,double1) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, 23.45};
@@ -117,10 +122,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionDouble2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,23) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,23) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, new Double(23)};
@@ -134,9 +139,9 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionBigint() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(bigints,1112) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(bigints,1112) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Long[] longs = new Long[]{12l, 34l, 56l, 78l, 910l, 1112l};
@@ -150,9 +155,9 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionChar() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,'fac') FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,'fac') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"a", "bbbb", "c", "ddd", "e", "fac"};
@@ -166,28 +171,28 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test(expected = TypeMismatchException.class)
     public void testArrayAppendFunctionIntToCharArray() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,234) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,234) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
     }
 
     @Test(expected = TypeMismatchException.class)
     public void testArrayAppendFunctionVarcharToIntegerArray() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,'234') FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,'234') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
 
     }
 
     @Test(expected = SQLException.class)
     public void testArrayAppendFunctionChar2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,'facfacfacfacfacfacfac') FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,'facfacfacfacfacfacfac') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         rs.next();
         rs.getArray(1);
     }
@@ -195,10 +200,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionIntegerToDoubleArray() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,45) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,45) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, 45.0};
@@ -212,10 +217,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionWithNestedFunctions1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(ARRAY[23,45],integers[1]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(ARRAY[23,45],integers[1]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{23, 45, 2345};
@@ -229,10 +234,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionWithNestedFunctions2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,ARRAY_ELEM(ARRAY[2,4],1)) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,ARRAY_ELEM(ARRAY[2,4],1)) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{2345, 46345, 23234, 456, 2};
@@ -246,10 +251,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionWithNestedFunctions3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,ARRAY_ELEM(doubles,2)) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,ARRAY_ELEM(doubles,2)) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, 46.345};
@@ -263,16 +268,16 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionWithUpsert1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
+        String tableName = generateRandomString();
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO regions(region_name,varchars) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY['hello','world'],':-)'))";
+        String dml = "UPSERT INTO " + tableName + "(region_name,varchars) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY['hello','world'],':-)'))";
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT varchars FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"hello", "world", ":-)"};
@@ -287,15 +292,16 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     public void testArrayAppendFunctionWithUpsert2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
 
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,integers INTEGER[])";
+        String tableName = generateRandomString();
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,integers INTEGER[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO regions(region_name,integers) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY[4,5],6))";
+        String dml = "UPSERT INTO " + tableName + "(region_name,integers) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY[4,5],6))";
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT integers FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT integers FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{4, 5, 6};
@@ -310,15 +316,16 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     public void testArrayAppendFunctionWithUpsert3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
 
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
+        String tableName = generateRandomString();
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO regions(region_name,doubles) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY[5.67,7.87],9.0))";
+        String dml = "UPSERT INTO " + tableName + "(region_name,doubles) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY[5.67,7.87],9.0))";
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT doubles FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT doubles FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{5.67, 7.87, new Double(9)};
@@ -333,25 +340,28 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     public void testArrayAppendFunctionWithUpsertSelect1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
 
-        String ddl = "CREATE TABLE source (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
+        String sourceTableName = generateRandomString();
+        String targetTableName = generateRandomString();
+
+        String ddl = "CREATE TABLE " + sourceTableName + " (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
         conn.createStatement().execute(ddl);
 
-        ddl = "CREATE TABLE target (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
+        ddl = "CREATE TABLE " + targetTableName + " (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO source(region_name,doubles) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY[5.67,7.87],9.0))";
+        String dml = "UPSERT INTO " + sourceTableName + "(region_name,doubles) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY[5.67,7.87],9.0))";
         conn.createStatement().execute(dml);
 
-        dml = "UPSERT INTO source(region_name,doubles) VALUES('SF Bay Area2',ARRAY_APPEND(ARRAY[56.7,7.87],9.2))";
+        dml = "UPSERT INTO " + sourceTableName + "(region_name,doubles) VALUES('SF Bay Area2',ARRAY_APPEND(ARRAY[56.7,7.87],9.2))";
         conn.createStatement().execute(dml);
         conn.commit();
 
-        dml = "UPSERT INTO target(region_name, doubles) SELECT region_name, ARRAY_APPEND(doubles,5) FROM source";
+        dml = "UPSERT INTO " + targetTableName + "(region_name, doubles) SELECT region_name, ARRAY_APPEND(doubles,5) FROM " + sourceTableName ;
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT doubles FROM target");
+        rs = conn.createStatement().executeQuery("SELECT doubles FROM " + targetTableName );
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{5.67, 7.87, new Double(9), new Double(5)};
@@ -371,25 +381,27 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     public void testArrayAppendFunctionWithUpsertSelect2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
 
-        String ddl = "CREATE TABLE source (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
+        String sourceTableName = generateRandomString();
+        String targetTableName = generateRandomString();
+        String ddl = "CREATE TABLE " + sourceTableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
         conn.createStatement().execute(ddl);
 
-        ddl = "CREATE TABLE target (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
+        ddl = "CREATE TABLE " + targetTableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO source(region_name,varchars) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY['abcd','b'],'c'))";
+        String dml = "UPSERT INTO " + sourceTableName + "(region_name,varchars) VALUES('SF Bay Area',ARRAY_APPEND(ARRAY['abcd','b'],'c'))";
         conn.createStatement().execute(dml);
 
-        dml = "UPSERT INTO source(region_name,varchars) VALUES('SF Bay Area2',ARRAY_APPEND(ARRAY['d','fgh'],'something'))";
+        dml = "UPSERT INTO " + sourceTableName + "(region_name,varchars) VALUES('SF Bay Area2',ARRAY_APPEND(ARRAY['d','fgh'],'something'))";
         conn.createStatement().execute(dml);
         conn.commit();
 
-        dml = "UPSERT INTO target(region_name, varchars) SELECT region_name, ARRAY_APPEND(varchars,'stu') FROM source";
+        dml = "UPSERT INTO " + targetTableName + "(region_name, varchars) SELECT region_name, ARRAY_APPEND(varchars,'stu') FROM " + sourceTableName ;
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT varchars FROM target");
+        rs = conn.createStatement().executeQuery("SELECT varchars FROM " + targetTableName );
         assertTrue(rs.next());
 
         String[] strings = new String[]{"abcd", "b", "c", "stu"};
@@ -408,10 +420,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY[2345,46345,23234,456,123]=ARRAY_APPEND(integers,123)");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY[2345,46345,23234,456,123]=ARRAY_APPEND(integers,123)");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -421,10 +433,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE varchars[1]=ANY(ARRAY_APPEND(ARRAY['2345','46345','23234'],'1234'))");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE varchars[1]=ANY(ARRAY_APPEND(ARRAY['2345','46345','23234'],'1234'))");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -434,10 +446,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY['2345','46345','23234','1234']=ARRAY_APPEND(ARRAY['2345','46345','23234'],'1234')");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY['2345','46345','23234','1234']=ARRAY_APPEND(ARRAY['2345','46345','23234'],'1234')");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -447,10 +459,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere4() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY[23.45,4634.5,2.3234,123.4]=ARRAY_APPEND(ARRAY[23.45,4634.5,2.3234],123.4)");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY[23.45,4634.5,2.3234,123.4]=ARRAY_APPEND(ARRAY[23.45,4634.5,2.3234],123.4)");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -460,10 +472,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere5() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY['2345','46345','23234','foo']=ARRAY_APPEND(varchars,'foo')");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY['2345','46345','23234','foo']=ARRAY_APPEND(varchars,'foo')");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -473,10 +485,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere6() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE chars2=ARRAY_APPEND(chars,'foo')");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE chars2=ARRAY_APPEND(chars,'foo')");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -486,10 +498,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionInWhere7() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY[2,3,4]=ARRAY_APPEND(ARRAY[2,3],4)");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY[2,3,4]=ARRAY_APPEND(ARRAY[2,3],4)");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -499,10 +511,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionVarcharWithNull() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,NULL) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,NULL) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"2345", "46345", "23234"};
@@ -516,10 +528,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionDoublesWithNull() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,NULL) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,NULL) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78};
@@ -533,10 +545,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionCharsWithNull() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,NULL) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,NULL) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"a", "bbbb", "c", "ddd", "e"};
@@ -550,10 +562,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionWithNull() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,nullcheck) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,nullcheck) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{2345, 46345, 23234, 456};
@@ -567,10 +579,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test(expected = SQLException.class)
     public void testArrayAppendFunctionCharLimitCheck() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,char1) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(chars,char1) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"a", "bbbb", "c", "ddd", "e", "wert"};
@@ -584,10 +596,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionIntegerDesc() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTablesDesc(conn, "INTEGER", "23");
+        String tableName = initTablesDesc(conn, "INTEGER", "23");
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,pk) FROM regions");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,pk) FROM " + tableName + "");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{2345, 46345, 23234, 456, 23};
@@ -602,10 +614,10 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionVarcharDesc() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTablesDesc(conn, "VARCHAR", "'e'");
+        String tableName = initTablesDesc(conn, "VARCHAR", "'e'");
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,pk) FROM regions");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(varchars,pk) FROM " + tableName + "");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"2345", "46345", "23234", "e"};
@@ -619,9 +631,9 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionBigIntDesc() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTablesDesc(conn, "BIGINT", "1112");
+        String tableName = initTablesDesc(conn, "BIGINT", "1112");
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(bigints,pk) FROM regions");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(bigints,pk) FROM " + tableName );
         assertTrue(rs.next());
 
         Long[] longs = new Long[]{12l, 34l, 56l, 78l, 910l, 1112l};
@@ -635,9 +647,9 @@ public class ArrayAppendFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayAppendFunctionBooleanDesc() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTablesDesc(conn, "BOOLEAN", "false");
+        String tableName = initTablesDesc(conn, "BOOLEAN", "false");
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(bools,pk) FROM regions");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(bools,pk) FROM " + tableName );
         assertTrue(rs.next());
 
         Boolean[] booleans = new Boolean[]{true, false, false};

http://git-wip-us.apache.org/repos/asf/phoenix/blob/14dab2f4/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayConcatFunctionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayConcatFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayConcatFunctionIT.java
index 247bfb7..168000e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayConcatFunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayConcatFunctionIT.java
@@ -26,12 +26,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
+public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeTableReuseIT {
 
-    private void initTables(Connection conn) throws Exception {
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[])";
+    private String initTables(Connection conn) throws Exception {
+        String tableName = generateRandomString();
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[])";
         conn.createStatement().execute(ddl);
-        String dml = "UPSERT INTO regions(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2) VALUES('SF Bay Area'," +
+        String dml = "UPSERT INTO " + tableName + "(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2) VALUES('SF Bay Area'," +
                 "ARRAY['2345','46345','23234']," +
                 "ARRAY[2345,46345,23234,456]," +
                 "ARRAY[23.45,46.345,23.234,45.6,5.78]," +
@@ -45,15 +46,16 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
         PreparedStatement stmt = conn.prepareStatement(dml);
         stmt.execute();
         conn.commit();
+        return tableName;
     }
 
     @Test
     public void testArrayConcatFunctionVarchar() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(varchars,varchars) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(varchars,varchars) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"2345", "46345", "23234", "2345", "46345", "23234"};
@@ -67,10 +69,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInteger() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(integers,integers) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(integers,integers) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{2345, 46345, 23234, 456, 2345, 46345, 23234, 456};
@@ -84,10 +86,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionDouble() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,doubles) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,doubles) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, 23.45, 46.345, 23.234, 45.6, 5.78};
@@ -101,10 +103,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionDouble2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,ARRAY[23]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,ARRAY[23]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, new Double(23)};
@@ -118,9 +120,9 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionBigint() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(bigints,bigints) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(bigints,bigints) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Long[] longs = new Long[]{12l, 34l, 56l, 78l, 910l, 12l, 34l, 56l, 78l, 910l};
@@ -134,9 +136,9 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionChar() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(chars,chars) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(chars,chars) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"a", "bbbb", "c", "ddd", "e", "a", "bbbb", "c", "ddd", "e"};
@@ -150,9 +152,9 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionChar3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(chars,chars2) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(chars,chars2) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"a", "bbbb", "c", "ddd", "e", "a", "bbbb", "c", "ddd", "e", "foo"};
@@ -166,28 +168,28 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test(expected = TypeMismatchException.class)
     public void testArrayConcatFunctionIntToCharArray() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(varchars,ARRAY[23,45]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(varchars,ARRAY[23,45]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
     }
 
     @Test(expected = TypeMismatchException.class)
     public void testArrayConcatFunctionVarcharToIntegerArray() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(integers,ARRAY['a', 'b']) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(integers,ARRAY['a', 'b']) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
 
     }
 
     @Test(expected = SQLException.class)
     public void testArrayConcatFunctionChar2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(chars,ARRAY['facfacfacfacfacfacfac','facfacfacfacfacfacfac']) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(chars,ARRAY['facfacfacfacfacfacfac','facfacfacfacfacfacfac']) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         rs.next();
         rs.getArray(1);
     }
@@ -195,10 +197,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionIntegerArrayToDoubleArray() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,ARRAY[45, 55]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,ARRAY[45, 55]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, 45.0, 55.0};
@@ -212,10 +214,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNestedFunctions1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(ARRAY[23,45],ARRAY[integers[1],integers[1]]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(ARRAY[23,45],ARRAY[integers[1],integers[1]]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{23, 45, 2345, 2345};
@@ -229,10 +231,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNestedFunctions2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(integers,ARRAY[ARRAY_ELEM(ARRAY[2,4],1),ARRAY_ELEM(ARRAY[2,4],2)]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(integers,ARRAY[ARRAY_ELEM(ARRAY[2,4],1),ARRAY_ELEM(ARRAY[2,4],2)]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{2345, 46345, 23234, 456, 2, 4};
@@ -246,10 +248,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNestedFunctions3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,ARRAY[ARRAY_ELEM(doubles, 1), ARRAY_ELEM(doubles, 1)]) FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT ARRAY_CAT(doubles,ARRAY[ARRAY_ELEM(doubles, 1), ARRAY_ELEM(doubles, 1)]) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{23.45, 46.345, 23.234, 45.6, 5.78, 23.45, 23.45};
@@ -263,16 +265,17 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithUpsert1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
+        String tableName = generateRandomString();
 
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO regions(region_name,varchars) VALUES('SF Bay Area',ARRAY_CAT(ARRAY['hello','world'],ARRAY[':-)']))";
+        String dml = "UPSERT INTO " + tableName + "(region_name,varchars) VALUES('SF Bay Area',ARRAY_CAT(ARRAY['hello','world'],ARRAY[':-)']))";
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT varchars FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         String[] strings = new String[]{"hello", "world", ":-)"};
@@ -286,16 +289,17 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithUpsert2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
+        String tableName = generateRandomString();
 
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,integers INTEGER[])";
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,integers INTEGER[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO regions(region_name,integers) VALUES('SF Bay Area',ARRAY_CAT(ARRAY[4,5],ARRAY[6, 7]))";
+        String dml = "UPSERT INTO " + tableName + "(region_name,integers) VALUES('SF Bay Area',ARRAY_CAT(ARRAY[4,5],ARRAY[6, 7]))";
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT integers FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT integers FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Integer[] integers = new Integer[]{4, 5, 6, 7};
@@ -309,16 +313,17 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithUpsert3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
+        String tableName = generateRandomString();
 
-        String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
+        String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO regions(region_name,doubles) VALUES('SF Bay Area',ARRAY_CAT(ARRAY[5.67,7.87],ARRAY[9.0, 8.0]))";
+        String dml = "UPSERT INTO " + tableName + "(region_name,doubles) VALUES('SF Bay Area',ARRAY_CAT(ARRAY[5.67,7.87],ARRAY[9.0, 8.0]))";
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT doubles FROM regions WHERE region_name = 'SF Bay Area'");
+        rs = conn.createStatement().executeQuery("SELECT doubles FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{5.67, 7.87, new Double(9), new Double(8)};
@@ -333,25 +338,27 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     public void testArrayConcatFunctionWithUpsertSelect1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
 
-        String ddl = "CREATE TABLE source (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
+        String sourceTableName = generateRandomString();
+        String targetTableName = generateRandomString();
+        String ddl = "CREATE TABLE " + sourceTableName + " (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
         conn.createStatement().execute(ddl);
 
-        ddl = "CREATE TABLE target (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
+        ddl = "CREATE TABLE " + targetTableName + " (region_name VARCHAR PRIMARY KEY,doubles DOUBLE[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO source(region_name,doubles) VALUES('SF Bay Area',ARRAY_CAT(ARRAY[5.67,7.87],ARRAY[9.0, 4.0]))";
+        String dml = "UPSERT INTO " + sourceTableName + "(region_name,doubles) VALUES('SF Bay Area',ARRAY_CAT(ARRAY[5.67,7.87],ARRAY[9.0, 4.0]))";
         conn.createStatement().execute(dml);
 
-        dml = "UPSERT INTO source(region_name,doubles) VALUES('SF Bay Area2',ARRAY_CAT(ARRAY[56.7,7.87],ARRAY[9.2, 3.4]))";
+        dml = "UPSERT INTO " + sourceTableName + "(region_name,doubles) VALUES('SF Bay Area2',ARRAY_CAT(ARRAY[56.7,7.87],ARRAY[9.2, 3.4]))";
         conn.createStatement().execute(dml);
         conn.commit();
 
-        dml = "UPSERT INTO target(region_name, doubles) SELECT region_name, ARRAY_CAT(doubles,doubles) FROM source";
+        dml = "UPSERT INTO " + targetTableName + "(region_name, doubles) SELECT region_name, ARRAY_CAT(doubles,doubles) FROM " + sourceTableName ;
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT doubles FROM target");
+        rs = conn.createStatement().executeQuery("SELECT doubles FROM " + targetTableName );
         assertTrue(rs.next());
 
         Double[] doubles = new Double[]{5.67, 7.87, new Double(9), new Double(4), 5.67, 7.87, new Double(9), new Double(4)};
@@ -370,26 +377,27 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithUpsertSelect2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-
-        String ddl = "CREATE TABLE source (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
+        String sourceTableName = generateRandomString();
+        String targetTableName = generateRandomString();
+        String ddl = "CREATE TABLE " + sourceTableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
         conn.createStatement().execute(ddl);
 
-        ddl = "CREATE TABLE target (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
+        ddl = "CREATE TABLE " + targetTableName + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[])";
         conn.createStatement().execute(ddl);
 
-        String dml = "UPSERT INTO source(region_name,varchars) VALUES('SF Bay Area',ARRAY_CAT(ARRAY['abcd','b'],ARRAY['c', 'd']))";
+        String dml = "UPSERT INTO " + sourceTableName + "(region_name,varchars) VALUES('SF Bay Area',ARRAY_CAT(ARRAY['abcd','b'],ARRAY['c', 'd']))";
         conn.createStatement().execute(dml);
 
-        dml = "UPSERT INTO source(region_name,varchars) VALUES('SF Bay Area2',ARRAY_CAT(ARRAY['d','fgh'],ARRAY['something','something']))";
+        dml = "UPSERT INTO " + sourceTableName + "(region_name,varchars) VALUES('SF Bay Area2',ARRAY_CAT(ARRAY['d','fgh'],ARRAY['something','something']))";
         conn.createStatement().execute(dml);
         conn.commit();
 
-        dml = "UPSERT INTO target(region_name, varchars) SELECT region_name, ARRAY_CAT(varchars,varchars) FROM source";
+        dml = "UPSERT INTO " + targetTableName + "(region_name, varchars) SELECT region_name, ARRAY_CAT(varchars,varchars) FROM " + sourceTableName ;
         conn.createStatement().execute(dml);
         conn.commit();
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT varchars FROM target");
+        rs = conn.createStatement().executeQuery("SELECT varchars FROM " + targetTableName );
         assertTrue(rs.next());
 
         String[] strings = new String[]{"abcd", "b", "c", "d", "abcd", "b", "c", "d"};
@@ -408,10 +416,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY[2345,46345,23234,456,123]=ARRAY_CAT(integers,ARRAY[123])");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY[2345,46345,23234,456,123]=ARRAY_CAT(integers,ARRAY[123])");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -421,10 +429,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE varchars[1]=ANY(ARRAY_CAT(ARRAY['2345','46345','23234'],ARRAY['1234']))");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE varchars[1]=ANY(ARRAY_CAT(ARRAY['2345','46345','23234'],ARRAY['1234']))");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -434,10 +442,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY['2345','46345','23234','1234','234']=ARRAY_CAT(ARRAY['2345','46345','23234'],ARRAY['1234', '234'])");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY['2345','46345','23234','1234','234']=ARRAY_CAT(ARRAY['2345','46345','23234'],ARRAY['1234', '234'])");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -447,10 +455,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere4() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY[23.45,4634.5,2.3234,123.4,12.0]=ARRAY_CAT(ARRAY[23.45,4634.5,2.3234],ARRAY[123.4,12.0])");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY[23.45,4634.5,2.3234,123.4,12.0]=ARRAY_CAT(ARRAY[23.45,4634.5,2.3234],ARRAY[123.4,12.0])");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -460,10 +468,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere5() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY['2345','46345','23234','foo','foo']=ARRAY_CAT(varchars,ARRAY['foo','foo'])");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY['2345','46345','23234','foo','foo']=ARRAY_CAT(varchars,ARRAY['foo','foo'])");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -473,10 +481,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere6() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE chars2=ARRAY_CAT(chars,ARRAY['foo'])");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE chars2=ARRAY_CAT(chars,ARRAY['foo'])");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -486,10 +494,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionInWhere7() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        rs = conn.createStatement().executeQuery("SELECT region_name FROM regions WHERE ARRAY[2,3,4,5]=ARRAY_CAT(ARRAY[2,3],ARRAY[4,5])");
+        rs = conn.createStatement().executeQuery("SELECT region_name FROM " + tableName + " WHERE ARRAY[2,3,4,5]=ARRAY_CAT(ARRAY[2,3],ARRAY[4,5])");
         assertTrue(rs.next());
 
         assertEquals("SF Bay Area", rs.getString(1));
@@ -499,10 +507,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNulls1() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM regions WHERE region_name = 'SF Bay Area'");
+        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         Array array1 = conn.createArrayOf("VARCHAR", new Object[]{"a", "b", "c", null});
         st.setArray(1, array1);
         Array array2 = conn.createArrayOf("VARCHAR", new Object[]{"a", "b", "c"});
@@ -519,10 +527,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNulls2() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM regions WHERE region_name = 'SF Bay Area'");
+        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         Array array1 = conn.createArrayOf("VARCHAR", new Object[]{"a", "b", "c"});
         st.setArray(1, array1);
         Array array2 = conn.createArrayOf("VARCHAR", new Object[]{null, "a", "b", "c"});
@@ -539,10 +547,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNulls3() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM regions WHERE region_name = 'SF Bay Area'");
+        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         Array array1 = conn.createArrayOf("VARCHAR", new Object[]{"a", "b", "c", null});
         st.setArray(1, array1);
         Array array2 = conn.createArrayOf("VARCHAR", new Object[]{null, "a", "b", "c"});
@@ -559,10 +567,10 @@ public class ArrayConcatFunctionIT extends BaseHBaseManagedTimeIT {
     @Test
     public void testArrayConcatFunctionWithNulls4() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
-        initTables(conn);
+        String tableName = initTables(conn);
 
         ResultSet rs;
-        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM regions WHERE region_name = 'SF Bay Area'");
+        PreparedStatement st = conn.prepareStatement("SELECT ARRAY_CAT(?,?) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
         Array array1 = conn.createArrayOf("VARCHAR", new Object[]{null, "a", null, "b", "c", null, null});
         st.setArray(1, array1);
         Array array2 = conn.createArrayOf("VARCHAR", new Object[]{null, null, "a", null, "b", null, "c", null});


Mime
View raw message