You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2017/09/29 20:16:31 UTC
phoenix git commit: PHOENIX-4260 Breakup NotQueryIT into multiple
test classes
Repository: phoenix
Updated Branches:
refs/heads/master f1b457819 -> cfe4c9356
PHOENIX-4260 Breakup NotQueryIT into multiple test classes
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cfe4c935
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cfe4c935
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cfe4c935
Branch: refs/heads/master
Commit: cfe4c9356d0cb9ef16fc297ea1192d35b95862fd
Parents: f1b4578
Author: Samarth Jain <sa...@apache.org>
Authored: Fri Sep 29 13:16:25 2017 -0700
Committer: Samarth Jain <sa...@apache.org>
Committed: Fri Sep 29 13:16:25 2017 -0700
----------------------------------------------------------------------
.../org/apache/phoenix/end2end/BaseQueryIT.java | 81 +++++++++++++-------
.../apache/phoenix/end2end/CaseStatementIT.java | 2 +-
.../apache/phoenix/end2end/CastAndCoerceIT.java | 2 +-
.../org/apache/phoenix/end2end/GroupByIT.java | 2 +-
.../org/apache/phoenix/end2end/InQueryIT.java | 2 +-
.../apache/phoenix/end2end/IntArithmeticIT.java | 2 +-
.../org/apache/phoenix/end2end/NotQueryIT.java | 12 +--
.../NotQueryWithGlobalImmutableIndexesIT.java | 43 +++++++++++
.../NotQueryWithLocalImmutableIndexesIT.java | 43 +++++++++++
.../org/apache/phoenix/end2end/RangeScanIT.java | 2 +-
.../org/apache/phoenix/end2end/UngroupedIT.java | 2 +-
11 files changed, 149 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/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 7f7416b..53391f1 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
@@ -51,27 +51,41 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
protected static final String tenantId = getOrganizationId();
protected static final String ATABLE_INDEX_NAME = "ATABLE_IDX";
protected static final long BATCH_SIZE = 3;
- protected static final String[] INDEX_DDLS = new String[] {
- "CREATE INDEX %s ON %s (a_integer DESC) INCLUDE ("
- + " A_STRING, " + " B_STRING, " + " A_DATE) %s",
- "CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE ("
- + " B_STRING, " + " A_DATE) %s",
- "CREATE INDEX %s ON %s (a_integer) INCLUDE ("
- + " A_STRING, " + " B_STRING, " + " A_DATE) %s",
- "CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE ("
- + " A_STRING, " + " B_STRING, " + " A_DATE) %s",
- "CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, "
- + " A_DATE) %s",
- "CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE ("
- + " A_STRING, " + " B_STRING, " + " A_DATE) %s",
- "" };
-
+ protected static final String NO_INDEX = "";
+ protected static final String[] GLOBAL_INDEX_DDLS =
+ new String[] {
+ "CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" + " A_STRING, "
+ + " B_STRING, " + " A_DATE) %s",
+ "CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, "
+ + " A_DATE) %s",
+ "CREATE INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, "
+ + " B_STRING, " + " A_DATE) %s",
+ NO_INDEX };
+ protected static final String[] LOCAL_INDEX_DDLS =
+ new String[] {
+ "CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" + " A_STRING, "
+ + " B_STRING, " + " A_DATE) %s",
+ "CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, "
+ + " A_DATE) %s",
+ "CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, "
+ + " B_STRING, " + " A_DATE) %s" };
+ protected static String[] INDEX_DDLS;
+ static {
+ INDEX_DDLS = new String[GLOBAL_INDEX_DDLS.length + LOCAL_INDEX_DDLS.length];
+ int i = 0;
+ for (String s : GLOBAL_INDEX_DDLS) {
+ INDEX_DDLS[i++] = s;
+ }
+ for (String s : LOCAL_INDEX_DDLS) {
+ INDEX_DDLS[i++] = s;
+ }
+ }
protected Date date;
private String indexDDL;
private String tableDDLOptions;
protected String tableName;
protected String indexName;
-
+
private static final Logger logger = LoggerFactory.getLogger(BaseQueryIT.class);
public BaseQueryIT(String idxDdl, boolean mutable, boolean columnEncoded,
@@ -81,23 +95,23 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
optionBuilder.append("COLUMN_ENCODED_BYTES=0");
}
if (!mutable) {
- if (optionBuilder.length()>0)
- optionBuilder.append(",");
+ if (optionBuilder.length() > 0) optionBuilder.append(",");
optionBuilder.append("IMMUTABLE_ROWS=true");
if (!columnEncoded) {
- optionBuilder.append(",IMMUTABLE_STORAGE_SCHEME="+PTableImpl.ImmutableStorageScheme.ONE_CELL_PER_COLUMN);
+ optionBuilder.append(",IMMUTABLE_STORAGE_SCHEME="
+ + PTableImpl.ImmutableStorageScheme.ONE_CELL_PER_COLUMN);
}
}
if (keepDeletedCells) {
- if (optionBuilder.length()>0)
- optionBuilder.append(",");
+ if (optionBuilder.length() > 0) optionBuilder.append(",");
optionBuilder.append("KEEP_DELETED_CELLS=true");
}
this.tableDDLOptions = optionBuilder.toString();
try {
this.tableName =
initATableValues(generateUniqueName(), tenantId, getDefaultSplits(tenantId),
- date = new Date(System.currentTimeMillis()), null, getUrl(), tableDDLOptions);
+ date = new Date(System.currentTimeMillis()), null, getUrl(),
+ tableDDLOptions);
} catch (Exception e) {
logger.error("Exception when creating aTable ", e);
throw e;
@@ -116,13 +130,26 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT {
}
}
}
-
- @Parameters(name="indexDDL={0},mutable={1},columnEncoded={2}")
- public static Collection<Object> data() {
+
+ @Parameters(name = "indexDDL={0},mutable={1},columnEncoded={2}")
+ public static Collection<Object> allIndexes() {
List<Object> testCases = Lists.newArrayList();
for (String indexDDL : INDEX_DDLS) {
- for (boolean mutable : new boolean[]{false}) {
- for (boolean columnEncoded : new boolean[]{false}) {
+ for (boolean mutable : new boolean[] { false }) {
+ for (boolean columnEncoded : new boolean[] { false }) {
+ testCases.add(new Object[] { indexDDL, mutable, columnEncoded });
+ }
+ }
+ }
+ return testCases;
+ }
+
+ @Parameters(name = "localIndexDDL={0}")
+ public static Collection<Object> localIndexes() {
+ List<Object> testCases = Lists.newArrayList();
+ for (String indexDDL : LOCAL_INDEX_DDLS) {
+ for (boolean mutable : new boolean[] { false }) {
+ for (boolean columnEncoded : new boolean[] { false }) {
testCases.add(new Object[] { indexDDL, mutable, columnEncoded });
}
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/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 a1cb05f..ef67de7 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
@@ -59,7 +59,7 @@ public class CaseStatementIT extends BaseQueryIT {
@Parameters(name="CaseStatementIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/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 c4e334a..8c35992 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
@@ -49,7 +49,7 @@ public class CastAndCoerceIT extends BaseQueryIT {
@Parameters(name="CastAndCoerceIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/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 2f2bf1d..46f9703 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
@@ -58,7 +58,7 @@ public class GroupByIT extends BaseQueryIT {
@Parameters(name="GroupByIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
----------------------------------------------------------------------
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 c5e6e63..9d1d8b6 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
@@ -57,7 +57,7 @@ public class InQueryIT extends BaseQueryIT {
@Parameters(name="InQueryIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
----------------------------------------------------------------------
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 d21cde8..bbd9d7f 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
@@ -53,7 +53,7 @@ public class IntArithmeticIT extends BaseQueryIT {
@Parameters(name="IntArithmeticIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/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 9a285ff..94e95d8 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
@@ -35,32 +35,24 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import java.util.Collection;
import java.util.Properties;
-import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.PropertiesUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
import com.google.common.primitives.Doubles;
import com.google.common.primitives.Floats;
@RunWith(Parameterized.class)
-public class NotQueryIT extends BaseQueryIT {
+public abstract class NotQueryIT extends BaseQueryIT {
- public NotQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception {
+ protected NotQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception {
super(indexDDL, mutable, columnEncoded, false);
}
- @Parameters(name="NotQueryIT_{index}") // name is used by failsafe as file name in reports
- public static Collection<Object> data() {
- return QueryIT.data();
- }
-
@Test
public void testNotInList() throws Exception {
String query = "SELECT entity_id FROM " + tableName + " WHERE organization_id=? and entity_id NOT IN (?,?,?,?,?,?)";
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..bff741f
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.collect.Lists;
+
+public class NotQueryWithGlobalImmutableIndexesIT extends NotQueryIT {
+
+ public NotQueryWithGlobalImmutableIndexesIT(String indexDDL, boolean mutable,
+ boolean columnEncoded) throws Exception {
+ super(indexDDL, mutable, columnEncoded);
+ }
+
+ @Parameters(name = "globalIndexDDL={0}")
+ public static Collection<Object> globalIndexes() {
+ List<Object> testCases = Lists.newArrayList();
+ for (String indexDDL : GLOBAL_INDEX_DDLS) {
+ testCases.add(new Object[] { indexDDL, false, false });
+ }
+ return testCases;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..806b396
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.collect.Lists;
+
+public class NotQueryWithLocalImmutableIndexesIT extends NotQueryIT {
+
+ public NotQueryWithLocalImmutableIndexesIT(String indexDDL, boolean mutable,
+ boolean columnEncoded) throws Exception {
+ super(indexDDL, mutable, columnEncoded);
+ }
+
+ @Parameters(name = "localIndexDDL={0}")
+ public static Collection<Object> localIndexes() {
+ List<Object> testCases = Lists.newArrayList();
+ for (String indexDDL : LOCAL_INDEX_DDLS) {
+ testCases.add(new Object[] { indexDDL, false, false });
+ }
+ return testCases;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
----------------------------------------------------------------------
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 3d2e375..a9cc2c4 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
@@ -53,7 +53,7 @@ public class RangeScanIT extends BaseQueryIT {
@Parameters(name="RangeScanIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
public RangeScanIT(String indexDDL, boolean mutable, boolean columnEncoded) throws Exception {
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
----------------------------------------------------------------------
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 e562501..fa1e4dd 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
@@ -51,7 +51,7 @@ public class UngroupedIT extends BaseQueryIT {
@Parameters(name="UngroupedIT_{index}") // name is used by failsafe as file name in reports
public static Collection<Object> data() {
- return QueryIT.data();
+ return QueryIT.allIndexes();
}
@Test