You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2020/08/27 17:30:18 UTC

[phoenix] branch master updated: PHOENIX-6107 Discuss speed up of BaseQueryIT

This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ec66c4  PHOENIX-6107 Discuss speed up of BaseQueryIT
2ec66c4 is described below

commit 2ec66c4ea8c0074f12188b807db9bf821495cf4e
Author: Istvan Toth <st...@apache.org>
AuthorDate: Thu Aug 27 15:52:12 2020 +0200

    PHOENIX-6107 Discuss speed up of BaseQueryIT
    
    move table creation to @BeforeParam
    move tests that update the table to the end of the class
    move point in timme tests to PointInTimeQueryIT
    re-create tables for each test in PointInTimeQueryIT (keep the old behaviour)
---
 .../apache/phoenix/end2end/AggregateQueryIT.java   |   4 +-
 .../org/apache/phoenix/end2end/BaseQueryIT.java    |  51 ++-
 .../apache/phoenix/end2end/CaseStatementIT.java    |  11 +-
 .../apache/phoenix/end2end/CastAndCoerceIT.java    |   4 +-
 .../java/org/apache/phoenix/end2end/GroupByIT.java |  59 +---
 .../java/org/apache/phoenix/end2end/InQueryIT.java |   4 +-
 .../apache/phoenix/end2end/IntArithmeticIT.java    |   5 +-
 .../org/apache/phoenix/end2end/NotQueryIT.java     |   6 +-
 .../NotQueryWithGlobalImmutableIndexesIT.java      |   6 +-
 .../NotQueryWithLocalImmutableIndexesIT.java       |   6 +-
 .../it/java/org/apache/phoenix/end2end/NullIT.java |  12 +-
 .../apache/phoenix/end2end/PointInTimeQueryIT.java | 387 +++++++++++++++------
 .../java/org/apache/phoenix/end2end/QueryIT.java   |   4 +-
 .../org/apache/phoenix/end2end/RangeScanIT.java    |   4 +-
 .../org/apache/phoenix/end2end/UngroupedIT.java    | 114 +-----
 15 files changed, 362 insertions(+), 315 deletions(-)

diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
index da7cdf0..c844b73 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
@@ -55,8 +55,8 @@ public class AggregateQueryIT extends BaseQueryIT {
         return BaseQueryIT.allIndexes();
     }
     
-    public AggregateQueryIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public AggregateQueryIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
 
     @Test
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
index e7f3ad9..7322f15 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
@@ -26,9 +26,12 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.phoenix.compat.hbase.HbaseCompatCapabilities;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.AfterParam;
+import org.junit.runners.Parameterized.BeforeParam;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -78,15 +81,14 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
             INDEX_DDLS[i++] = s;
         }
     }
-    protected Date date;
-    private String indexDDL;
-    private String tableDDLOptions;
-    protected String tableName;
-    protected String indexName;
+    protected static Date date;
+    protected static String tableName;
+    protected static String indexName;
 
     private static final Logger LOGGER = LoggerFactory.getLogger(BaseQueryIT.class);
 
