http://git-wip-us.apache.org/repos/asf/phoenix/blob/f64f2d4f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java index 550c115..d05a200 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.end2end; -import static org.apache.phoenix.util.PhoenixRuntime.CURRENT_SCN_ATTRIB; import static org.apache.phoenix.util.TestUtil.B_VALUE; import static org.apache.phoenix.util.TestUtil.ROW1; import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; @@ -35,37 +34,21 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; -import java.util.Map; import java.util.Properties; import org.apache.phoenix.query.BaseTest; -import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.types.PhoenixArray; -import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; -import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.StringUtil; -import org.junit.BeforeClass; import org.junit.Test; -import com.google.common.collect.Maps; import com.google.common.primitives.Floats; -public class ArrayIT extends BaseUniqueNamesOwnClusterIT { +public class ArrayIT extends ParallelStatsDisabledIT { - @BeforeClass - public static void doSetup() throws Exception { - Map<String,String> props = Maps.newHashMapWithExpectedSize(5); - props.put(QueryServices.STATS_USE_CURRENT_TIME_ATTRIB, Boolean.FALSE.toString()); - setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); - } - - private static void initTablesWithArrays(String tableName, String tenantId, Date date, Long ts, boolean useNull, String url) throws Exception { + private static void initTablesWithArrays(String tableName, String tenantId, Date date, boolean useNull, String url) throws Exception { Properties props = new Properties(); - if (ts != null) { - props.setProperty(CURRENT_SCN_ATTRIB, ts.toString()); - } Connection conn = DriverManager.getConnection(url, props); try { // Insert all rows at ts @@ -141,15 +124,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testScanByArrayValue() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_float"; 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); //TODO: samarth do we need this analyzeTable(conn, tableName); @@ -186,15 +166,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testScanWithArrayInWhereClause() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_byte_array"; 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); //TODO: samarth do we need this? analyzeTable(conn, tableName); @@ -229,15 +206,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testScanWithNonFixedWidthArrayInWhereClause() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_string_array"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -272,15 +246,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testScanWithNonFixedWidthArrayInSelectClause() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT a_string_array FROM " + tableName; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -304,15 +275,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSpecificIndexOfAnArrayAsArrayFunction() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT ARRAY_ELEM(a_double_array,2) FROM " + tableName; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -332,15 +300,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSpecificIndexOfAnArray() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT a_double_array[3] FROM " + tableName; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -359,15 +324,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testCaseWithArray() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String tableName = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(tableName, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(tableName, tenantId, null, false, getUrl()); String query = "SELECT CASE WHEN A_INTEGER = 1 THEN a_double_array ELSE null END [3] FROM " + tableName; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -386,13 +348,11 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testUpsertValuesWithArray() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); - String tableName = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); + String tableName = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); String query = "upsert into " + tableName + " (ORGANIZATION_ID,ENTITY_ID,a_double_array) values('" + tenantId + "','00A123122312312',ARRAY[2.0,345.8])"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); // Execute // at Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -404,7 +364,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.close(); // create another connection props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); query = "SELECT ARRAY_ELEM(a_double_array,2) FROM " + tableName; statement = conn.prepareStatement(query); @@ -424,15 +383,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testUpsertSelectWithSelectAsSubQuery1() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); - String table1 = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); + String table1 = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); Connection conn = null; try { - String table2 = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table2, tenantId, null, ts, false); + String table2 = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table2, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "upsert into " + table1 + " (ORGANIZATION_ID,ENTITY_ID,a_double_array) " + "SELECT organization_id, entity_id, a_double_array FROM " + table2 @@ -445,7 +402,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.close(); // create another connection props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 4)); conn = DriverManager.getConnection(getUrl(), props); query = "SELECT ARRAY_ELEM(a_double_array,2) FROM " + table1; statement = conn.prepareStatement(query); @@ -467,14 +423,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArraySelectWithORCondition() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); Connection conn = null; try { - String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table, tenantId, null, ts, false); + String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "SELECT a_double_array[1] FROM " + table + " WHERE a_double_array[2] = 89.96 or a_char_array[0] = 'a'"; @@ -496,14 +450,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArraySelectWithANY() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); Connection conn = null; try { - String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table, tenantId, null, ts, false); + String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "SELECT a_double_array[1] FROM " + table + " WHERE CAST(89.96 AS DOUBLE) = ANY(a_double_array)"; @@ -524,14 +476,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArraySelectWithALL() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); Connection conn = null; try { - String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table, tenantId, null, ts, false); + String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "SELECT a_double_array[1] FROM " + table + " WHERE CAST(64.87 as DOUBLE) = ALL(a_double_array)"; @@ -547,14 +497,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArraySelectWithANYCombinedWithOR() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); Connection conn = null; try { - String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table, tenantId, null, ts, false); + String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "SELECT a_double_array[1] FROM " + table + " WHERE a_char_array[0] = 'f' or CAST(89.96 AS DOUBLE) > ANY(a_double_array)"; @@ -575,14 +523,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArraySelectWithALLCombinedWithOR() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); Connection conn = null; try { - String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table, tenantId, null, ts, false); + String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "SELECT a_double_array[1], a_double_array[2] FROM " + table + " WHERE a_char_array[0] = 'f' or CAST(100.0 AS DOUBLE) > ALL(a_double_array)"; @@ -608,12 +555,11 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { public void testArraySelectWithANYUsingVarLengthArray() throws Exception { Connection conn = null; try { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "SELECT a_string_array[1] FROM " + table + " WHERE 'XYZWER' = ANY(a_string_array)"; @@ -641,14 +587,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectWithArrayWithColumnRef() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_integer,ARRAY[1,2,a_integer] FROM " + table + " where organization_id = '" + tenantId + "'"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -673,14 +618,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectWithArrayWithColumnRefWithVarLengthArray() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT b_string,ARRAY['abc','defgh',b_string] FROM " + table + " where organization_id = '" + tenantId + "'"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -708,14 +652,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectWithArrayWithColumnRefWithVarLengthArrayWithNullValue() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT b_string,ARRAY['abc',null,'bcd',null,null,b_string] FROM " + table + " where organization_id = '" + tenantId + "'"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -745,15 +688,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testUpsertSelectWithColumnRef() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table1 = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); + String table1 = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); Connection conn = null; try { - String table2 = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table2, tenantId, null, ts, false); + String table2 = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table2, tenantId, null, false); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); String query = "upsert into " + table1 + " (ORGANIZATION_ID,ENTITY_ID, a_unsigned_double, a_double_array) " + "SELECT organization_id, entity_id, x_double, ARRAY[23.4, 22.1, x_double] FROM " + table2 @@ -766,7 +708,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.close(); // create another connection props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 4)); conn = DriverManager.getConnection(getUrl(), props); query = "SELECT ARRAY_ELEM(a_double_array,2) FROM " + table1; statement = conn.prepareStatement(query); @@ -788,13 +729,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testCharArraySpecificIndex() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); - initSimpleArrayTable(table, tenantId, null, ts, false); + String table = createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null); + initSimpleArrayTable(table, tenantId, null, false); String query = "SELECT a_char_array[2] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -814,16 +754,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute( "CREATE TABLE " + table + " ( k VARCHAR, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4] \n" + " CONSTRAINT pk PRIMARY KEY (k, b_string_array DESC)) \n"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?,?)"); stmt.setString(1, "a"); @@ -837,7 +775,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT b_string_array FROM " + table); assertTrue(rs.next()); @@ -852,22 +789,19 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute("CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a Float ARRAY[])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES('a',ARRAY[2.0,3.0])"); int res = stmt.executeUpdate(); assertEquals(1, res); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM " + table); assertTrue(rs.next()); @@ -881,22 +815,19 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute("CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a VARCHAR ARRAY[])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES('a',ARRAY['a',null])"); int res = stmt.executeUpdate(); assertEquals(1, res); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM " + table); assertTrue(rs.next()); @@ -909,15 +840,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute("CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a bigint ARRAY[])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?)"); stmt.setString(1, "a"); @@ -927,7 +856,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT k, CAST(a[2] AS DOUBLE) FROM " + table); assertTrue(rs.next()); @@ -941,15 +869,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { public void testArraySelectGetString() throws Exception { Connection conn; PreparedStatement stmt; - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); // create the table - String tableName = createTableWithAllArrayTypes(getUrl(), getDefaultSplits(tenantId), null, ts - 2); + String tableName = createTableWithAllArrayTypes(getUrl(), getDefaultSplits(tenantId), null); // populate the table with data Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " @@ -994,7 +921,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("SELECT organization_id, entity_id, boolean_array, byte_array, double_array, float_array, int_array, long_array, short_array, string_array FROM " @@ -1030,15 +956,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute("CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a bigint ARRAY[])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?)"); stmt.setString(1, "a"); @@ -1048,7 +972,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT CAST(a AS DOUBLE []) FROM " + table); assertTrue(rs.next()); @@ -1065,14 +988,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute("CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a VARCHAR(5) ARRAY)"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?)"); stmt.setString(1, "a"); @@ -1083,7 +1004,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT CAST(a AS CHAR ARRAY) FROM " + table); assertTrue(rs.next()); @@ -1102,22 +1022,19 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement().execute("CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a CHAR(5) ARRAY)"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.getMetaData().getColumns(null, null, table, "A"); assertTrue(rs.next()); assertEquals(5, rs.getInt("COLUMN_SIZE")); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?)"); stmt.setString(1, "a"); @@ -1128,7 +1045,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT k, a[2] FROM " + table); assertTrue(rs.next()); @@ -1139,15 +1055,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectArrayUsingUpsertLikeSyntax() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_double_array FROM " + table + " WHERE a_double_array = CAST(ARRAY [ 25.343, 36.763, 37.56,386.63] AS DOUBLE ARRAY)"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1170,16 +1083,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayIndexUsedInWhereClause() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); int a_index = 0; String query = "SELECT a_double_array[2] FROM " + table + " where a_double_array["+a_index+"2]<?"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1202,15 +1112,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayIndexUsedInGroupByClause() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_double_array[2] FROM " + table + " GROUP BY a_double_array[2]"; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1231,15 +1138,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testVariableLengthArrayWithNullValue() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, true, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, true, getUrl()); String query = "SELECT a_string_array[2] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1256,15 +1160,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSpecificIndexOfAVariableArrayAlongWithAnotherColumn1() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_string_array[3],A_INTEGER FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1284,15 +1185,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSpecificIndexOfAVariableArrayAlongWithAnotherColumn2() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT A_INTEGER, a_string_array[3] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1312,15 +1211,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectMultipleArrayColumns() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_string_array[3], a_double_array[2] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1342,17 +1239,15 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSameArrayColumnMultipleTimesWithDifferentIndices() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_string_array[1], a_string_array[2], " + "a_string_array[3], a_double_array[1], a_double_array[2], a_double_array[3] " + "FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1372,15 +1267,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSameArrayColumnMultipleTimesWithSameIndices() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_string_array[3], a_string_array[3] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1400,15 +1293,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testSelectSpecificIndexOfAVariableArray() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_string_array[3] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1426,15 +1316,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testWithOutOfRangeIndex() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT a_double_array[100] FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1449,15 +1336,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayLengthFunctionForVariableLength() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT ARRAY_LENGTH(a_string_array) FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1474,15 +1358,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayLengthFunctionForFixedLength() throws Exception { - long ts = nextTimestamp(); String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); - initTablesWithArrays(table, tenantId, null, ts, false, getUrl()); + getDefaultSplits(tenantId), null); + initTablesWithArrays(table, tenantId, null, false, getUrl()); String query = "SELECT ARRAY_LENGTH(a_double_array) FROM " + table; 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 { PreparedStatement statement = conn.prepareStatement(query); @@ -1498,13 +1379,11 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArraySizeRoundtrip() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); String table = createTableWithArray(getUrl(), - getDefaultSplits(tenantId), null, ts - 2); + getDefaultSplits(tenantId), null); 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 { ResultSet rs = conn.getMetaData().getColumns(null, null, StringUtil.escapeLike(table), StringUtil.escapeLike(SchemaUtil.normalizeIdentifier("x_long_array"))); @@ -1533,9 +1412,8 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement() @@ -1543,7 +1421,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { "CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?,?)"); stmt.setString(1, "a"); @@ -1557,7 +1434,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT k, a_string_array[2] FROM " + table + " where a_string_array=b_string_array"); assertTrue(rs.next()); @@ -1572,16 +1448,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement() .execute( "CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?,?)"); stmt.setString(1, "a"); @@ -1595,7 +1469,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery( "SELECT k, a_string_array[2] FROM " + table + " where a_string_array<b_string_array"); @@ -1611,16 +1484,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement() .execute( "CREATE TABLE " + table + " ( k VARCHAR PRIMARY KEY, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4])"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?,?)"); stmt.setString(1, "a"); @@ -1634,7 +1505,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery( "SELECT k, a_string_array[2] FROM " + table + " where a_string_array>b_string_array"); @@ -1646,13 +1516,12 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testUpsertValuesWithNull() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); + String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); String query = "upsert into " + table + " (ORGANIZATION_ID,ENTITY_ID,a_double_array) values('" + tenantId + "','00A123122312312',null)"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); // Execute // at Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -1664,7 +1533,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.close(); // create another connection props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); query = "SELECT ARRAY_ELEM(a_double_array,2) FROM " + table; statement = conn.prepareStatement(query); @@ -1684,12 +1552,11 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testUpsertValuesWithNullUsingPreparedStmt() throws Exception { - long ts = nextTimestamp(); + String tenantId = getOrganizationId(); - String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2); + String table = createTableWithArray(getUrl(), getDefaultSplits(tenantId), null); String query = "upsert into " + table + " (ORGANIZATION_ID,ENTITY_ID,a_string_array) values(?, ?, ?)"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); // Execute // at Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -1704,7 +1571,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.close(); // create another connection props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 conn = DriverManager.getConnection(getUrl(), props); query = "SELECT ARRAY_ELEM(a_string_array,1) FROM " + table; statement = conn.prepareStatement(query); @@ -1726,9 +1592,8 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement() @@ -1736,7 +1601,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { "CREATE TABLE " + table + " ( k VARCHAR, a_string_array VARCHAR(100) ARRAY[4], b_string_array VARCHAR(100) ARRAY[4] \n" + " CONSTRAINT pk PRIMARY KEY (k, b_string_array)) \n"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?,?,?)"); stmt.setString(1, "a"); @@ -1750,7 +1614,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery( "SELECT k, a_string_array[2] FROM " + table + " where b_string_array[8]='xxx'"); @@ -1763,9 +1626,8 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testPKWithArrayNotInEnd() throws Exception { Connection conn; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); try { @@ -1786,9 +1648,8 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayRefToLiteral() throws Exception { Connection conn; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement stmt = conn.prepareStatement("select ?[2] from \"SYSTEM\".\"catalog\" limit 1"); @@ -1807,8 +1668,7 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { } - private static String createTableWithAllArrayTypes(String url, byte[][] bs, Object object, - long ts) throws SQLException { + private static String createTableWithAllArrayTypes(String url, byte[][] bs, Object object) throws SQLException { String tableName = generateUniqueName(); String ddlStmt = "create table " + tableName @@ -1824,12 +1684,11 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { + " string_array varchar(100) array[3],\n" + " CONSTRAINT pk PRIMARY KEY (organization_id, entity_id)\n" + ")"; - BaseTest.createTestTable(url, ddlStmt, bs, ts); + BaseTest.createTestTable(url, ddlStmt, bs, null); return tableName; } - static String createTableWithArray(String url, byte[][] bs, Object object, - long ts) throws SQLException { + private static String createTableWithArray(String url, byte[][] bs, Object object) throws SQLException { String tableName = generateUniqueName(); String ddlStmt = "create table " + tableName @@ -1852,12 +1711,11 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { + " a_unsigned_double unsigned_double \n" + " CONSTRAINT pk PRIMARY KEY (organization_id, entity_id)\n" + ")"; - BaseTest.createTestTable(url, ddlStmt, bs, ts); + BaseTest.createTestTable(url, ddlStmt, bs, null); return tableName; } - static String createSimpleTableWithArray(String url, byte[][] bs, Object object, - long ts) throws SQLException { + private static String createSimpleTableWithArray(String url, byte[][] bs, Object object) throws SQLException { String tableName = generateUniqueName(); String ddlStmt = "create table " + tableName @@ -1868,15 +1726,13 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { + " a_char_array char(5) array[],\n" + " CONSTRAINT pk PRIMARY KEY (organization_id, entity_id)\n" + ")"; - BaseTest.createTestTable(url, ddlStmt, bs, ts); + BaseTest.createTestTable(url, ddlStmt, bs, null); return tableName; } - protected static void initSimpleArrayTable(String tableName, String tenantId, Date date, Long ts, boolean useNull) throws Exception { - Properties props = new Properties(); - if (ts != null) { - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, ts.toString()); - } + private static void initSimpleArrayTable(String tableName, String tenantId, Date date, boolean useNull) throws Exception { + Properties props = new Properties(); + Connection conn = DriverManager.getConnection(getUrl(), props); try { // Insert all rows at ts @@ -1915,16 +1771,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayConstructorWithMultipleRows1() throws Exception { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (region_name VARCHAR PRIMARY KEY, a INTEGER, b INTEGER)"; conn.createStatement().execute(ddl); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " (region_name, a, b) VALUES('a', 6,3)"); stmt.execute(); @@ -1934,7 +1788,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(DISTINCT ARRAY[a,b]) from " + table); @@ -1944,16 +1797,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayConstructorWithMultipleRows2() throws Exception { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (region_name VARCHAR PRIMARY KEY, a INTEGER, b INTEGER)"; conn.createStatement().execute(ddl); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " (region_name, a, b) VALUES('a', 6,3)"); stmt.execute(); @@ -1963,7 +1814,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT ARRAY[a,b] from " + table + " "); @@ -1981,16 +1831,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayConstructorWithMultipleRows3() throws Exception { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (region_name VARCHAR PRIMARY KEY, a VARCHAR, b VARCHAR)"; conn.createStatement().execute(ddl); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " (region_name, a, b) VALUES('a', 'foo', 'abc')"); stmt.execute(); @@ -2000,7 +1848,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT ARRAY[a,b] from " + table + " "); @@ -2018,16 +1865,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayConstructorWithMultipleRows4() throws Exception { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (region_name VARCHAR PRIMARY KEY, a VARCHAR, b VARCHAR)"; conn.createStatement().execute(ddl); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " (region_name, a, b) VALUES('a', 'foo', 'abc')"); stmt.execute(); @@ -2037,7 +1882,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(DISTINCT ARRAY[a,b]) from " + table); @@ -2047,16 +1891,14 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testArrayConstructorWithMultipleRows5() throws Exception { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (region_name VARCHAR PRIMARY KEY, a VARCHAR, b VARCHAR)"; conn.createStatement().execute(ddl); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " (region_name, a, b) VALUES('a', 'foo', 'abc')"); stmt.execute(); @@ -2066,7 +1908,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(ARRAY[a,b], 'oo') from " + table); @@ -2087,9 +1928,8 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { Connection conn; PreparedStatement stmt; ResultSet rs; - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); conn.createStatement() @@ -2097,7 +1937,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { "CREATE TABLE " + table + " ( a VARCHAR ARRAY PRIMARY KEY DESC)\n"); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?)"); Array a1 = conn.createArrayOf("VARCHAR", new String[] { "a", "ba" }); @@ -2109,7 +1948,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT a FROM " + table + " ORDER BY a DESC"); assertTrue(rs.next()); @@ -2119,7 +1957,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { assertFalse(rs.next()); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 50)); conn = DriverManager.getConnection(getUrl(), props); stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES(?)"); Array a3 = conn.createArrayOf("VARCHAR", new String[] { "a", "b" }); @@ -2128,7 +1965,6 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 60)); conn = DriverManager.getConnection(getUrl(), props); rs = conn.createStatement().executeQuery("SELECT a FROM " + table + " ORDER BY a DESC"); assertTrue(rs.next()); @@ -2143,23 +1979,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc1()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k varchar array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array['a', 'c'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k >= array['a', 'b']"); @@ -2169,23 +2002,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc2()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k varchar array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array['a', 'c'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k >= array['a', 'c']"); @@ -2195,23 +2025,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc3()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k varchar array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array['a', 'c'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k > array['a', 'b']"); @@ -2221,23 +2048,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc4()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k varchar array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array['a', 'b'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k <= array['a', 'c']"); @@ -2247,23 +2071,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc5()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k varchar array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array['a', 'b'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k <= array['a', 'b']"); @@ -2273,23 +2094,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc6()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k varchar array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array['a', 'b'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k < array['a', 'c']"); @@ -2299,23 +2117,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc7()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k integer array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array[1, 2])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k < array[1, 4]"); @@ -2325,23 +2140,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testComparisonOperatorsForDesc8()throws Exception{ - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "create table " + table + " (k integer array primary key desc)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("upsert into " + table + " values (array[1, 2])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("select * from " + table + " where k <= array[1, 2]"); @@ -2351,23 +2163,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection1() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr2 VARCHAR ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES (1, ARRAY[1, 2], ARRAY['a', 'b'])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1] FROM " + table); @@ -2380,23 +2189,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection2() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES (1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], arr3[1] from " + table); @@ -2410,23 +2216,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection3() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES (1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], arr3, arr3[1] from " + table); @@ -2441,23 +2244,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection4() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES (1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], ARRAY_APPEND(arr3, 4), arr3[1] from " + table); @@ -2472,23 +2272,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection5() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr3 INTEGER ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES (1, ARRAY[1, 2], ARRAY[2, 3])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("SELECT arr1, arr1[1], ARRAY_APPEND(arr1, arr3[1]) from " + table); @@ -2501,23 +2298,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection6() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr2 INTEGER ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); conn = DriverManager.getConnection(getUrl(), props); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + " VALUES (1, ARRAY[1, 2], ARRAY[2, 3])"); stmt.execute(); conn.commit(); conn.close(); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs; stmt = conn.prepareStatement("SELECT arr1, arr1[1], ARRAY_APPEND(arr1, arr2[1]), p from " + table); @@ -2531,23 +2325,20 @@ public class ArrayIT extends BaseUniqueNamesOwnClusterIT { @Test public void testServerArrayElementProjection7() throws SQLException { - long ts = nextTimestamp(); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, arr1 INTEGER ARRAY, arr2 INTEGER ARRAY)"; conn.createStatement().execute(ddl); conn.close(); - props.setPrope
<TRUNCATED>