http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterIT.java index 3ebbc8b..cd8f1fb 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterIT.java @@ -43,6 +43,7 @@ import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.PDataType; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -85,7 +86,7 @@ public class DefaultParallelIteratorsRegionSplitterIT extends BaseParallelIterat long ts = nextTimestamp(); initTableValues(ts); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); Scan scan = new Scan(); @@ -127,12 +128,12 @@ public class DefaultParallelIteratorsRegionSplitterIT extends BaseParallelIterat long ts = nextTimestamp(); initTableValues(ts); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); Scan scan = new Scan(); - ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES); + ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)); TableRef table = getTableRef(conn,ts); services.getStatsManager().updateStats(table); scan.setStartRow(HConstants.EMPTY_START_ROW);
http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java index d2b0c8a..2e45313 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java @@ -47,6 +47,7 @@ import java.util.List; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -74,7 +75,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { ts = nextTimestamp(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); if (indexDDL != null && indexDDL.length() > 0) { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(indexDDL); @@ -93,7 +94,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithWhere() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -205,7 +206,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithGroupBy() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -240,7 +241,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithOrderBy() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -335,7 +336,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithLimit() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -402,7 +403,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithDistinct() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -484,7 +485,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithAggregate() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -540,7 +541,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testDerivedTableWithJoin() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -590,7 +591,7 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { @Test public void testNestedDerivedTable() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java index cdbed0e..62fa0f5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java @@ -46,6 +46,7 @@ import java.sql.Types; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -60,7 +61,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT count(DISTINCT A_STRING) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -83,7 +84,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT count(DISTINCT ORGANIZATION_ID) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -106,7 +107,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT A_STRING, count(DISTINCT B_STRING) FROM aTable group by A_STRING"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -136,7 +137,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT A_STRING, count(DISTINCT B_STRING) FROM aTable group by A_STRING order by A_STRING desc"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -166,7 +167,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT A_STRING, count(DISTINCT B_STRING) as COUNT_B_STRING FROM aTable group by A_STRING order by COUNT_B_STRING"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -197,7 +198,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT organization_id, count(DISTINCT A_STRING) FROM aTable group by organization_id"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -224,7 +225,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT count(DISTINCT A_STRING), count(DISTINCT B_STRING) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -248,7 +249,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT count(DISTINCT 1) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -271,7 +272,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT { String query = "SELECT count(DISTINCT 1) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java index 1114b9f..35b8509 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java @@ -42,6 +42,7 @@ import org.apache.phoenix.query.ConnectionQueryServices; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.schema.ColumnAlreadyExistsException; import org.apache.phoenix.schema.ColumnFamilyNotFoundException; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.SchemaUtil; import org.junit.BeforeClass; import org.junit.Test; @@ -62,7 +63,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { @BeforeClass public static void doBeforeTestSetup() throws Exception { - HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin(); + HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin(); try { try { admin.disableTable(HBASE_DYNAMIC_COLUMNS_BYTES); @@ -76,7 +77,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { } private static void initTableValues() throws Exception { - ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES); + ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)); HTableInterface hTable = services.getTable(SchemaUtil.getTableNameAsBytes(HBASE_DYNAMIC_COLUMNS_SCHEMA_NAME,HBASE_DYNAMIC_COLUMNS)); try { // Insert rows using standard HBase mechanism with standard HBase "types" @@ -115,7 +116,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { public void testDynamicColums() throws Exception { String query = "SELECT * FROM HBASE_DYNAMIC_COLUMNS (DV varchar)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -140,7 +141,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { public void testDynamicColumsFamily() throws Exception { String query = "SELECT * FROM HBASE_DYNAMIC_COLUMNS (DV varchar,B.F2V2 varchar)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -167,7 +168,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { public void testDynamicColumsSpecificQuery() throws Exception { String query = "SELECT entry,F2V2 FROM HBASE_DYNAMIC_COLUMNS (DV varchar,B.F2V2 varchar)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -188,7 +189,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { public void testAmbiguousStaticSelect() throws Exception { String upsertquery = "Select * FROM HBASE_DYNAMIC_COLUMNS(A.F1V1 INTEGER)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(upsertquery); @@ -205,7 +206,7 @@ public class DynamicColumnIT extends BaseClientManagedTimeIT { public void testFakeCFDynamicUpsert() throws Exception { String upsertquery = "Select * FROM HBASE_DYNAMIC_COLUMNS(fakecf.DynCol VARCHAR)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(upsertquery); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicFamilyIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicFamilyIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicFamilyIT.java index 0b45968..88ef0b3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicFamilyIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicFamilyIT.java @@ -45,6 +45,7 @@ import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.schema.ColumnFamilyNotFoundException; import org.apache.phoenix.schema.PDataType; import org.apache.phoenix.util.ByteUtil; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.SchemaUtil; import org.junit.Before; import org.junit.Test; @@ -94,7 +95,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { @Before public void doBeforeTestSetup() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); String ddl = "create table if not exists " + WEB_STATS + " (entry varchar not null primary key," @@ -106,7 +107,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { } private static void initTableValues() throws Exception { - ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES); + ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)); HTableInterface hTable = services.getTable(SchemaUtil.getTableNameAsBytes(WEB_STATS_SCHEMA_NAME,WEB_STATS)); try { // Insert rows using standard HBase mechanism with standard HBase "types" @@ -176,7 +177,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { public void testGetAllDynColsInFamily() throws Exception { String query = "SELECT A.* FROM WEB_STATS WHERE entry='entry1'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -204,7 +205,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { public void testGetAllDynCols() throws Exception { String query = "SELECT * FROM WEB_STATS WHERE entry='entry1'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -231,7 +232,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { "B." + LAST_LOGIN_TIME_PREFIX + USER_ID2 + " TIME," + "B." + LAST_LOGIN_TIME_PREFIX + USER_ID3 + " TIME) WHERE entry='entry2'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -256,7 +257,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { "B.\"" + LAST_LOGIN_TIME_PREFIX + USER_ID2 + "\"" + " TIME," + "B.\"" + LAST_LOGIN_TIME_PREFIX + USER_ID3 + "\"" + " TIME) WHERE entry='entry2'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -281,7 +282,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { public void testProjectStaticAndDynamic() throws Exception { String query = "SELECT ENTRY, A.DUMMY, B.DUMMY, A.*,B.* FROM WEB_STATS WHERE entry='entry3'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -308,7 +309,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { public void testDynamicFamilyException() throws Exception { String query = "SELECT C.* FROM WEB_STATS"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -322,7 +323,7 @@ public class DynamicFamilyIT extends BaseHBaseManagedTimeIT { public void testDynamicFamilyFunctionException() throws Exception { String query = "SELECT count(C.*) FROM WEB_STATS"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicUpsertIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicUpsertIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicUpsertIT.java index 62c3551..b236f10 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicUpsertIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicUpsertIT.java @@ -33,6 +33,7 @@ import java.util.Properties; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.schema.ColumnAlreadyExistsException; import org.apache.phoenix.schema.ColumnFamilyNotFoundException; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -52,7 +53,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { @BeforeClass public static void doBeforeTestSetup() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); String ddl = "create table if not exists " + TABLE + " (entry varchar not null primary key," + " a.dummy varchar," + " b.dummy varchar)"; @@ -71,7 +72,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { // String selectquery = "SELECT * FROM "+TABLE; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); try { @@ -101,7 +102,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { + " (a.DynColA VARCHAR,b.DynColB VARCHAR) where entry='dynEntry'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); try { @@ -134,7 +135,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { + " (a.DynColA VARCHAR,b.DynColB VARCHAR) where entry='dynEntry'"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); try { @@ -166,7 +167,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { + " (a.DynCol VARCHAR,b.DynCol varchar) VALUES('dynEntry','aValue','bValue','dyncola')"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(upsertquery); @@ -186,7 +187,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { public void testAmbiguousStaticUpsert() throws Exception { String upsertquery = "UPSERT INTO " + TABLE + " (a.dummy INTEGER,b.dummy INTEGER) VALUES(1,2)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(upsertquery); @@ -203,7 +204,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { public void testAmbiguousDynamicUpsert() throws Exception { String upsertquery = "UPSERT INTO " + TABLE + " (a.DynCol VARCHAR,a.DynCol INTEGER) VALUES('dynCol',1)"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(upsertquery); @@ -220,7 +221,7 @@ public class DynamicUpsertIT extends BaseClientManagedTimeIT { public void testFakeCFDynamicUpsert() throws Exception { String upsertquery = "UPSERT INTO " + TABLE + " (fakecf.DynCol VARCHAR) VALUES('dynCol')"; String url = getUrl() + ";"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(upsertquery); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExtendedQueryExecIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExtendedQueryExecIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExtendedQueryExecIT.java index 9ea55d4..9d15e32 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExtendedQueryExecIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExtendedQueryExecIT.java @@ -32,6 +32,7 @@ import java.sql.SQLException; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -53,7 +54,7 @@ public class ExtendedQueryExecIT extends BaseClientManagedTimeIT { initATableValues(tenantId, getDefaultSplits(tenantId),date, ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -75,7 +76,7 @@ public class ExtendedQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId),null, ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { String query = "SELECT a_date FROM atable WHERE organization_id='" + tenantId + "' and a_date < TO_DATE(?)"; @@ -103,7 +104,7 @@ public class ExtendedQueryExecIT extends BaseClientManagedTimeIT { initATableValues(tenantId, getDefaultSplits(tenantId),date, ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -149,7 +150,7 @@ public class ExtendedQueryExecIT extends BaseClientManagedTimeIT { initATableValues(tenantId, getDefaultSplits(tenantId),date, ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/FunkyNamesIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FunkyNamesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FunkyNamesIT.java index f188fd5..b66f221 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FunkyNamesIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FunkyNamesIT.java @@ -32,6 +32,7 @@ import java.util.Properties; import org.apache.phoenix.schema.ColumnNotFoundException; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -42,7 +43,7 @@ public class FunkyNamesIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),FUNKY_NAME,splits, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); // Insert all rows at ts @@ -73,7 +74,7 @@ public class FunkyNamesIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT \"foo!\",\"#@$\",\"foo.bar-bas\",\"_blah^\" FROM FUNKY_NAMES"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -100,7 +101,7 @@ public class FunkyNamesIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT \"Value\",\"VALUE\",\"value\" FROM FUNKY_NAMES"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -130,7 +131,7 @@ public class FunkyNamesIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT \"1-3.4$\".\"foo!\" as \"1-2\",\"#@$\" as \"[3]\",\"foo.bar-bas\" as \"$$$\",\"_blah^\" \"0\" FROM FUNKY_NAMES \"1-3.4$\""; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java index 417729b..b811865 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java @@ -33,6 +33,7 @@ import java.sql.Statement; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -63,7 +64,7 @@ public class GroupByCaseIT extends BaseClientManagedTimeIT { } private void loadData(long ts) throws SQLException { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); insertRow(conn, "Report1", 10); @@ -91,7 +92,7 @@ public class GroupByCaseIT extends BaseClientManagedTimeIT { @Test public void testGroupByCaseWithIndex() throws Exception { Connection conn; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); GroupByCaseIT gbt = new GroupByCaseIT(); long ts = gbt.createTable(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); @@ -121,7 +122,7 @@ public class GroupByCaseIT extends BaseClientManagedTimeIT { GroupByCaseIT gbt = new GroupByCaseIT(); long ts = gbt.createTable(); gbt.loadData(ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); Statement stmt = conn.createStatement(); @@ -151,7 +152,7 @@ public class GroupByCaseIT extends BaseClientManagedTimeIT { GroupByCaseIT gbt = new GroupByCaseIT(); long ts = gbt.createTable(); gbt.loadData(ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); Statement stmt = conn.createStatement(); @@ -175,7 +176,7 @@ public class GroupByCaseIT extends BaseClientManagedTimeIT { GroupByCaseIT gbt = new GroupByCaseIT(); long ts = gbt.createTable(); gbt.loadData(ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); Connection conn = DriverManager.getConnection(getUrl(), props); gbt.executeQuery(conn,GROUPBY1); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java index e905bad..fce93ea 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java @@ -43,6 +43,7 @@ import java.util.List; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -67,7 +68,7 @@ public class GroupByIT extends QueryIT { @SuppressWarnings("unchecked") @Test public void testGroupByCondition() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); Connection conn = DriverManager.getConnection(getUrl(), props); PreparedStatement statement = conn.prepareStatement("SELECT count(*) FROM aTable WHERE organization_id=? GROUP BY a_integer=6"); @@ -129,7 +130,7 @@ public class GroupByIT extends QueryIT { @Test public void testNoWhereScan() throws Exception { String query = "SELECT y_integer FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -156,7 +157,7 @@ public class GroupByIT extends QueryIT { public void testGroupedAggregation() throws Exception { // Tests that you don't get an ambiguous column exception when using the same alias as the column name String query = "SELECT a_string as a_string, count(1), 'foo' FROM atable WHERE organization_id=? GROUP BY a_string"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -184,7 +185,7 @@ public class GroupByIT extends QueryIT { @Test public void testDistinctGroupedAggregation() throws Exception { String query = "SELECT DISTINCT a_string, count(1), 'foo' FROM atable WHERE organization_id=? GROUP BY a_string, b_string ORDER BY a_string, count(1)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -226,7 +227,7 @@ public class GroupByIT extends QueryIT { @Test public void testDistinctLimitedGroupedAggregation() throws Exception { String query = "SELECT /*+ NO_INDEX */ DISTINCT a_string, count(1), 'foo' FROM atable WHERE organization_id=? GROUP BY a_string, b_string ORDER BY count(1) desc,a_string LIMIT 2"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -264,7 +265,7 @@ public class GroupByIT extends QueryIT { @Test public void testDistinctUngroupedAggregation() throws Exception { String query = "SELECT DISTINCT count(1), 'foo' FROM atable WHERE organization_id=?"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -283,7 +284,7 @@ public class GroupByIT extends QueryIT { @Test public void testGroupedLimitedAggregation() throws Exception { String query = "SELECT a_string, count(1) FROM atable WHERE organization_id=? GROUP BY a_string LIMIT 2"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -309,7 +310,7 @@ public class GroupByIT extends QueryIT { "ATABLE VALUES ('" + tenantId + "','" + ROW5 + "','" + C_VALUE +"')"; // Override value that was set at creation time String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 1); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection upsertConn = DriverManager.getConnection(url, props); upsertConn.setAutoCommit(true); // Test auto commit // Insert all rows at ts @@ -354,7 +355,7 @@ public class GroupByIT extends QueryIT { public void testUngroupedAggregation() throws Exception { String query = "SELECT count(1) FROM atable WHERE organization_id=? and a_string = ?"; String url = getUrl(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); // Execute query at ts + 5 Connection conn = DriverManager.getConnection(url, props); try { @@ -388,7 +389,7 @@ public class GroupByIT extends QueryIT { public void testUngroupedAggregationNoWhere() throws Exception { String query = "SELECT count(*) FROM atable"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(url, props); try { @@ -406,7 +407,7 @@ public class GroupByIT extends QueryIT { public void testPointInTimeUngroupedAggregation() throws Exception { // Override value that was set at creation time String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 1); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection upsertConn = DriverManager.getConnection(url, props); String updateStmt = "upsert into " + @@ -465,7 +466,7 @@ public class GroupByIT extends QueryIT { "VALUES (?, ?, ?)"; // Override value that was set at creation time String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 1); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection upsertConn = DriverManager.getConnection(url, props); upsertConn.setAutoCommit(true); // Test auto commit PreparedStatement stmt = upsertConn.prepareStatement(updateStmt); @@ -518,7 +519,7 @@ public class GroupByIT extends QueryIT { // Override value that was set at creation time String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 1); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); // Remove column value at ts + 1 (i.e. equivalent to setting the value to null) Connection conn = DriverManager.getConnection(url, props); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java index 4ed85cb..e4e0736 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java @@ -52,6 +52,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.TableAlreadyExistsException; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.junit.Before; @@ -93,7 +94,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void initTable() throws Exception { initTableValues(); if (indexDDL != null && indexDDL.length > 0) { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); for (String ddl : indexDDL) { try { @@ -1146,7 +1147,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { ensureTableCreated(getUrl(), JOIN_SUPPLIER_TABLE_FULL_NAME); ensureTableCreated(getUrl(), JOIN_ORDER_TABLE_FULL_NAME); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { conn.createStatement().execute("CREATE SEQUENCE my.seq"); @@ -1392,7 +1393,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testDefaultJoin() throws Exception { String query = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -1437,7 +1438,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testInnerJoin() throws Exception { String query = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name, next value for my.seq FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item INNER JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -1491,7 +1492,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { query[0] = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name, next value for my.seq FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\" ORDER BY \"item_id\""; query[1] = "SELECT " + JOIN_ITEM_TABLE_FULL_NAME + ".\"item_id\", " + JOIN_ITEM_TABLE_FULL_NAME + ".name, " + JOIN_SUPPLIER_TABLE_FULL_NAME + ".\"supplier_id\", " + JOIN_SUPPLIER_TABLE_FULL_NAME + ".name, next value for my.seq FROM " + JOIN_ITEM_TABLE_FULL_NAME + " LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " ON " + JOIN_ITEM_TABLE_FULL_NAME + ".\"supplier_id\" = " + JOIN_SUPPLIER_TABLE_FULL_NAME + ".\"supplier_id\" ORDER BY \"item_id\""; query[2] = "SELECT item.\"item_id\", " + JOIN_ITEM_TABLE_FULL_NAME + ".name, supp.\"supplier_id\", " + JOIN_SUPPLIER_TABLE_FULL_NAME + ".name, next value for my.seq FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON " + JOIN_ITEM_TABLE_FULL_NAME + ".\"supplier_id\" = supp.\"supplier_id\" ORDER BY \"item_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { for (int i = 0; i < query.length; i++) { @@ -1545,7 +1546,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testRightJoin() throws Exception { String query = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp RIGHT JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " item ON item.\"supplier_id\" = supp.\"supplier_id\" ORDER BY \"item_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -1596,7 +1597,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testInnerJoinWithPreFilters() throws Exception { String query1 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item INNER JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\" AND supp.\"supplier_id\" BETWEEN '0000000001' AND '0000000005'"; String query2 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item INNER JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\" AND (supp.\"supplier_id\" = '0000000001' OR supp.\"supplier_id\" = '0000000005')"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -1657,7 +1658,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testLeftJoinWithPreFilters() throws Exception { String query = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\" AND (supp.\"supplier_id\" = '0000000001' OR supp.\"supplier_id\" = '0000000005') ORDER BY \"item_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -1708,7 +1709,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinWithPostFilters() throws Exception { String query1 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp RIGHT JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " item ON item.\"supplier_id\" = supp.\"supplier_id\" WHERE supp.\"supplier_id\" BETWEEN '0000000001' AND '0000000005'"; String query2 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\" WHERE supp.\"supplier_id\" = '0000000001' OR supp.\"supplier_id\" = '0000000005'"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -1775,7 +1776,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { query[1] = "SELECT /*+ NO_STAR_JOIN*/ \"order_id\", c.name, i.name iname, quantity, o.date FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o JOIN " + JOIN_CUSTOMER_TABLE_FULL_NAME + " c ON o.\"customer_id\" = c.\"customer_id\" JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" ORDER BY \"order_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { for (int i = 0; i < query.length; i++) { @@ -1834,7 +1835,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" GROUP BY i.\"item_id\" ORDER BY q DESC"; String query3 = "SELECT i.\"item_id\" iid, sum(quantity) q FROM " + JOIN_ITEM_TABLE_FULL_NAME + " i LEFT JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " o ON o.\"item_id\" = i.\"item_id\" GROUP BY i.\"item_id\" ORDER BY q DESC NULLS LAST, iid"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -1916,7 +1917,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" GROUP BY i.name ORDER BY i.name"; String query2 = "SELECT i.\"item_id\" iid, sum(quantity) q FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o RIGHT JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" GROUP BY i.\"item_id\" ORDER BY q DESC NULLS LAST, iid"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -1989,7 +1990,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { String query2 = "SELECT \"order_id\", i.name, s.name, quantity, date FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o LEFT JOIN " + "(" + JOIN_ITEM_TABLE_FULL_NAME + " i RIGHT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON i.\"supplier_id\" = s.\"supplier_id\")" + " ON o.\"item_id\" = i.\"item_id\" ORDER BY \"order_id\", s.\"supplier_id\" DESC"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -2093,7 +2094,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { "SELECT \"order_id\", i.name, s.name, quantity, date FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o LEFT JOIN " + "(" + JOIN_ITEM_TABLE_FULL_NAME + " i LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON i.\"supplier_id\" = s.\"supplier_id\") " + "ON o.\"item_id\" = i.\"item_id\""}; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { for (String query : queries) { @@ -2143,7 +2144,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" RIGHT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON i.\"supplier_id\" = s.\"supplier_id\" ORDER BY \"order_id\", s.\"supplier_id\" DESC"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2217,7 +2218,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" RIGHT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON i.\"supplier_id\" = s.\"supplier_id\" ORDER BY \"order_id\", s.\"supplier_id\" DESC"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, "1"); Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -2287,7 +2288,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testJoinWithWildcard() throws Exception { String query = "SELECT * FROM " + JOIN_ITEM_TABLE_FULL_NAME + " LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON " + JOIN_ITEM_TABLE_FULL_NAME + ".\"supplier_id\" = supp.\"supplier_id\" ORDER BY \"item_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2398,7 +2399,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { String query = "SELECT s.*, "+ JOIN_ITEM_TABLE_FULL_NAME + ".*, \"order_id\" FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o RIGHT JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" RIGHT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON i.\"supplier_id\" = s.\"supplier_id\" ORDER BY \"order_id\", s.\"supplier_id\" DESC"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2542,7 +2543,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testJoinMultiJoinKeys() throws Exception { String query = "SELECT c.name, s.name FROM " + JOIN_CUSTOMER_TABLE_FULL_NAME + " c LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON \"customer_id\" = \"supplier_id\" AND c.loc_id = s.loc_id AND substr(s.name, 2, 1) = substr(c.name, 2, 1)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2576,7 +2577,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinWithDifferentNumericJoinKeyTypes() throws Exception { String query = "SELECT \"order_id\", i.name, i.price, discount2, quantity FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o INNER JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" AND o.price = (i.price * (100 - discount2)) / 100.0 WHERE quantity < 5000"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2598,7 +2599,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinWithDifferentDateJoinKeyTypes() throws Exception { String query = "SELECT \"order_id\", c.name, o.date FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o INNER JOIN " + JOIN_CUSTOMER_TABLE_FULL_NAME + " c ON o.\"customer_id\" = c.\"customer_id\" AND o.date = c.date"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2630,7 +2631,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinWithIncomparableJoinKeyTypes() throws Exception { String query = "SELECT \"order_id\", i.name, i.price, discount2, quantity FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o INNER JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = i.\"item_id\" AND o.price / 100 = substr(i.name, 2, 1)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2647,7 +2648,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinPlanWithIndex() throws Exception { String query1 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item LEFT JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON substr(item.name, 2, 1) = substr(supp.name, 2, 1) AND (supp.name BETWEEN 'S1' AND 'S5') WHERE item.name BETWEEN 'T1' AND 'T5'"; String query2 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item INNER JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = supp.\"supplier_id\" WHERE (item.name = 'T1' OR item.name = 'T5') AND (supp.name = 'S1' OR supp.name = 'S5')"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -2711,7 +2712,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { String query = "SELECT s.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " i JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " o ON o.\"item_id\" = i.\"item_id\" AND quantity < 5000 JOIN " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s ON i.\"supplier_id\" = s.\"supplier_id\""; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -2740,7 +2741,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + JOIN_ITEM_TABLE_FULL_NAME + " i2 ON i1.\"item_id\" = i2.\"item_id\" ORDER BY i1.\"item_id\""; String query2 = "SELECT i1.name, i2.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " i1 JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i2 ON i1.\"item_id\" = i2.\"supplier_id\" ORDER BY i1.name, i2.name"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -2805,7 +2806,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { @Test public void testUpsertWithJoin() throws Exception { String tempTable = "TEMP_JOINED_TABLE"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); try { @@ -2897,7 +2898,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinOverSaltedTables() throws Exception { String tempTableNoSalting = "TEMP_TABLE_NO_SALTING"; String tempTableWithSalting = "TEMP_TABLE_WITH_SALTING"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { conn.createStatement().execute("CREATE TABLE " + tempTableNoSalting @@ -3035,7 +3036,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinOnDynamicColumns() throws Exception { String tableA = "tableA"; String tableB = "tableB"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = null; PreparedStatement stmt = null; try { @@ -3111,7 +3112,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + "(" + JOIN_SUPPLIER_TABLE_FULL_NAME + " s RIGHT JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON i.\"supplier_id\" = s.\"supplier_id\")" + " ON o.\"item_id\" = i.\"item_id\") ON c.\"customer_id\" = o.\"customer_id\"" + " WHERE c.\"customer_id\" <= '0000000005' AND \"order_id\" != '000000000000003' AND i.name != 'T3' ORDER BY c.\"customer_id\", i.name"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -3230,7 +3231,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { public void testJoinWithSubquery() throws Exception { String query1 = "SELECT item.\"item_id\", item.name, supp.sid, supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item INNER JOIN (SELECT reverse(loc_id), \"supplier_id\" sid, name FROM " + JOIN_SUPPLIER_TABLE_FULL_NAME + " WHERE name BETWEEN 'S1' AND 'S5') AS supp ON item.\"supplier_id\" = supp.sid"; String query2 = "SELECT item.\"item_id\", item.name, supp.\"supplier_id\", supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item INNER JOIN (SELECT reverse(loc_id), \"supplier_id\", name FROM " + JOIN_SUPPLIER_TABLE_FULL_NAME + ") AS supp ON item.\"supplier_id\" = supp.\"supplier_id\" AND (supp.name = 'S1' OR supp.name = 'S5')"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -3298,7 +3299,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + JOIN_ORDER_TABLE_FULL_NAME + " GROUP BY \"item_id\") AS o ON o.iid = i.iid ORDER BY o.q DESC NULLS LAST, i.iid"; String query4 = "SELECT i.iid, o.q FROM (SELECT \"item_id\" iid, sum(quantity) q FROM " + JOIN_ORDER_TABLE_FULL_NAME + " GROUP BY \"item_id\") AS o JOIN (SELECT \"item_id\" iid FROM " + JOIN_ITEM_TABLE_FULL_NAME + ") AS i ON o.iid = i.iid ORDER BY o.q DESC, i.iid"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -3405,7 +3406,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { + "(SELECT i.iid iiid, i.name iname, i.price iprice, i.discount1 idiscount1, i.discount2 idiscount2, i.sid isid, i.description idescription, s.sid ssid, s.name sname, s.phone sphone, s.address saddress, s.loc_id sloc_id FROM (SELECT \"supplier_id\" sid, name, phone, address, loc_id FROM " + JOIN_SUPPLIER_TABLE_FULL_NAME + ") AS s RIGHT JOIN (SELECT \"item_id\" iid, name, price, discount1, discount2, \"supplier_id\" sid, description FROM " + JOIN_ITEM_TABLE_FULL_NAME + ") AS i ON i.sid = s.sid) as qi" + " ON o.iid = qi.iiid) as qo ON c.cid = qo.ocid" + " WHERE c.cid <= '0000000005' AND qo.ooid != '000000000000003' AND qo.iname != 'T3' ORDER BY c.cid, qo.iname"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); @@ -3525,7 +3526,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { String query2 = "SELECT \"order_id\", i.name, s.name, s.address, quantity FROM " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON i.\"supplier_id\" = s.\"supplier_id\" JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " o ON o.\"item_id\" = i.\"item_id\" LIMIT 4"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query1); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/InListIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InListIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InListIT.java index 2205159..c257ccb 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InListIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InListIT.java @@ -17,6 +17,7 @@ import java.util.Properties; import org.apache.phoenix.schema.PDataType; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -29,7 +30,7 @@ public class InListIT extends BaseHBaseManagedTimeIT { @Test public void testLeadingPKWithTrailingRVC() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute("CREATE TABLE in_test " + "( col1 VARCHAR NOT NULL," @@ -51,7 +52,7 @@ public class InListIT extends BaseHBaseManagedTimeIT { @Test public void testLeadingPKWithTrailingRVC2() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute("CREATE TABLE in_test ( user VARCHAR, tenant_id VARCHAR(5) NOT NULL,tenant_type_id VARCHAR(3) NOT NULL, id INTEGER NOT NULL CONSTRAINT pk PRIMARY KEY (tenant_id, tenant_type_id, id))"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java index b3ba37a..813f4b8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java @@ -30,6 +30,7 @@ import java.sql.ResultSet; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -125,7 +126,7 @@ public class KeyOnlyIT extends BaseClientManagedTimeIT { protected static void initTableValues(long ts) throws Exception { String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PreparedStatement stmt = conn.prepareStatement( "upsert into " + http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java index 40190fe..b5e0ef4 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java @@ -30,6 +30,7 @@ import java.sql.ResultSet; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -41,7 +42,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),MULTI_CF,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); // Insert all rows at ts @@ -79,7 +80,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT count(1) from multi_cf"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(ts); @@ -98,7 +99,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT F.RESPONSE_TIME,G.RESPONSE_TIME from multi_cf where ID = '000000000000002'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(ts); @@ -118,7 +119,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT F.RESPONSE_TIME,G.RESPONSE_TIME from multi_cf where TRANSACTION_COUNT = 200"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(ts); @@ -138,7 +139,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT F.RESPONSE_TIME,G.RESPONSE_TIME from multi_cf where F.RESPONSE_TIME = 2222"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(ts); @@ -158,7 +159,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT F.RESPONSE_TIME,G.RESPONSE_TIME from multi_cf where G.RESPONSE_TIME-1 = F.RESPONSE_TIME"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(ts); @@ -215,7 +216,7 @@ public class MultiCfQueryExecIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT F.RESPONSE_TIME,G.RESPONSE_TIME from multi_cf where SUBSTR(ID, 15) = '2'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(ts); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/NativeHBaseTypesIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NativeHBaseTypesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NativeHBaseTypesIT.java index 6c9c36b..ec0ccbe 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NativeHBaseTypesIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NativeHBaseTypesIT.java @@ -49,6 +49,7 @@ import org.apache.phoenix.query.ConnectionQueryServices; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.SchemaUtil; import org.junit.BeforeClass; import org.junit.Test; @@ -73,7 +74,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { @BeforeClass public static void doBeforeTestSetup() throws Exception { - HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin(); + HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin(); try { try { admin.disableTable(HBASE_NATIVE_BYTES); @@ -94,7 +95,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { @SuppressWarnings("deprecation") private static void initTableValues() throws Exception { - ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES); + ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)); HTableInterface hTable = services.getTable(SchemaUtil.getTableNameAsBytes(HBASE_NATIVE_SCHEMA_NAME, HBASE_NATIVE)); try { // Insert rows using standard HBase mechanism with standard HBase "types" @@ -158,7 +159,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { public void testRangeQuery1() throws Exception { String query = "SELECT uint_key, ulong_key, string_key FROM HBASE_NATIVE WHERE uint_key > 20 and ulong_key >= 400"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -177,7 +178,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { public void testRangeQuery2() throws Exception { String query = "SELECT uint_key, ulong_key, string_key FROM HBASE_NATIVE WHERE uint_key > 20 and uint_key < 40"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -196,7 +197,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { public void testRangeQuery3() throws Exception { String query = "SELECT uint_key, ulong_key, string_key FROM HBASE_NATIVE WHERE ulong_key > 200 and ulong_key < 400"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -215,7 +216,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { public void testNegativeAgainstUnsignedNone() throws Exception { String query = "SELECT uint_key, ulong_key, string_key FROM HBASE_NATIVE WHERE ulong_key < -1"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -230,7 +231,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { public void testNegativeAgainstUnsignedAll() throws Exception { String query = "SELECT string_key FROM HBASE_NATIVE WHERE ulong_key > -100"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -252,7 +253,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { @Test public void testNegativeAddNegativeValue() throws Exception { String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO HBASE_NATIVE(uint_key,ulong_key,string_key, uint_col) VALUES(?,?,?,?)"); @@ -272,7 +273,7 @@ public class NativeHBaseTypesIT extends BaseClientManagedTimeIT { public void testNegativeCompareNegativeValue() throws Exception { String query = "SELECT string_key FROM HBASE_NATIVE WHERE uint_key > 100000"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 7); // Run query at timestamp 7 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); PhoenixConnection conn = DriverManager.getConnection(url, props).unwrap(PhoenixConnection.class); HTableInterface hTable = conn.getQueryServices().getTable(SchemaUtil.getTableNameAsBytes(HBASE_NATIVE_SCHEMA_NAME, HBASE_NATIVE));