-    public BaseQueryIT(String idxDdl, boolean columnEncoded, boolean keepDeletedCells) throws Exception {
+    @BeforeParam
+    public static final void initTables(String idxDdl, boolean columnEncoded, boolean keepDeletedCells) throws Exception {
         StringBuilder optionBuilder = new StringBuilder();
         if (!columnEncoded) {
             optionBuilder.append("COLUMN_ENCODED_BYTES=0");
@@ -95,9 +97,9 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
             if (optionBuilder.length() > 0) optionBuilder.append(",");
             optionBuilder.append("KEEP_DELETED_CELLS=true");
         }
-        this.tableDDLOptions = optionBuilder.toString();
+        String tableDDLOptions = optionBuilder.toString();
         try {
-            this.tableName =
+            tableName =
                     initATableValues(generateUniqueName(), tenantId, getDefaultSplits(tenantId),
                         date = new Date(System.currentTimeMillis()), null, getUrl(),
                         tableDDLOptions);
@@ -105,25 +107,50 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
             LOGGER.error("Exception when creating aTable ", e);
             throw e;
         }
-        this.indexName = generateUniqueName();
+        indexName = generateUniqueName();
         if (idxDdl.length() > 0) {
-            this.indexDDL =
+            String indexDDL =
                     String.format(idxDdl, indexName, tableName);
             Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
             try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-                conn.createStatement().execute(this.indexDDL);
+                conn.createStatement().execute(indexDDL);
             } catch (Exception e) {
                 LOGGER.error("Exception while creating index: " + indexDDL, e);
                 throw e;
             }
         }
+
+    }
+
+    public BaseQueryIT(String idxDdl, boolean columnEncoded, boolean keepDeletedCells) {
+        //logic moved to initTables
     }
 
     public static Collection<Object> allIndexes() {
         List<Object> testCases = Lists.newArrayList();
         for (String indexDDL : INDEX_DDLS) {
             for (boolean columnEncoded : new boolean[]{false}) {
-                testCases.add(new Object[] { indexDDL, columnEncoded });
+                testCases.add(new Object[] { indexDDL, columnEncoded, false});
+            }
+        }
+        return testCases;
+    }
+    
+    public static Collection<Object> allIndexesWithEncoded() {
+        List<Object> testCases = Lists.newArrayList();
+        for (String indexDDL : INDEX_DDLS) {
+            for (boolean columnEncoded : new boolean[]{false, true}) {
+                testCases.add(new Object[] { indexDDL, columnEncoded, false});
+            }
+        }
+        return testCases;
+    }
+    
+    public static Collection<Object> allIndexesWithEncodedAndKeepDeleted() {
+        List<Object> testCases = Lists.newArrayList();
+        for (String indexDDL : INDEX_DDLS) {
+            for (boolean columnEncoded : new boolean[]{false, true}) {
+                testCases.add(new Object[] { indexDDL, columnEncoded, !HbaseCompatCapabilities.isLookbackBeyondDeletesSupported()});
             }
         }
         return testCases;
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
index 8eaa349..d54836d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
@@ -43,24 +43,27 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.phoenix.util.PropertiesUtil;
+import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 import com.google.common.collect.Lists;
 
 @RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class CaseStatementIT extends BaseQueryIT {
 
-    public CaseStatementIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public CaseStatementIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     @Parameters(name="CaseStatementIT_{index}") // name is used by failsafe as file name in reports
     public static synchronized Collection<Object> data() {
         return BaseQueryIT.allIndexes();
-    }    
+    }
     
     @Test
     public void testSimpleCaseStatement() throws Exception {
@@ -248,7 +251,7 @@ public class CaseStatementIT extends BaseQueryIT {
     }
 
     @Test
-    public void testUnfoundSingleColumnCaseStatement() throws Exception {
+    public void zTestUnfoundSingleColumnCaseStatement() throws Exception {
         String query = "SELECT entity_id, b_string FROM " + tableName + " WHERE organization_id=? and CASE WHEN a_integer = 0 or a_integer != 0 THEN 1 ELSE 0 END = 0";
         String url = getUrl();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
index 20dd6ed..de10ee9 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
@@ -42,8 +42,8 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)
 public class CastAndCoerceIT extends BaseQueryIT {
 
-    public CastAndCoerceIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public CastAndCoerceIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     @Parameters(name="CastAndCoerceIT_{index}") // name is used by failsafe as file name in reports
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 2063723..0b45baa 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
@@ -41,8 +41,10 @@ import java.util.Properties;
 
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
+import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
@@ -50,10 +52,11 @@ import com.google.common.collect.Lists;
 
 
 @RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class GroupByIT extends BaseQueryIT {
 
-    public GroupByIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public GroupByIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     @Parameters(name="GroupByIT_{index}") // name is used by failsafe as file name in reports
@@ -207,7 +210,7 @@ public class GroupByIT extends BaseQueryIT {
     }
 
     @Test
-    public void testGroupByWithIntegerDivision1() throws Exception {
+    public void zTestGroupByWithIntegerDivision1() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         String table = generateUniqueName();
@@ -240,7 +243,7 @@ public class GroupByIT extends BaseQueryIT {
     }
 
     @Test
-    public void testGroupByWithIntegerDivision2() throws Exception {
+    public void zTestGroupByWithIntegerDivision2() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         String table = generateUniqueName();
@@ -272,54 +275,6 @@ public class GroupByIT extends BaseQueryIT {
         assertEquals(6.77, rs.getDouble(3), 0.1);
     }
     
-    @Test
-    public void testPointInTimeGroupedAggregation() throws Exception {
-        String updateStmt =
-                "upsert into " + tableName + " VALUES ('" + tenantId + "','" + ROW5 + "','"
-                        + C_VALUE + "')";
-        String url = getUrl();
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        Statement stmt = upsertConn.createStatement();
-        stmt.execute(updateStmt); // should commit too
-        upsertConn.close();
-        
-        long upsert1Time = System.currentTimeMillis();
-        long timeDelta = 100;
-        Thread.sleep(timeDelta);
-
-        upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        updateStmt = "upsert into " + tableName + " VALUES (?, ?, ?)";
-        // Insert all rows at ts
-        PreparedStatement pstmt = upsertConn.prepareStatement(updateStmt);
-        pstmt.setString(1, tenantId);
-        pstmt.setString(2, ROW5);
-        pstmt.setString(3, E_VALUE);
-        pstmt.execute(); // should commit too
-        upsertConn.close();
-        
-        long queryTime = upsert1Time + timeDelta / 2;
-        String query =
-                "SELECT a_string, count(1) FROM " + tableName + " WHERE organization_id='"
-                        + tenantId + "' GROUP BY a_string";
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        Statement statement = conn.createStatement();
-        ResultSet rs = statement.executeQuery(query);
-        assertTrue(rs.next());
-        assertEquals(A_VALUE, rs.getString(1));
-        assertEquals(4, rs.getInt(2));
-        assertTrue(rs.next());
-        assertEquals(B_VALUE, rs.getString(1));
-        assertEquals(3, rs.getLong(2));
-        assertTrue(rs.next());
-        assertEquals(C_VALUE, rs.getString(1));
-        assertEquals(2, rs.getInt(2));
-        assertFalse(rs.next());
-        conn.close();
-    }
 
     @SuppressWarnings("unchecked")
     @Test
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
index 45122e8..b046226 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
@@ -51,8 +51,8 @@ import org.junit.runners.Parameterized.Parameters;
 
 public class InQueryIT extends BaseQueryIT {
 
-    public InQueryIT(String idxDdl, boolean columnEncoded) throws Exception {
-        super(idxDdl, columnEncoded, false);
+    public InQueryIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
 
     @Parameters(name="InQueryIT_{index}") // name is used by failsafe as file name in reports
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
index b0b1fb8..85c1b32 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
@@ -47,8 +47,8 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)
 public class IntArithmeticIT extends BaseQueryIT {
 
-    public IntArithmeticIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public IntArithmeticIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     @Parameters(name="IntArithmeticIT_{index}") // name is used by failsafe as file name in reports
@@ -70,6 +70,7 @@ public class IntArithmeticIT extends BaseQueryIT {
         }
     }
 
+    
     @Test
     public void testSelectWithSubtractionExpression() throws Exception {
         String query = "SELECT entity_id, x_integer - 4 FROM " + tableName + " where  x_integer - 4 = 0";
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
index 65f3c17..d05f74e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
@@ -49,10 +49,10 @@ import com.google.common.primitives.Floats;
 @RunWith(Parameterized.class)
 public abstract class NotQueryIT extends BaseQueryIT {
 
-    protected NotQueryIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    protected NotQueryIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
-    
+
     @Test
     public void testNotInList() throws Exception {
         String query = "SELECT entity_id FROM " + tableName + " WHERE organization_id=? and entity_id NOT IN (?,?,?,?,?,?)";
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java
index 0ea6bfc..f56761f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java
@@ -26,15 +26,15 @@ import com.google.common.collect.Lists;
 
 public class NotQueryWithGlobalImmutableIndexesIT extends NotQueryIT {
 
-    public NotQueryWithGlobalImmutableIndexesIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded);
+    public NotQueryWithGlobalImmutableIndexesIT(String indexDDL, boolean columnEncoded, boolean keepDeleted) throws Exception {
+        super(indexDDL, columnEncoded, keepDeleted);
     }
 
     @Parameters(name = "globalIndexDDL={0}")
     public static synchronized Collection<Object> globalIndexes() {
         List<Object> testCases = Lists.newArrayList();
         for (String indexDDL : GLOBAL_INDEX_DDLS) {
-            testCases.add(new Object[] { indexDDL, false });
+            testCases.add(new Object[] { indexDDL, false, false });
         }
         return testCases;
     }
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java
index 508bc56..96c4c80 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java
@@ -26,15 +26,15 @@ import com.google.common.collect.Lists;
 
 public class NotQueryWithLocalImmutableIndexesIT extends NotQueryIT {
 
-    public NotQueryWithLocalImmutableIndexesIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded);
+    public NotQueryWithLocalImmutableIndexesIT(String indexDDL, boolean columnEncoded, boolean keepDeleted) throws Exception {
+        super(indexDDL, columnEncoded, keepDeleted);
     }
 
     @Parameters(name = "localIndexDDL={0}")
     public static synchronized Collection<Object> localIndexes() {
         List<Object> testCases = Lists.newArrayList();
         for (String indexDDL : LOCAL_INDEX_DDLS) {
-            testCases.add(new Object[] { indexDDL, false });
+            testCases.add(new Object[] { indexDDL, false, false });
         }
         return testCases;
     }
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NullIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NullIT.java
index b27dfd2..665e287 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NullIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NullIT.java
@@ -51,17 +51,11 @@ public class NullIT extends BaseQueryIT {
     
     @Parameters(name="NullIT_{index},columnEncoded={1}")
     public static synchronized Collection<Object> data() {
-        List<Object> testCases = Lists.newArrayList();
-        for (String indexDDL : INDEX_DDLS) {
-            for (boolean columnEncoded : new boolean[]{false,true}) {
-                testCases.add(new Object[] { indexDDL, columnEncoded });
-            }
-        }
-        return testCases;
+        return BaseQueryIT.allIndexesWithEncoded();
     }
     
-    public NullIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public NullIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     private void testNoStringValue(String value) throws Exception {
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
index 6d4d4d6..0b5e75c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
@@ -35,12 +35,12 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.Statement;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.phoenix.compat.hbase.HbaseCompatCapabilities;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
@@ -52,18 +52,15 @@ public class PointInTimeQueryIT extends BaseQueryIT {
 
     @Parameters(name="PointInTimeQueryIT_{index},columnEncoded={1}")
     public static synchronized Collection<Object> data() {
-        List<Object> testCases = Lists.newArrayList();
-        for (String indexDDL : INDEX_DDLS) {
-            for (boolean columnEncoded : new boolean[]{false,true}) {
-                testCases.add(new Object[] { indexDDL, columnEncoded });
-            }
-        }
-        return testCases;
+        return BaseQueryIT.allIndexesWithEncodedAndKeepDeleted();
     }
     
-    public PointInTimeQueryIT(String idxDdl, boolean columnEncoded)
+    public PointInTimeQueryIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells)
             throws Exception {
-        super(idxDdl, columnEncoded, !HbaseCompatCapabilities.isLookbackBeyondDeletesSupported());
+        super(indexDDL, columnEncoded, keepDeletedCells);
+        // For this class we specifically want to run each test method with fresh tables
+        // it is expected to be slow
+        initTables(indexDDL, columnEncoded, keepDeletedCells);
     }
 
     @Test
@@ -81,33 +78,33 @@ public class PointInTimeQueryIT extends BaseQueryIT {
         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);
-        PreparedStatement stmt = conn.prepareStatement(updateStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW7);
-        stmt.setString(3, null);
-        stmt.execute();
-        
-        // Delete row 
-        stmt = conn.prepareStatement("delete from " + tableName + " where organization_id=? and entity_id=?");
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW5);
-        stmt.execute();
-        conn.commit();
-        conn.close();
+        try (Connection conn = DriverManager.getConnection(url, props)) {
+            PreparedStatement stmt = conn.prepareStatement(updateStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW7);
+            stmt.setString(3, null);
+            stmt.execute();
+            
+            // Delete row 
+            stmt = conn.prepareStatement("delete from " + tableName + " where organization_id=? and entity_id=?");
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW5);
+            stmt.execute();
+            conn.commit();
+        }
         long firstDeleteTime = System.currentTimeMillis();
         long timeDelta = 100; 
         Thread.sleep(timeDelta); 
         
         // Delete row at timestamp 3. This should not be seen by the query executing
         // Remove column value at ts + 1 (i.e. equivalent to setting the value to null)
-        Connection futureConn = DriverManager.getConnection(getUrl());
-        stmt = futureConn.prepareStatement("delete from " + tableName + " where organization_id=? and entity_id=?");
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW6);
-        stmt.execute();
-        futureConn.commit();
-        futureConn.close();
+        try (Connection futureConn = DriverManager.getConnection(getUrl())) {
+            PreparedStatement stmt = futureConn.prepareStatement("delete from " + tableName + " where organization_id=? and entity_id=?");
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW6);
+            stmt.execute();
+            futureConn.commit();
+        }
         
         // query at a time which is beyong deleteTime1 but before the time at which above delete
         // happened
@@ -115,15 +112,15 @@ public class PointInTimeQueryIT extends BaseQueryIT {
 
         String query = "SELECT count(1) FROM " + tableName + " WHERE organization_id=? and a_string = ?";
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime)); // Execute at timestamp 2
-        conn = DriverManager.getConnection(getUrl(), props);
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.setString(1, tenantId);
-        statement.setString(2, B_VALUE);
-        ResultSet rs = statement.executeQuery();
-        assertTrue(rs.next());
-        assertEquals(2, rs.getLong(1));
-        assertFalse(rs.next());
-        conn.close();
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            PreparedStatement statement = conn.prepareStatement(query);
+            statement.setString(1, tenantId);
+            statement.setString(2, B_VALUE);
+            ResultSet rs = statement.executeQuery();
+            assertTrue(rs.next());
+            assertEquals(2, rs.getLong(1));
+            assertFalse(rs.next());
+        }
     }
     
     @Test
@@ -131,49 +128,53 @@ public class PointInTimeQueryIT extends BaseQueryIT {
         // Override value that was set at creation time
         String url = getUrl();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection upsertConn = DriverManager.getConnection(url, props);
         String upsertStmt =
-            "upsert into " + tableName +
-            " (" +
-            "    ORGANIZATION_ID, " +
-            "    ENTITY_ID, " +
-            "    A_INTEGER) " +
-            "VALUES (?, ?, ?)";
-        upsertConn.setAutoCommit(true); // Test auto commit
-        PreparedStatement stmt = upsertConn.prepareStatement(upsertStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW4);
-        stmt.setInt(3, 5);
-        stmt.execute(); // should commit too
-        upsertConn.close();
+                "upsert into " + tableName +
+                " (" +
+                "    ORGANIZATION_ID, " +
+                "    ENTITY_ID, " +
+                "    A_INTEGER) " +
+                "VALUES (?, ?, ?)";
+        
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+
+            upsertConn.setAutoCommit(true); // Test auto commit
+            PreparedStatement stmt = upsertConn.prepareStatement(upsertStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW4);
+            stmt.setInt(3, 5);
+            stmt.execute(); // should commit too
+        }
         long upsert1Time = System.currentTimeMillis();
         long timeDelta = 100;
         Thread.sleep(timeDelta);
         
-        upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        stmt = upsertConn.prepareStatement(upsertStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW4);
-        stmt.setInt(3, 9);
-        stmt.execute(); // should commit too
-        upsertConn.close();
+        try(Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            PreparedStatement stmt = upsertConn.prepareStatement(upsertStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW4);
+            stmt.setInt(3, 9);
+            stmt.execute(); // should commit too
+            upsertConn.close();
+        }
         
         long queryTime = upsert1Time + timeDelta / 2;
         String query = "SELECT organization_id, a_string AS a FROM " + tableName + " WHERE organization_id=? and a_integer = 5";
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.setString(1, tenantId);
-        ResultSet rs = statement.executeQuery();
-        assertTrue(rs.next());
-        assertEquals(tenantId, rs.getString(1));
-        assertEquals(A_VALUE, rs.getString("a"));
-        assertTrue(rs.next());
-        assertEquals(tenantId, rs.getString(1));
-        assertEquals(B_VALUE, rs.getString(2));
-        assertFalse(rs.next());
-        conn.close();
+        try(Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            PreparedStatement statement = conn.prepareStatement(query);
+            statement.setString(1, tenantId);
+            ResultSet rs = statement.executeQuery();
+            assertTrue(rs.next());
+            assertEquals(tenantId, rs.getString(1));
+            assertEquals(A_VALUE, rs.getString("a"));
+            assertTrue(rs.next());
+            assertEquals(tenantId, rs.getString(1));
+            assertEquals(B_VALUE, rs.getString(2));
+            assertFalse(rs.next());
+            conn.close();
+        }
     }
 
     @SuppressWarnings("unchecked")
@@ -182,54 +183,216 @@ public class PointInTimeQueryIT extends BaseQueryIT {
         // Override value that was set at creation time
         String url = getUrl();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection upsertConn = DriverManager.getConnection(url, props);
         String upsertStmt =
-            "upsert into " + tableName +
-            " (" +
-            "    ORGANIZATION_ID, " +
-            "    ENTITY_ID, " +
-            "    A_INTEGER) " +
-            "VALUES (?, ?, ?)";
-        upsertConn.setAutoCommit(true); // Test auto commit
-        // Insert all rows at ts
-        PreparedStatement stmt = upsertConn.prepareStatement(upsertStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW1);
-        stmt.setInt(3, 6);
-        stmt.execute(); // should commit too
-        upsertConn.close();
+                "upsert into " + tableName +
+                " (" +
+                "    ORGANIZATION_ID, " +
+                "    ENTITY_ID, " +
+                "    A_INTEGER) " +
+                "VALUES (?, ?, ?)";
+        try(Connection upsertConn = DriverManager.getConnection(url, props)) {
+
+            upsertConn.setAutoCommit(true); // Test auto commit
+            // Insert all rows at ts
+            PreparedStatement stmt = upsertConn.prepareStatement(upsertStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW1);
+            stmt.setInt(3, 6);
+            stmt.execute(); // should commit too
+            upsertConn.close();
+        }
         long upsert1Time = System.currentTimeMillis();
         long timeDelta = 100;
         Thread.sleep(timeDelta);
 
         url = getUrl();
-        upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        // Insert all rows at ts
-        stmt = upsertConn.prepareStatement(upsertStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW1);
-        stmt.setInt(3, 0);
-        stmt.execute(); // should commit too
-        upsertConn.close();
+        try(Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            // Insert all rows at ts
+            PreparedStatement stmt = upsertConn.prepareStatement(upsertStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW1);
+            stmt.setInt(3, 0);
+            stmt.execute(); // should commit too
+            upsertConn.close();
+        }
         
         long queryTime = upsert1Time + timeDelta  / 2;
         String query = "SELECT a_integer,b_string FROM " + tableName + " WHERE organization_id=? and a_integer <= 5 limit 2";
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.setString(1, tenantId);
-        ResultSet rs = statement.executeQuery();
-        List<List<Object>> expectedResultsA = Lists.newArrayList(
-                Arrays.<Object>asList(2, C_VALUE),
-                Arrays.<Object>asList( 3, E_VALUE));
-        List<List<Object>> expectedResultsB = Lists.newArrayList(
-                Arrays.<Object>asList( 5, C_VALUE),
-                Arrays.<Object>asList(4, B_VALUE));
-        // Since we're not ordering and we may be using a descending index, we don't
-        // know which rows we'll get back.
-        assertOneOfValuesEqualsResultSet(rs, expectedResultsA,expectedResultsB);
-       conn.close();
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            PreparedStatement statement = conn.prepareStatement(query);
+            statement.setString(1, tenantId);
+            ResultSet rs = statement.executeQuery();
+            List<List<Object>> expectedResultsA = Lists.newArrayList(
+                    Arrays.<Object>asList(2, C_VALUE),
+                    Arrays.<Object>asList( 3, E_VALUE));
+            List<List<Object>> expectedResultsB = Lists.newArrayList(
+                    Arrays.<Object>asList( 5, C_VALUE),
+                    Arrays.<Object>asList(4, B_VALUE));
+            // Since we're not ordering and we may be using a descending index, we don't
+            // know which rows we'll get back.
+            assertOneOfValuesEqualsResultSet(rs, expectedResultsA,expectedResultsB);
+            conn.close();
+        }
+    }
+
+    @Test
+    public void TestPointInTimeGroupedAggregation() throws Exception {
+        String updateStmt =
+                "upsert into " + tableName + " VALUES ('" + tenantId + "','" + ROW5 + "','"
+                        + C_VALUE + "')";
+        String url = getUrl();
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            Statement stmt = upsertConn.createStatement();
+            stmt.execute(updateStmt); // should commit too
+            upsertConn.close();
+        }
+        
+        long upsert1Time = System.currentTimeMillis();
+        long timeDelta = 100;
+        Thread.sleep(timeDelta);
+
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            updateStmt = "upsert into " + tableName + " VALUES (?, ?, ?)";
+            // Insert all rows at ts
+            PreparedStatement pstmt = upsertConn.prepareStatement(updateStmt);
+            pstmt.setString(1, tenantId);
+            pstmt.setString(2, ROW5);
+            pstmt.setString(3, E_VALUE);
+            pstmt.execute(); // should commit too
+            upsertConn.close();
+        }
+        
+        long queryTime = upsert1Time + timeDelta / 2;
+        String query =
+                "SELECT a_string, count(1) FROM " + tableName + " WHERE organization_id='"
+                        + tenantId + "' GROUP BY a_string";
+        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            Statement statement = conn.createStatement();
+            ResultSet rs = statement.executeQuery(query);
+            assertTrue(rs.next());
+            assertEquals(A_VALUE, rs.getString(1));
+            assertEquals(4, rs.getInt(2));
+            assertTrue(rs.next());
+            assertEquals(B_VALUE, rs.getString(1));
+            assertEquals(3, rs.getLong(2));
+            assertTrue(rs.next());
+            assertEquals(C_VALUE, rs.getString(1));
+            assertEquals(2, rs.getInt(2));
+            assertFalse(rs.next());
+            conn.close();
+        }
     }
     
+    @Test
+    public void TestPointInTimeUngroupedAggregation() throws Exception {
+        // Override value that was set at creation time
+        String url = getUrl();
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        String updateStmt =
+                "upsert into " + tableName + " (" + "    ORGANIZATION_ID, " + "    ENTITY_ID, "
+                        + "    A_STRING) " + "VALUES (?, ?, ?)";
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+            // Insert all rows at ts
+            PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW5);
+            stmt.setString(3, null);
+            stmt.execute();
+            stmt.setString(3, C_VALUE);
+            stmt.execute();
+            stmt.setString(2, ROW7);
+            stmt.setString(3, E_VALUE);
+            stmt.execute();
+            upsertConn.commit();
+            upsertConn.close();
+        }
+        long upsert1Time = System.currentTimeMillis();
+        long timeDelta = 100;
+        Thread.sleep(timeDelta);
+
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW6);
+            stmt.setString(3, E_VALUE);
+            stmt.execute();
+            upsertConn.close();
+        }
+        
+        long queryTime = upsert1Time + timeDelta / 2;
+        String query =
+                "SELECT count(1) FROM " + tableName + " WHERE organization_id=? and a_string = ?";
+        // Specify CurrentSCN on URL with extra stuff afterwards (which should be ignored)
+        props.put(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
+        try (Connection conn = DriverManager.getConnection(url, props)) {
+            PreparedStatement statement = conn.prepareStatement(query);
+            statement.setString(1, tenantId);
+            statement.setString(2, B_VALUE);
+            ResultSet rs = statement.executeQuery();
+            assertTrue(rs.next());
+            assertEquals(2, rs.getLong(1));
+            assertFalse(rs.next());
+            conn.close();
+        }
+    }
+
+    @Test
+    public void TestPointInTimeUngroupedLimitedAggregation() throws Exception {
+        String updateStmt =
+                "upsert into " + tableName + " (" + "    ORGANIZATION_ID, " + "    ENTITY_ID, "
+                        + "    A_STRING) " + "VALUES (?, ?, ?)";
+        String url = getUrl();
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW6);
+            stmt.setString(3, C_VALUE);
+            stmt.execute();
+            stmt.setString(3, E_VALUE);
+            stmt.execute();
+            stmt.setString(3, B_VALUE);
+            stmt.execute();
+            stmt.setString(3, B_VALUE);
+            stmt.execute();
+            upsertConn.close();
+        }
+        long upsert1Time = System.currentTimeMillis();
+        long timeDelta = 100;
+        Thread.sleep(timeDelta);
+        
+        try (Connection upsertConn = DriverManager.getConnection(url, props)) {
+            upsertConn.setAutoCommit(true); // Test auto commit
+            PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
+            stmt.setString(1, tenantId);
+            stmt.setString(2, ROW6);
+            stmt.setString(3, E_VALUE);
+            stmt.execute();
+            upsertConn.close();
+        }
+        long queryTime = upsert1Time + timeDelta / 2;
+        String query =
+                "SELECT count(1) FROM " + tableName
+                        + " WHERE organization_id=? and a_string = ? LIMIT 3";
+        // Specify CurrentSCN on URL with extra stuff afterwards (which should be ignored)
+        props.put(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
+        try (Connection conn = DriverManager.getConnection(url, props)) {
+            PreparedStatement statement = conn.prepareStatement(query);
+            statement.setString(1, tenantId);
+            statement.setString(2, B_VALUE);
+            ResultSet rs = statement.executeQuery();
+            assertTrue(rs.next());
+            assertEquals(4, rs.getLong(1)); // LIMIT applied at end, so all rows would be counted
+            assertFalse(rs.next());
+            conn.close();
+        }
+    }
 }
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
index 2609ef0..e40576b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
@@ -53,8 +53,8 @@ public class QueryIT extends BaseQueryIT {
         return BaseQueryIT.allIndexes();
     }    
     
