You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2019/12/27 19:35:19 UTC

[GitHub] [phoenix] swaroopak commented on a change in pull request #666: Phoenix-5652 Improve IndexScrutinyTool perf by using SkipScan in index table queries

swaroopak commented on a change in pull request #666: Phoenix-5652 Improve IndexScrutinyTool perf by using SkipScan in index table queries
URL: https://github.com/apache/phoenix/pull/666#discussion_r361732082
 
 

 ##########
 File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolPerformanceIT.java
 ##########
 @@ -0,0 +1,219 @@
+/*
+ * 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 com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.FilterList;
+import org.apache.phoenix.compile.QueryPlan;
+import org.apache.phoenix.filter.SkipScanFilter;
+import org.apache.phoenix.jdbc.PhoenixStatement;
+import org.apache.phoenix.mapreduce.index.IndexScrutinyTool;
+import org.apache.phoenix.mapreduce.index.IndexScrutinyTool.SourceTable;
+import org.apache.phoenix.util.EnvironmentEdgeManager;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Tests for the {@link IndexScrutinyTool}
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+@RunWith(Parameterized.class)
+public class IndexScrutinyToolPerformanceIT extends IndexScrutinyToolBaseIT {
+    private String dataTableDdl;
+    private String indexTableDdl;
+    private String viewDdl;
+
+    private static final String UPSERT_SQL = "UPSERT INTO %s VALUES(?,?,?,?)";
+
+    private String schemaName;
+    private String dataTableName;
+    private String dataTableFullName;
+    private String indexTableName;
+    private String indexTableFullName;
+    private String viewName;
+    private String viewFullName;
+
+    private Connection conn;
+
+    private PreparedStatement dataTableUpsertStmt;
+    private PreparedStatement viewUpsertStmt;
+
+    private long testTime;
+    private Properties props;
+
+    private static final Log LOG = LogFactory.getLog(IndexScrutinyToolPerformanceIT.class);
+    @Parameterized.Parameters public static Collection<Object[]> data() {
+        List<Object[]> list = Lists.newArrayListWithExpectedSize(15);
+        list.add(new Object[] {
+                "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR)",
+                null, "CREATE INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" });
+        list.add(new Object[] {
+                "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR)",
+                null, "CREATE LOCAL INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" });
+        list.add(new Object[] {
+                "CREATE TABLE %s (ID INTEGER NOT NULL, NAME VARCHAR NOT NULL, ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR CONSTRAINT PK_1 PRIMARY KEY (ID, NAME)) ",
+                null, "CREATE INDEX %s ON %s (EMPLOY_DATE) INCLUDE (ZIP)" });
+        list.add(new Object[] {
+                "CREATE TABLE %s (ID INTEGER NOT NULL, NAME VARCHAR NOT NULL, ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR CONSTRAINT PK_1 PRIMARY KEY (ID, NAME)) ",
+                null, "CREATE INDEX %s ON %s (EMPLOY_DATE, ZIP) INCLUDE (EMPLOYER)" });
+        list.add(new Object[] {
+                "CREATE TABLE %s (ID INTEGER NOT NULL, NAME VARCHAR NOT NULL, ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR CONSTRAINT PK_1 PRIMARY KEY (ID, NAME)) SALT_BUCKETS=2",
+                null, "CREATE INDEX %s ON %s (EMPLOY_DATE, ZIP) INCLUDE (EMPLOYER) " });
+        list.add(new Object[] {
+                "CREATE TABLE %s (COL1 VARCHAR(15) NOT NULL,ID INTEGER NOT NULL, NAME VARCHAR, ZIP INTEGER CONSTRAINT PK_1 PRIMARY KEY (COL1, ID)) MULTI_TENANT=true",
+                null, "CREATE INDEX %s ON %s (NAME) " });
+        list.add(new Object[] {
+                "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR)",
+                "CREATE VIEW %s AS SELECT * FROM %s", "CREATE INDEX %s ON %s (NAME) " });
+//        list.add(new Object[] {
 
 Review comment:
   nit: please remove the commented code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services