phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: PHOENIX-4152 Don't swallow or wrap exception in BaseQueryIT constructor
Date Sat, 02 Sep 2017 07:45:26 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 037dfd005 -> bfd2de699


PHOENIX-4152 Don't swallow or wrap exception in BaseQueryIT constructor


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bfd2de69
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bfd2de69
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bfd2de69

Branch: refs/heads/4.x-HBase-1.2
Commit: bfd2de699ef33fed43d9e890f96fa5b0450f86db
Parents: 037dfd0
Author: Samarth Jain <samarth@apache.org>
Authored: Sat Sep 2 00:45:20 2017 -0700
Committer: Samarth Jain <samarth@apache.org>
Committed: Sat Sep 2 00:45:20 2017 -0700

----------------------------------------------------------------------
 .../phoenix/end2end/AggregateQueryIT.java       |  2 +-
 .../org/apache/phoenix/end2end/BaseQueryIT.java | 38 +++++++++++++-------
 .../apache/phoenix/end2end/CaseStatementIT.java |  2 +-
 .../apache/phoenix/end2end/CastAndCoerceIT.java |  2 +-
 .../end2end/ClientTimeArithmeticQueryIT.java    |  2 +-
 .../org/apache/phoenix/end2end/GroupByIT.java   |  2 +-
 .../apache/phoenix/end2end/MutableQueryIT.java  |  2 +-
 .../org/apache/phoenix/end2end/NotQueryIT.java  |  2 +-
 .../phoenix/end2end/PointInTimeQueryIT.java     |  2 +-
 .../org/apache/phoenix/end2end/QueryIT.java     |  2 +-
 .../org/apache/phoenix/end2end/ScanQueryIT.java |  2 +-
 11 files changed, 36 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