-    public QueryIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public QueryIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     @Test
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
index 815e6e7..63f7377 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
@@ -56,8 +56,8 @@ public class RangeScanIT extends BaseQueryIT {
         return BaseQueryIT.allIndexes();
     }
 
-    public RangeScanIT(String indexDDL, boolean columnEncoded) throws Exception {
-        super(indexDDL, columnEncoded, false);
+    public RangeScanIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
     
     @Test
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
index 6ad78db..f861c76 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
@@ -39,14 +39,19 @@ import java.util.Properties;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.TestUtil;
+import org.junit.FixMethodOrder;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
+@RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class UngroupedIT extends BaseQueryIT {
 
-    public UngroupedIT(String idxDdl, boolean columnEncoded)
-            throws Exception {
-        super(idxDdl, columnEncoded, false);
+    public UngroupedIT(String indexDDL, boolean columnEncoded, boolean keepDeletedCells) {
+        super(indexDDL, columnEncoded, keepDeletedCells);
     }
 
     @Parameters(name="UngroupedIT_{index}") // name is used by failsafe as file name in reports
@@ -102,110 +107,9 @@ public class UngroupedIT extends BaseQueryIT {
         }
     }
 
-    @Test
-    public void testPointInTimeUngroupedAggregation() throws Exception {
-        // Override value that was set at creation time
-        String url = getUrl();
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection upsertConn = DriverManager.getConnection(url, props);
-        String updateStmt =
-                "upsert into " + tableName + " (" + "    ORGANIZATION_ID, " + "    ENTITY_ID, "
-                        + "    A_STRING) " + "VALUES (?, ?, ?)";
-        // Insert all rows at ts
-        PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW5);
-        stmt.setString(3, null);
-        stmt.execute();
-        stmt.setString(3, C_VALUE);
-        stmt.execute();
-        stmt.setString(2, ROW7);
-        stmt.setString(3, E_VALUE);
-        stmt.execute();
-        upsertConn.commit();
-        upsertConn.close();
-        long upsert1Time = System.currentTimeMillis();
-        long timeDelta = 100;
-        Thread.sleep(timeDelta);
-
-        upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        stmt = upsertConn.prepareStatement(updateStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW6);
-        stmt.setString(3, E_VALUE);
-        stmt.execute();
-        upsertConn.close();
-        
-        long queryTime = upsert1Time + timeDelta / 2;
-        String query =
-                "SELECT count(1) FROM " + tableName + " WHERE organization_id=? and a_string = ?";
-        // Specify CurrentSCN on URL with extra stuff afterwards (which should be ignored)
-        props.put(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
-        Connection conn = DriverManager.getConnection(url, props);
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.setString(1, tenantId);
-        statement.setString(2, B_VALUE);
-        ResultSet rs = statement.executeQuery();
-        assertTrue(rs.next());
-        assertEquals(2, rs.getLong(1));
-        assertFalse(rs.next());
-        conn.close();
-    }
-
-    @Test
-    public void testPointInTimeUngroupedLimitedAggregation() throws Exception {
-        String updateStmt =
-                "upsert into " + tableName + " (" + "    ORGANIZATION_ID, " + "    ENTITY_ID, "
-                        + "    A_STRING) " + "VALUES (?, ?, ?)";
-        String url = getUrl();
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW6);
-        stmt.setString(3, C_VALUE);
-        stmt.execute();
-        stmt.setString(3, E_VALUE);
-        stmt.execute();
-        stmt.setString(3, B_VALUE);
-        stmt.execute();
-        stmt.setString(3, B_VALUE);
-        stmt.execute();
-        upsertConn.close();
-        long upsert1Time = System.currentTimeMillis();
-        long timeDelta = 100;
-        Thread.sleep(timeDelta);
-        
-        upsertConn = DriverManager.getConnection(url, props);
-        upsertConn.setAutoCommit(true); // Test auto commit
-        stmt = upsertConn.prepareStatement(updateStmt);
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW6);
-        stmt.setString(3, E_VALUE);
-        stmt.execute();
-        upsertConn.close();
-
-        long queryTime = upsert1Time + timeDelta / 2;
-        String query =
-                "SELECT count(1) FROM " + tableName
-                        + " WHERE organization_id=? and a_string = ? LIMIT 3";
-        // Specify CurrentSCN on URL with extra stuff afterwards (which should be ignored)
-        props.put(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(queryTime));
-        Connection conn = DriverManager.getConnection(url, props);
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.setString(1, tenantId);
-        statement.setString(2, B_VALUE);
-        ResultSet rs = statement.executeQuery();
-        assertTrue(rs.next());
-        assertEquals(4, rs.getLong(1)); // LIMIT applied at end, so all rows would be counted
-        assertFalse(rs.next());
-        conn.close();
-    }
     
     @Test
-    public void testSumOverNullIntegerColumn() throws Exception {
+    public void zTestSumOverNullIntegerColumn() throws Exception {
         String query = "SELECT sum(a_integer) FROM " + tableName + " a";
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);