----------------------------------------------------------------------
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 9a82e4b..cec8a1f 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
@@ -45,7 +45,7 @@ import org.junit.Test;
 
 public class AggregateQueryIT extends BaseQueryIT {
 
-    public AggregateQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public AggregateQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws
Exception {
         super(indexDDL, mutable, columnEncoded, false);
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
----------------------------------------------------------------------
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 c8f9464..ce86278 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
@@ -30,7 +30,6 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -44,6 +43,8 @@ import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -95,7 +96,10 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
     protected String tableName;
     protected String indexName;
     
-    public BaseQueryIT(String idxDdl, boolean mutable, boolean columnEncoded, boolean keepDeletedCells)
{
+    private static final Logger logger = LoggerFactory.getLogger(BaseQueryIT.class);
+
+    public BaseQueryIT(String idxDdl, boolean mutable, boolean columnEncoded,
+            boolean keepDeletedCells) throws Exception {
         StringBuilder optionBuilder = new StringBuilder();
         if (!columnEncoded) {
             optionBuilder.append("COLUMN_ENCODED_BYTES=0");
@@ -114,19 +118,29 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
             optionBuilder.append("KEEP_DELETED_CELLS=true");
         }
         this.tableDDLOptions = optionBuilder.toString();
+        this.ts = nextTimestamp();
         try {
-            this.ts = nextTimestamp();
-            this.tableName = initATableValues(generateUniqueName(), tenantId, getDefaultSplits(tenantId),
date=new Date(System.currentTimeMillis()), ts, getUrl(), tableDDLOptions);
-            this.indexName = generateUniqueName();
-            if (idxDdl.length() > 0) {
-                this.indexDDL = String.format(idxDdl, indexName, tableName, keepDeletedCells
? "KEEP_DELETED_CELLS=true" : "KEEP_DELETED_CELLS=false");
-                Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-                props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
-                Connection conn = DriverManager.getConnection(getUrl(), props);
+            this.tableName =
+                    initATableValues(generateUniqueName(), tenantId, getDefaultSplits(tenantId),
+                        date = new Date(System.currentTimeMillis()), ts, getUrl(), tableDDLOptions);
+        } catch (Exception e) {
+            logger.error("Exception when creating aTable ", e);
+            throw e;
+        }
+        this.indexName = generateUniqueName();
+        if (idxDdl.length() > 0) {
+            this.indexDDL =
+                    String.format(idxDdl, indexName, tableName,
+                        keepDeletedCells ? "KEEP_DELETED_CELLS=true" : "KEEP_DELETED_CELLS=false");
+            Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+            props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
+
+            try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
                 conn.createStatement().execute(this.indexDDL);
+            } catch (Exception e) {
+                logger.error("Exception while creating index: " + indexDDL, e);
+                throw e;
             }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
         }
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
----------------------------------------------------------------------
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 61de412..9d6a53e 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
@@ -54,7 +54,7 @@ import com.google.common.collect.Lists;
 @RunWith(Parameterized.class)
 public class CaseStatementIT extends BaseQueryIT {
 
-    public CaseStatementIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public CaseStatementIT(String indexDDL, boolean mutable, boolean columnEncoded) throws
Exception {
         super(indexDDL, mutable, columnEncoded, false);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
----------------------------------------------------------------------
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 e574286..d47275d 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
@@ -43,7 +43,7 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)
 public class CastAndCoerceIT extends BaseQueryIT {
 
-    public CastAndCoerceIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public CastAndCoerceIT(String indexDDL, boolean mutable, boolean columnEncoded) throws
Exception {
         super(indexDDL, mutable, columnEncoded, false);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index f89be65..6f76787 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -60,7 +60,7 @@ import com.google.common.collect.Lists;
 @RunWith(Parameterized.class)
 public class ClientTimeArithmeticQueryIT extends BaseQueryIT {
 
-    public ClientTimeArithmeticQueryIT(String indexDDL, boolean mutable, boolean columnEncoded)
{
+    public ClientTimeArithmeticQueryIT(String indexDDL, boolean mutable, boolean columnEncoded)
throws Exception {
         super(indexDDL, mutable, columnEncoded, false);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
index 4f06ad2..b337c00 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
@@ -48,7 +48,7 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)
 public class GroupByIT extends BaseQueryIT {
 
-    public GroupByIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public GroupByIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception
{
         super(indexDDL, mutable, columnEncoded, true);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableQueryIT.java
index 3d11234..dc9b945 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableQueryIT.java
@@ -62,7 +62,7 @@ public class MutableQueryIT extends BaseQueryIT {
         return testCases;
     }
     
-    public MutableQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public MutableQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws
Exception {
         super(indexDDL, mutable, columnEncoded, true);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
----------------------------------------------------------------------
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 70a15c7..3b868d0 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
@@ -52,7 +52,7 @@ import com.google.common.primitives.Floats;
 @RunWith(Parameterized.class)
 public class NotQueryIT extends BaseQueryIT {
 
-    public NotQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public NotQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception
{
         super(indexDDL, mutable, columnEncoded, false);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
----------------------------------------------------------------------
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 61153e1..0390c03 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
@@ -34,7 +34,7 @@ import org.junit.Test;
 
 public class PointInTimeQueryIT extends BaseQueryIT {
 
-    public PointInTimeQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public PointInTimeQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws
Exception {
         super(indexDDL, mutable, columnEncoded, true);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
----------------------------------------------------------------------
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 a06c961..f72caf9 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
@@ -62,7 +62,7 @@ import org.junit.Test;
  */
 public class QueryIT extends BaseQueryIT {
     
-    public QueryIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public QueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception
{
         super(indexDDL, mutable, columnEncoded, false);
     }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd2de69/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java
index 4f9eb86..c77c06f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java
@@ -62,7 +62,7 @@ public class ScanQueryIT extends BaseQueryIT {
         return QueryIT.data();
     }
 
-    public ScanQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) {
+    public ScanQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception
{
         super(indexDDL, mutable, columnEncoded, false);
     }
     


Mime
View raw message