[4/9] phoenix git commit: PHOENIX-5024 - Cleanup anonymous inner classes in PostDDLCompiler

2018-11-17 Thread jamestaylor
PHOENIX-5024 - Cleanup anonymous inner classes in PostDDLCompiler


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

Branch: refs/heads/omid2
Commit: b493797f67a133a94f83546f29d5a42c0e4e6835
Parents: 89bbdfd
Author: Geoffrey Jacoby 
Authored: Fri Nov 16 09:55:49 2018 -0800
Committer: Geoffrey Jacoby 
Committed: Fri Nov 16 11:03:26 2018 -0800

--
 .../apache/phoenix/compile/PostDDLCompiler.java | 478 ++-
 1 file changed, 258 insertions(+), 220 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b493797f/phoenix-core/src/main/java/org/apache/phoenix/compile/PostDDLCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/PostDDLCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/PostDDLCompiler.java
index 709534e..a74c5f1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/PostDDLCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/PostDDLCompiler.java
@@ -87,248 +87,286 @@ public class PostDDLCompiler {
 final long timestamp) throws SQLException {
 PhoenixStatement statement = new PhoenixStatement(connection);
 final StatementContext context = new StatementContext(
-statement, 
-new ColumnResolver() {
+statement,
+new MultipleTableRefColumnResolver(tableRefs),
+scan,
+new SequenceManager(statement));
+return new PostDDLMutationPlan(context, tableRefs, timestamp, emptyCF, 
deleteList, projectCFs);
+}
 
-@Override
-public List getTables() {
-return tableRefs;
-}
+private static class MultipleTableRefColumnResolver implements 
ColumnResolver {
 
-@Override
-public TableRef resolveTable(String schemaName, String 
tableName) throws SQLException {
-throw new UnsupportedOperationException();
-}
+private final List tableRefs;
 
-@Override
-public ColumnRef resolveColumn(String schemaName, String 
tableName, String colName)
-throws SQLException {
-throw new UnsupportedOperationException();
-}
+public MultipleTableRefColumnResolver(List tableRefs) {
+this.tableRefs = tableRefs;
+}
 
-   @Override
-   public List getFunctions() {
-   return 
Collections.emptyList();
-   }
-
-   @Override
-   public PFunction resolveFunction(String 
functionName)
-   throws SQLException {
-   throw new 
FunctionNotFoundException(functionName);
-   }
-
-   @Override
-   public boolean hasUDFs() {
-   return false;
-   }
-
-   @Override
-   public PSchema resolveSchema(String 
schemaName) throws SQLException {
-   throw new 
SchemaNotFoundException(schemaName);
-   }
-
-   @Override
-   public List getSchemas() {
-   throw new 
UnsupportedOperationException();
-   }
-
-},
-scan,
-new SequenceManager(statement));
-return new BaseMutationPlan(context, Operation.UPSERT /* FIXME */) {
-
-@Override
-public MutationState execute() throws SQLException {
-if (tableRefs.isEmpty()) {
-return new MutationState(0, 1000, connection);
-}
-boolean wasAutoCommit = connection.getAutoCommit();
-try {
-connection.setAutoCommit(true);
-SQLException sqlE = null;
-/*
- * Handles:
- * 1) deletion of 

[2/9] phoenix git commit: PHOENIX-5000 Make SecureUserConnectionsTest as Integration test

2018-11-17 Thread jamestaylor
PHOENIX-5000 Make SecureUserConnectionsTest as Integration test


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

Branch: refs/heads/omid2
Commit: 4581516eaea432962c9b61332a5f3f8117792823
Parents: 87e7702
Author: Karan Mehta 
Authored: Tue Oct 30 12:40:00 2018 -0700
Committer: Karan Mehta 
Committed: Thu Nov 15 14:58:46 2018 -0800

--
 .../phoenix/jdbc/SecureUserConnectionsIT.java   | 459 +++
 .../phoenix/jdbc/SecureUserConnectionsTest.java | 459 ---
 2 files changed, 459 insertions(+), 459 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4581516e/phoenix-core/src/it/java/org/apache/phoenix/jdbc/SecureUserConnectionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/jdbc/SecureUserConnectionsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/jdbc/SecureUserConnectionsIT.java
new file mode 100644
index 000..eaf981b
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/jdbc/SecureUserConnectionsIT.java
@@ -0,0 +1,459 @@
+/*
+ * 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.jdbc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.minikdc.MiniKdc;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authentication.util.KerberosName;
+import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
+import org.apache.phoenix.query.ConfigurationFactory;
+import org.apache.phoenix.util.InstanceResolver;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests ConnectionQueryServices caching when Kerberos authentication is 
enabled. It's not
+ * trivial to directly test this, so we exploit the knowledge that the caching 
is driven by
+ * a ConcurrentHashMap. We can use a HashSet to determine when instances of 
ConnectionInfo
+ * collide and when they do not.
+ */
+public class SecureUserConnectionsIT {
+private static final Log LOG = 
LogFactory.getLog(SecureUserConnectionsIT.class);
+private static final int KDC_START_ATTEMPTS = 10;
+
+private static final File TEMP_DIR = new File(getClassTempDir());
+private static final File KEYTAB_DIR = new File(TEMP_DIR, "keytabs");
+private static final File KDC_DIR = new File(TEMP_DIR, "kdc");
+private static final List USER_KEYTAB_FILES = new ArrayList<>();
+private static final List SERVICE_KEYTAB_FILES = new ArrayList<>();
+private static final int NUM_USERS = 3;
+private static final Properties EMPTY_PROPERTIES = new Properties();
+private static final String BASE_URL = PhoenixRuntime.JDBC_PROTOCOL + 
":localhost:2181";
+
+private static MiniKdc KDC;
+
+@BeforeClass
+public static void setupKdc() throws Exception {
+ensureIsEmptyDirectory(KDC_DIR);
+ensureIsEmptyDirectory(KEYTAB_DIR);
+// Create and start the KDC. MiniKDC appears to have a race condition 
in how it does
+// port allocation (with apache-ds). See PHOENIX-3287.
+boolean started = false;
+for (int i 

[9/9] phoenix git commit: Merge branch '4.x-HBase-1.3' into omid2

2018-11-17 Thread jamestaylor
Merge branch '4.x-HBase-1.3' into omid2


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

Branch: refs/heads/omid2
Commit: 06b2ffd90a28d69aa9a5835cd2a19f884ae2f277
Parents: e02b3a2 727f415
Author: James Taylor 
Authored: Sat Nov 17 15:43:33 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:43:33 2018 -0800

--
 .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 ++-
 .../phoenix/jdbc/SecureUserConnectionsIT.java   | 459 ++
 .../apache/phoenix/compile/PostDDLCompiler.java | 478 ++-
 .../apache/phoenix/compile/WhereOptimizer.java  |  58 ++-
 .../UngroupedAggregateRegionObserver.java   |  43 +-
 .../expression/ComparisonExpression.java|  18 +-
 .../RowValueConstructorExpressionRewriter.java  |  54 +++
 .../index/PhoenixIndexImportDirectMapper.java   |  11 +-
 .../org/apache/phoenix/schema/RowKeySchema.java |   4 +
 ...wValueConstructorExpressionRewriterTest.java |  78 +++
 .../phoenix/jdbc/SecureUserConnectionsTest.java | 459 --
 .../phoenix/query/QueryServicesTestImpl.java|   1 +
 pom.xml |   2 +-
 13 files changed, 1114 insertions(+), 722 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/06b2ffd9/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06b2ffd9/pom.xml
--



[1/9] phoenix git commit: PHOENIX-4841 staging patch commit.

2018-11-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 e02b3a278 -> 06b2ffd90


PHOENIX-4841 staging patch commit.


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

Branch: refs/heads/omid2
Commit: 87e7702966ab7bc0afd52696e453f57ccc28b369
Parents: 7b038fb
Author: Daniel Wong 
Authored: Tue Oct 9 16:38:11 2018 -0700
Committer: Thomas D'Silva 
Committed: Thu Nov 15 12:00:51 2018 -0800

--
 .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 +--
 .../apache/phoenix/compile/WhereOptimizer.java  |  58 ++-
 .../expression/ComparisonExpression.java|  18 +-
 .../RowValueConstructorExpressionRewriter.java  |  54 ++
 .../org/apache/phoenix/schema/RowKeySchema.java |   4 +
 ...wValueConstructorExpressionRewriterTest.java |  78 +
 6 files changed, 362 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e77029/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index 04272fa..2b1d31e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -17,11 +17,13 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import com.google.common.collect.Lists;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Test;
 
 import java.sql.Connection;
 import java.sql.Date;
@@ -37,18 +39,19 @@ import java.util.Map;
 import java.util.Properties;
 
 import org.apache.hadoop.hbase.util.Base64;
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.phoenix.jdbc.PhoenixConnection;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.apache.phoenix.util.TestUtil;
-import org.junit.Test;
 
-import com.google.common.collect.Lists;
+import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 
 public class QueryMoreIT extends ParallelStatsDisabledIT {
 
+private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + 
TENANT_ID_ATTRIB + "=tenant1";
+
 private String dataTableName;
 //queryAgainstTenantSpecificView = true, dataTableSalted = true 
 @Test
@@ -510,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT {
 stmt.execute();
 }
 }
+
+@Test public void testRVCWithDescAndAscendingPK() throws Exception {
+final Connection conn = DriverManager.getConnection(getUrl());
+String fullTableName = generateUniqueName();
+try (Statement stmt = conn.createStatement()) {
+stmt.execute("CREATE TABLE " + fullTableName + "(\n"
++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE 
VARCHAR NOT NULL,\n"
++ "ENTITY_ID VARCHAR NOT NULL\n"
++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n"
++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + 
"ENTITY_ID\n"
++ ")\n" + ") MULTI_TENANT=TRUE");
+}
+
+conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','c','1')");
+conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','b','3')");
+conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','b','4')");
+conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','a','2')");
+conn.commit();
+
+try (Statement stmt = conn.createStatement()) {
+final ResultSet
+rs =
+stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + 
fullTableName + "\n"
++ "WHERE organization_id = 'org1'\n"
++ "AND (score, 

[5/9] phoenix git commit: PHOENIX-4955 - PhoenixIndexImportDirectMapper undercounts failed records

2018-11-17 Thread jamestaylor
PHOENIX-4955 - PhoenixIndexImportDirectMapper undercounts failed records


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

Branch: refs/heads/omid2
Commit: fc38ace74e4926b25067ff7201631898eecaeb63
Parents: b493797
Author: Geoffrey Jacoby 
Authored: Fri Nov 16 13:57:45 2018 -0800
Committer: Geoffrey Jacoby 
Committed: Fri Nov 16 14:31:34 2018 -0800

--
 .../mapreduce/index/PhoenixIndexImportDirectMapper.java  | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc38ace7/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectMapper.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectMapper.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectMapper.java
index eb4bc0e..e2ac491 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectMapper.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectMapper.java
@@ -68,6 +68,8 @@ public class PhoenixIndexImportDirectMapper extends
 private long batchSizeBytes;
 
 private MutationState mutationState;
+private int currentBatchCount = 0;
+
 
 @Override
 protected void setup(final Context context) throws IOException, 
InterruptedException {
@@ -113,6 +115,7 @@ public class PhoenixIndexImportDirectMapper extends
 throws IOException, InterruptedException {
 
 try {
+currentBatchCount++;
 final List values = record.getValues();
 indxWritable.setValues(values);
 indxWritable.write(this.pStatement);
@@ -125,9 +128,8 @@ public class PhoenixIndexImportDirectMapper extends
 }
 // Keep accumulating Mutations till batch size
 mutationState.join(currentMutationState);
-
 // Write Mutation Batch
-if 
(context.getCounter(PhoenixJobCounters.INPUT_RECORDS).getValue() % batchSize == 
0) {
+if (currentBatchCount % batchSize == 0) {
 writeBatch(mutationState, context);
 mutationState = null;
 }
@@ -136,7 +138,7 @@ public class PhoenixIndexImportDirectMapper extends
 context.progress();
 } catch (SQLException e) {
 LOG.error(" Error {}  while read/write of a record ", 
e.getMessage());
-context.getCounter(PhoenixJobCounters.FAILED_RECORDS).increment(1);
+
context.getCounter(PhoenixJobCounters.FAILED_RECORDS).increment(currentBatchCount);
 throw new RuntimeException(e);
 }
 context.getCounter(PhoenixJobCounters.INPUT_RECORDS).increment(1);
@@ -157,6 +159,7 @@ public class PhoenixIndexImportDirectMapper extends
 mutationPair.getSecond().size());
 }
 connection.rollback();
+currentBatchCount = 0;
 }
 
 @Override
@@ -173,7 +176,7 @@ public class PhoenixIndexImportDirectMapper extends
 super.cleanup(context);
 } catch (SQLException e) {
 LOG.error(" Error {}  while read/write of a record ", 
e.getMessage());
-context.getCounter(PhoenixJobCounters.FAILED_RECORDS).increment(1);
+
context.getCounter(PhoenixJobCounters.FAILED_RECORDS).increment(currentBatchCount);
 throw new RuntimeException(e);
 } finally {
 if (connection != null) {



[7/9] phoenix git commit: PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery timeouts

2018-11-17 Thread jamestaylor
PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery 
timeouts


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

Branch: refs/heads/omid2
Commit: 5871b3960012894f8c3eafb62c101da731dc1b24
Parents: b6d0ecb
Author: James Taylor 
Authored: Sat Nov 17 15:13:59 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:13:59 2018 -0800

--
 .../end2end/ConnectionQueryServicesTestImpl.java   |  4 +++-
 .../transaction/OmidTransactionProvider.java   |  2 +-
 .../transaction/PhoenixTransactionProvider.java|  2 +-
 .../transaction/TephraTransactionProvider.java | 17 ++---
 .../phoenix/query/QueryServicesTestImpl.java   |  3 ---
 5 files changed, 15 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5871b396/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import 
org.apache.phoenix.transaction.PhoenixTransactionService;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
 import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 public synchronized PhoenixTransactionClient 
initTransactionClient(Provider provider) throws SQLException {
 PhoenixTransactionService txService = txServices[provider.ordinal()];
 if (txService == null) {
-txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+int port = TestUtil.getRandomPort();
+txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo, 
port);
 }
 return super.initTransactionClient(provider);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5871b396/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c53215c..bace2bc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -72,7 +72,7 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 @Override
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
+public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo, int port) throws  SQLException{
 return new OmidTransactionService();
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5871b396/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
index b7f660e..3af554b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
@@ -50,7 +50,7 @@ public interface PhoenixTransactionProvider {
 public PhoenixTransactionContext getTransactionContext(PhoenixConnection 
connection) throws SQLException;
 
 public PhoenixTransactionClient getTransactionClient(Configuration config, 
ConnectionInfo connectionInfo) throws SQLException;
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  

[3/9] phoenix git commit: PHOENIX-5013 Increase timeout for Tephra discovery service

2018-11-17 Thread jamestaylor
PHOENIX-5013 Increase timeout for Tephra discovery service


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

Branch: refs/heads/omid2
Commit: 89bbdfd9e0ad427d9e9771608e2d32b631319d2e
Parents: 4581516
Author: Thomas D'Silva 
Authored: Thu Nov 15 12:33:26 2018 -0800
Committer: Thomas D'Silva 
Committed: Thu Nov 15 19:11:49 2018 -0800

--
 .../test/java/org/apache/phoenix/query/QueryServicesTestImpl.java   | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/89bbdfd9/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 49fb8e8..eae951a 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -130,6 +130,7 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, 
"n-times")
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
 .set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
TestUtil.getRandomPort())
+
.set(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, 60)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, 
Files.createTempDir().getAbsolutePath())
 .set(TxConstants.Manager.CFG_TX_TIMEOUT, 
DEFAULT_TXN_TIMEOUT_SECONDS)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)



[6/9] phoenix git commit: PHOENIX-5005 Server-side delete / upsert-select potentially blocked after a split

2018-11-17 Thread jamestaylor
PHOENIX-5005 Server-side delete / upsert-select potentially blocked after a 
split


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

Branch: refs/heads/omid2
Commit: b6d0ecb2dc30af56fb51377576aba396cffa443b
Parents: fc38ace
Author: Vincent Poon 
Authored: Thu Nov 8 15:38:20 2018 -0800
Committer: Vincent Poon 
Committed: Fri Nov 16 16:26:17 2018 -0800

--
 .../UngroupedAggregateRegionObserver.java   | 43 
 1 file changed, 26 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b6d0ecb2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 73386a2..26e338f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -262,7 +262,7 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
   // flush happen which decrease the memstore size and then writes allowed 
on the region.
   for (int i = 0; blockingMemstoreSize > 0 && region.getMemstoreSize() > 
blockingMemstoreSize && i < 30; i++) {
   try {
-  checkForRegionClosing();
+  checkForRegionClosingOrSplitting();
   Thread.sleep(100);
   } catch (InterruptedException e) {
   Thread.currentThread().interrupt();
@@ -311,7 +311,7 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
  * a high chance that flush might not proceed and memstore won't be freed 
up.
  * @throws IOException
  */
-private void checkForRegionClosing() throws IOException {
+private void checkForRegionClosingOrSplitting() throws IOException {
 synchronized (lock) {
 if(isRegionClosingOrSplitting) {
 lock.notifyAll();
@@ -1333,13 +1333,31 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
 @Override
 public void preSplit(ObserverContext c, 
byte[] splitRow)
 throws IOException {
-// Don't allow splitting if operations need read and write to same 
region are going on in the
-// the coprocessors to avoid dead lock scenario. See PHOENIX-3111.
+waitForScansToFinish(c);
+}
+
+// Don't allow splitting/closing if operations need read and write to same 
region are going on in the
+// the coprocessors to avoid dead lock scenario. See PHOENIX-3111.
+private void 
waitForScansToFinish(ObserverContext c) throws 
IOException {
+int maxWaitTime = 
c.getEnvironment().getConfiguration().getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT,
+HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT);
+long start = EnvironmentEdgeManager.currentTimeMillis();
 synchronized (lock) {
 isRegionClosingOrSplitting = true;
-if (scansReferenceCount > 0) {
-throw new IOException("Operations like local index 
building/delete/upsert select"
-+ " might be going on so not allowing to split.");
+while (scansReferenceCount > 0) {
+try {
+lock.wait(1000);
+if (EnvironmentEdgeManager.currentTimeMillis() - start >= 
maxWaitTime) {
+isRegionClosingOrSplitting = false; // must reset in 
case split is not retried
+throw new IOException(String.format(
+"Operations like local index 
building/delete/upsert select"
++ " might be going on so not allowing to 
split/close. scansReferenceCount=%s region=%s",
+scansReferenceCount,
+
c.getEnvironment().getRegionInfo().getRegionNameAsString()));
+}
+} catch (InterruptedException e) {
+Thread.currentThread().interrupt();
+}
 }
 }
 }
@@ -1360,16 +1378,7 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
 @Override
 public void preClose(ObserverContext c, 
boolean abortRequested)
 throws IOException {
-synchronized (lock) {
-isRegionClosingOrSplitting = 

[2/2] phoenix git commit: PHOENIX-5029 Increase parallelism of tests to decrease test time

2018-11-17 Thread jamestaylor
PHOENIX-5029 Increase parallelism of tests to decrease test time


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

Branch: refs/heads/master
Commit: 956755fabddd335101221cb52cf4fd19c845d3e1
Parents: 39b5fe9
Author: James Taylor 
Authored: Sat Nov 17 15:18:39 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:36:57 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/956755fa/pom.xml
--
diff --git a/pom.xml b/pom.xml
index bfd80e1..16ec530 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,7 @@
 
 
 8
-4
+7
 false
 false
 



[1/2] phoenix git commit: PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery timeouts

2018-11-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master d128553c8 -> 956755fab


PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery 
timeouts


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

Branch: refs/heads/master
Commit: 39b5fe99fb28add8def94f09dffc1507ff5abce1
Parents: d128553
Author: James Taylor 
Authored: Sat Nov 17 15:13:59 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:36:50 2018 -0800

--
 .../end2end/ConnectionQueryServicesTestImpl.java   |  4 +++-
 .../transaction/OmidTransactionProvider.java   |  2 +-
 .../transaction/PhoenixTransactionProvider.java|  2 +-
 .../transaction/TephraTransactionProvider.java | 17 ++---
 .../phoenix/query/QueryServicesTestImpl.java   |  3 ---
 5 files changed, 15 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/39b5fe99/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import 
org.apache.phoenix.transaction.PhoenixTransactionService;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
 import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 public synchronized PhoenixTransactionClient 
initTransactionClient(Provider provider) throws SQLException {
 PhoenixTransactionService txService = txServices[provider.ordinal()];
 if (txService == null) {
-txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+int port = TestUtil.getRandomPort();
+txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo, 
port);
 }
 return super.initTransactionClient(provider);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/39b5fe99/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c53215c..bace2bc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -72,7 +72,7 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 @Override
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
+public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo, int port) throws  SQLException{
 return new OmidTransactionService();
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/39b5fe99/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
index b7f660e..3af554b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
@@ -50,7 +50,7 @@ public interface PhoenixTransactionProvider {
 public PhoenixTransactionContext getTransactionContext(PhoenixConnection 
connection) throws SQLException;
 
 public PhoenixTransactionClient getTransactionClient(Configuration config, 
ConnectionInfo connectionInfo) throws SQLException;
-public PhoenixTransactionService 

[2/2] phoenix git commit: PHOENIX-5029 Increase parallelism of tests to decrease test time

2018-11-17 Thread jamestaylor
PHOENIX-5029 Increase parallelism of tests to decrease test time


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

Branch: refs/heads/4.x-HBase-1.4
Commit: c3553d464766be0454d7a290e3928de071772ad1
Parents: 4921b1c
Author: James Taylor 
Authored: Sat Nov 17 15:18:39 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:32:22 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c3553d46/pom.xml
--
diff --git a/pom.xml b/pom.xml
index b1d8b32..0f0b4f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,7 @@
 
 
 8
-4
+7
 false
 false
 



[1/2] phoenix git commit: PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery timeouts

2018-11-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.4 9a6abc299 -> c3553d464


PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery 
timeouts


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

Branch: refs/heads/4.x-HBase-1.4
Commit: 4921b1cddbc497d07390b5d6f7c34f62e2520494
Parents: 9a6abc2
Author: James Taylor 
Authored: Sat Nov 17 15:13:59 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:32:09 2018 -0800

--
 .../end2end/ConnectionQueryServicesTestImpl.java   |  4 +++-
 .../transaction/OmidTransactionProvider.java   |  2 +-
 .../transaction/PhoenixTransactionProvider.java|  2 +-
 .../transaction/TephraTransactionProvider.java | 17 ++---
 .../phoenix/query/QueryServicesTestImpl.java   |  3 ---
 5 files changed, 15 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4921b1cd/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import 
org.apache.phoenix.transaction.PhoenixTransactionService;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
 import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 public synchronized PhoenixTransactionClient 
initTransactionClient(Provider provider) throws SQLException {
 PhoenixTransactionService txService = txServices[provider.ordinal()];
 if (txService == null) {
-txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+int port = TestUtil.getRandomPort();
+txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo, 
port);
 }
 return super.initTransactionClient(provider);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4921b1cd/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c53215c..bace2bc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -72,7 +72,7 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 @Override
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
+public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo, int port) throws  SQLException{
 return new OmidTransactionService();
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4921b1cd/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
index b7f660e..3af554b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
@@ -50,7 +50,7 @@ public interface PhoenixTransactionProvider {
 public PhoenixTransactionContext getTransactionContext(PhoenixConnection 
connection) throws SQLException;
 
 public PhoenixTransactionClient getTransactionClient(Configuration config, 
ConnectionInfo connectionInfo) throws SQLException;
-public 

[2/2] phoenix git commit: PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery timeouts

2018-11-17 Thread jamestaylor
PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery 
timeouts


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

Branch: refs/heads/4.x-HBase-1.2
Commit: e07226b3e9d6ffecdb33acd4955fd51ea4322dd7
Parents: 8a46d00
Author: James Taylor 
Authored: Sat Nov 17 15:13:59 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:27:26 2018 -0800

--
 .../end2end/ConnectionQueryServicesTestImpl.java   |  4 +++-
 .../transaction/OmidTransactionProvider.java   |  2 +-
 .../transaction/PhoenixTransactionProvider.java|  2 +-
 .../transaction/TephraTransactionProvider.java | 17 ++---
 .../phoenix/query/QueryServicesTestImpl.java   |  3 ---
 5 files changed, 15 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import 
org.apache.phoenix.transaction.PhoenixTransactionService;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
 import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 public synchronized PhoenixTransactionClient 
initTransactionClient(Provider provider) throws SQLException {
 PhoenixTransactionService txService = txServices[provider.ordinal()];
 if (txService == null) {
-txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+int port = TestUtil.getRandomPort();
+txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo, 
port);
 }
 return super.initTransactionClient(provider);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c53215c..bace2bc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -72,7 +72,7 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 @Override
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
+public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo, int port) throws  SQLException{
 return new OmidTransactionService();
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
index b7f660e..3af554b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
@@ -50,7 +50,7 @@ public interface PhoenixTransactionProvider {
 public PhoenixTransactionContext getTransactionContext(PhoenixConnection 
connection) throws SQLException;
 
 public PhoenixTransactionClient getTransactionClient(Configuration config, 
ConnectionInfo connectionInfo) throws SQLException;
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) 

[1/2] phoenix git commit: PHOENIX-5029 Increase parallelism of tests to decrease test time

2018-11-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 8a46d00f2 -> bb3f476c1


PHOENIX-5029 Increase parallelism of tests to decrease test time


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

Branch: refs/heads/4.x-HBase-1.2
Commit: bb3f476c1b152d5d77ac7168f9524ab80e7705fe
Parents: e07226b
Author: James Taylor 
Authored: Sat Nov 17 15:18:39 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:27:26 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bb3f476c/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 0eaffc5..9456fc3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,7 @@
 
 
 8
-4
+7
 false
 false
 



phoenix git commit: PHOENIX-5029 Increase parallelism of tests to decrease test time

2018-11-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 5871b3960 -> 727f41519


PHOENIX-5029 Increase parallelism of tests to decrease test time


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 727f4151900933ebd1989edd934c599230a8464f
Parents: 5871b39
Author: James Taylor 
Authored: Sat Nov 17 15:18:39 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:18:39 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/727f4151/pom.xml
--
diff --git a/pom.xml b/pom.xml
index eba69a9..f2c2f20 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,7 @@
 
 
 8
-4
+7
 false
 false
 



phoenix git commit: PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery timeouts

2018-11-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 b6d0ecb2d -> 5871b3960


PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery 
timeouts


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 5871b3960012894f8c3eafb62c101da731dc1b24
Parents: b6d0ecb
Author: James Taylor 
Authored: Sat Nov 17 15:13:59 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 17 15:13:59 2018 -0800

--
 .../end2end/ConnectionQueryServicesTestImpl.java   |  4 +++-
 .../transaction/OmidTransactionProvider.java   |  2 +-
 .../transaction/PhoenixTransactionProvider.java|  2 +-
 .../transaction/TephraTransactionProvider.java | 17 ++---
 .../phoenix/query/QueryServicesTestImpl.java   |  3 ---
 5 files changed, 15 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5871b396/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import 
org.apache.phoenix.transaction.PhoenixTransactionService;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
 import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 public synchronized PhoenixTransactionClient 
initTransactionClient(Provider provider) throws SQLException {
 PhoenixTransactionService txService = txServices[provider.ordinal()];
 if (txService == null) {
-txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+int port = TestUtil.getRandomPort();
+txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo, 
port);
 }
 return super.initTransactionClient(provider);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5871b396/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c53215c..bace2bc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -72,7 +72,7 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 @Override
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
+public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo, int port) throws  SQLException{
 return new OmidTransactionService();
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5871b396/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
index b7f660e..3af554b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
@@ -50,7 +50,7 @@ public interface PhoenixTransactionProvider {
 public PhoenixTransactionContext getTransactionContext(PhoenixConnection 
connection) throws SQLException;
 
 public PhoenixTransactionClient getTransactionClient(Configuration config, 
ConnectionInfo connectionInfo) throws SQLException;
-public 

[2/2] phoenix git commit: Get random port later

2018-11-16 Thread jamestaylor
Get random port later


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

Branch: refs/heads/omid2
Commit: e02b3a27880a8edf512f8db803666fcb599e245b
Parents: 1c21103
Author: James Taylor 
Authored: Fri Nov 16 07:50:41 2018 -0800
Committer: James Taylor 
Committed: Fri Nov 16 07:50:41 2018 -0800

--
 .../end2end/ConnectionQueryServicesTestImpl.java  |  4 +++-
 .../phoenix/transaction/OmidTransactionProvider.java  | 11 +--
 .../transaction/PhoenixTransactionProvider.java   |  2 +-
 .../transaction/TephraTransactionProvider.java|  3 ++-
 .../java/org/apache/phoenix/util/TransactionUtil.java | 14 --
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  3 +--
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 ++
 7 files changed, 22 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e02b3a27/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import 
org.apache.phoenix.transaction.PhoenixTransactionService;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
 import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 public synchronized PhoenixTransactionClient 
initTransactionClient(Provider provider) throws SQLException {
 PhoenixTransactionService txService = txServices[provider.ordinal()];
 if (txService == null) {
-txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+int port = TestUtil.getRandomPort();
+txService = txServices[provider.ordinal()] = 
provider.getTransactionProvider().getTransactionService(config, connectionInfo, 
port);
 }
 return super.initTransactionClient(provider);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e02b3a27/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c4769b7..1646a92 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -120,19 +120,10 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 @Override
-public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
+public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo, int port) throws  SQLException{
 TSOServerConfig tsoConfig = new TSOServerConfig();
 TSOServer tso;
 
-int port;
-String portStr = config.get(OMID_TSO_PORT);
-if (portStr == null) {
-// setup default test configs for Omid
-port = TransactionUtil.getRandomPort();
-} else {
-port = Integer.parseInt(portStr);
-}
-
 tsoConfig.setPort(port);
 tsoConfig.setConflictMapSize(config.getInt(OMID_TSO_CONFLICT_MAP_SIZE, 
DEFAULT_OMID_TSO_CONFLICT_MAP_SIZE));
 tsoConfig.setTimestampType(config.get(OMID_TSO_TIMESTAMP_TYPE, 
DEFAULT_OMID_TSO_TIMESTAMP_TYPE));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e02b3a27/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
 

[1/2] phoenix git commit: Increase Tephra timeouts for discovery failure

2018-11-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 acaa07012 -> e02b3a278


Increase Tephra timeouts for discovery failure


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

Branch: refs/heads/omid2
Commit: 1c211038937541e3f25ba42a40ab3a2c27a7c04e
Parents: acaa070
Author: James Taylor 
Authored: Fri Nov 16 07:35:54 2018 -0800
Committer: James Taylor 
Committed: Fri Nov 16 07:35:54 2018 -0800

--
 .../transaction/TephraTransactionProvider.java| 14 --
 pom.xml   |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1c211038/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
index 70937cf..060aaf4 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
@@ -89,16 +89,17 @@ public class TephraTransactionProvider implements 
PhoenixTransactionProvider {
 }
 
 int timeOut = config.getInt(HConstants.ZK_SESSION_TIMEOUT, 
HConstants.DEFAULT_ZK_SESSION_TIMEOUT);
+int retryTimeOut = 
config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, 
+
TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC);
 // Create instance of the tephra zookeeper client
 ZKClientService zkClientService  = ZKClientServices.delegate(
 ZKClients.reWatchOnExpire(
 ZKClients.retryOnFailure(
  new TephraZKClientService(zkQuorumServersString, timeOut, 
null,
  ArrayListMultimap.create()), 
- RetryStrategies.exponentialDelay(500, 2000, 
TimeUnit.MILLISECONDS))
+ RetryStrategies.exponentialDelay(500, retryTimeOut, 
TimeUnit.MILLISECONDS))
  )
 );
-//txZKClientService.startAndWait();
 ZKDiscoveryService zkDiscoveryService = new 
ZKDiscoveryService(zkClientService);
 PooledClientProvider pooledClientProvider = new PooledClientProvider(
 config, zkDiscoveryService);
@@ -111,6 +112,8 @@ public class TephraTransactionProvider implements 
PhoenixTransactionProvider {
 
 @Override
 public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connInfo) {
+int retryTimeOut = 
config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, 
+
TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC);
 ZKClientService zkClient = ZKClientServices.delegate(
   ZKClients.reWatchOnExpire(
 ZKClients.retryOnFailure(
@@ -118,17 +121,16 @@ public class TephraTransactionProvider implements 
PhoenixTransactionProvider {
 .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT,
 HConstants.DEFAULT_ZK_SESSION_TIMEOUT))
 .build(),
-  RetryStrategies.exponentialDelay(500, 2000, 
TimeUnit.MILLISECONDS)
+  RetryStrategies.exponentialDelay(500, retryTimeOut, 
TimeUnit.MILLISECONDS)
 )
   )
 );
 
-//zkClient.startAndWait();
 DiscoveryService discovery = new ZKDiscoveryService(zkClient);
-TransactionManager txManager = new TransactionManager(config, new 
HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new 
TxMetricsCollector()), new TxMetricsCollector());
+TransactionManager txManager = new TransactionManager(config, new 
HDFSTransactionStateStorage(config, 
+new SnapshotCodecProvider(config), new TxMetricsCollector()), 
new TxMetricsCollector());
 TransactionService txService = new TransactionService(config, 
zkClient, discovery, Providers.of(txManager));
 TephraTransactionService service = new 
TephraTransactionService(zkClient, txService);
-//txService.startAndWait();
 service.start();
 return service;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1c211038/pom.xml
--
diff --git a/pom.xml b/pom.xml
index b2d2c64..d713dd9 100644
--- a/pom.xml
+++ b/pom.xml

phoenix git commit: Bind port later and immediately before use for Omid

2018-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 960527661 -> acaa07012


Bind port later and immediately before use for Omid


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

Branch: refs/heads/omid2
Commit: acaa07012baeeaf742362f400ea1724ea3d26030
Parents: 9605276
Author: James Taylor 
Authored: Thu Nov 15 21:22:31 2018 -0800
Committer: James Taylor 
Committed: Thu Nov 15 21:22:31 2018 -0800

--
 .../phoenix/transaction/OmidTransactionProvider.java  |  8 ++--
 .../java/org/apache/phoenix/util/TransactionUtil.java | 14 ++
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  7 ++-
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 --
 pom.xml   |  2 +-
 5 files changed, 23 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/acaa0701/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index 610a5d1..c4769b7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -41,6 +41,7 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
+import org.apache.phoenix.util.TransactionUtil;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
@@ -123,11 +124,14 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 TSOServerConfig tsoConfig = new TSOServerConfig();
 TSOServer tso;
 
+int port;
 String portStr = config.get(OMID_TSO_PORT);
 if (portStr == null) {
-throw new IllegalArgumentException(OMID_TSO_PORT + " config 
parameter must be bound");
+// setup default test configs for Omid
+port = TransactionUtil.getRandomPort();
+} else {
+port = Integer.parseInt(portStr);
 }
-int  port = Integer.parseInt(portStr);
 
 tsoConfig.setPort(port);
 tsoConfig.setConflictMapSize(config.getInt(OMID_TSO_CONFLICT_MAP_SIZE, 
DEFAULT_OMID_TSO_CONFLICT_MAP_SIZE));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/acaa0701/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
index dee02d1..9a352c0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
@@ -18,6 +18,7 @@
 package org.apache.phoenix.util;
 
 import java.io.IOException;
+import java.net.ServerSocket;
 import java.sql.SQLException;
 import java.util.List;
 import java.util.Map;
@@ -152,4 +153,17 @@ public class TransactionUtil {
 }
 return mutation;
}
+
+/**
+ * Find a random free port in localhost for binding.
+ * @return A port number or -1 for failure.
+ */
+public static int getRandomPort() {
+try (ServerSocket socket = new ServerSocket(0)) {
+socket.setReuseAddress(true);
+return socket.getLocalPort();
+} catch (IOException e) {
+return -1;
+}
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/acaa0701/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 49fb8e8..db9a8c9 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -22,10 +22,9 @@ import static 
org.apache.phoenix.query.QueryServicesOptions.withDefaults;
 
 import org.apache.curator.shaded.com.google.common.io.Files;
 import 

phoenix git commit: Revert back to only 4 parallel unit tests to help with bind exception

2018-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 0554db29b -> 960527661


Revert back to only 4 parallel unit tests to help with bind exception


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

Branch: refs/heads/omid2
Commit: 9605276612caa9e0e489ca5cfa418aa36fa9a576
Parents: 0554db2
Author: James Taylor 
Authored: Thu Nov 15 19:27:59 2018 -0800
Committer: James Taylor 
Committed: Thu Nov 15 19:27:59 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/96052766/pom.xml
--
diff --git a/pom.xml b/pom.xml
index b2d2c64..8613fe9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -123,7 +123,7 @@
 
 
 4
-8
+4
 false
 false
 



phoenix git commit: Updating omid dependency to 1.0.0 and increasing parallelism back to previous level

2018-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 ddf73283c -> 0554db29b


Updating omid dependency to 1.0.0 and increasing parallelism back to previous 
level


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

Branch: refs/heads/omid2
Commit: 0554db29b1be2e344a8bfbc9413635d1642c225a
Parents: ddf7328
Author: James Taylor 
Authored: Thu Nov 15 11:48:40 2018 -0800
Committer: James Taylor 
Committed: Thu Nov 15 11:48:40 2018 -0800

--
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0554db29/pom.xml
--
diff --git a/pom.xml b/pom.xml
index fadc6bc..b2d2c64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,7 +101,7 @@
 1.12.0
 8.1.7.v20120910
 0.15.0-incubating
-1.0.0.0
+1.0.0
 2.3.2
 2.11.8
 2.11
@@ -123,7 +123,7 @@
 
 
 4
-4
+8
 false
 false
 



[3/6] phoenix git commit: PHOENIX-5008: CQSI.init should not bubble up RetriableUpgradeException to client in case of an UpgradeRequiredException

2018-11-14 Thread jamestaylor
PHOENIX-5008: CQSI.init should not bubble up RetriableUpgradeException to 
client in case of an UpgradeRequiredException


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

Branch: refs/heads/omid2
Commit: b2230b4f4bd7e8c2e9fd83e3fceb07a307521c9e
Parents: c7a4009
Author: Chinmay Kulkarni 
Authored: Fri Nov 9 19:22:57 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Nov 13 16:42:06 2018 -0800

--
 .../SystemCatalogCreationOnConnectionIT.java| 97 +---
 .../query/ConnectionQueryServicesImpl.java  |  4 +-
 2 files changed, 84 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b2230b4f/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
index a1685c44..eadd391 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
@@ -21,9 +21,11 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.apache.phoenix.query.BaseTest.generateUniqueName;
 
 import java.io.IOException;
 import java.sql.Connection;
+import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -42,6 +44,7 @@ import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.UpgradeRequiredException;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDriver;
 import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver;
 import org.apache.phoenix.jdbc.PhoenixTestDriver;
 import org.apache.phoenix.query.ConnectionQueryServices;
@@ -69,6 +72,12 @@ public class SystemCatalogCreationOnConnectionIT {
 private static final String PHOENIX_SYSTEM_CATALOG = "SYSTEM.CATALOG";
 private static final String EXECUTE_UPGRADE_COMMAND = "EXECUTE UPGRADE";
 private static final String MODIFIED_MAX_VERSIONS ="5";
+private static final String CREATE_TABLE_STMT = "CREATE TABLE %s"
++ " (k1 VARCHAR NOT NULL, k2 VARCHAR, CONSTRAINT PK PRIMARY 
KEY(K1,K2))";
+private static final String SELECT_STMT = "SELECT * FROM %s";
+private static final String DELETE_STMT = "DELETE FROM %s";
+private static final String CREATE_INDEX_STMT = "CREATE INDEX DUMMY_IDX ON 
%s (K1) INCLUDE (K2)";
+private static final String UPSERT_STMT = "UPSERT INTO %s VALUES ('A', 
'B')";
 
 private static final Set PHOENIX_SYSTEM_TABLES = new 
HashSet<>(Arrays.asList(
   "SYSTEM.CATALOG", "SYSTEM.SEQUENCE", "SYSTEM.STATS", "SYSTEM.FUNCTION",
@@ -167,12 +176,8 @@ public class SystemCatalogCreationOnConnectionIT {
 UpgradeUtil.doNotUpgradeOnFirstConnection(propsDoNotUpgradePropSet);
 SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver 
driver =
   new 
SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
-try {
-driver.getConnectionQueryServices(getJdbcUrl(), 
propsDoNotUpgradePropSet);
-fail("Client should not be able to create SYSTEM.CATALOG since we 
set the doNotUpgrade property");
-} catch (Exception e) {
-assertTrue(e instanceof UpgradeRequiredException);
-}
+
+driver.getConnectionQueryServices(getJdbcUrl(), 
propsDoNotUpgradePropSet);
 hbaseTables = getHBaseTables();
 assertFalse(hbaseTables.contains(PHOENIX_SYSTEM_CATALOG) || 
hbaseTables.contains(PHOENIX_NAMESPACE_MAPPED_SYSTEM_CATALOG));
 assertTrue(hbaseTables.size() == 0);
@@ -428,6 +433,70 @@ public class SystemCatalogCreationOnConnectionIT {
 assertEquals(Integer.parseInt(MODIFIED_MAX_VERSIONS), 
verifyModificationTableMetadata(driver, PHOENIX_SYSTEM_CATALOG));
 }
 
+// Test the case when an end-user uses the vanilla PhoenixDriver to create 
a connection and a
+// requirement for upgrade is detected. In this case, the user should get 
a connection on which
+// they are only able to run "EXECUTE UPGRADE"
+@Test
+public void testExecuteUpgradeSameConnWithPhoenixDriver() throws Exception 
{
+// Register the 

[6/6] phoenix git commit: Set pom to point to 1.0.0.0 version of omid

2018-11-14 Thread jamestaylor
Set pom to point to 1.0.0.0 version of omid


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

Branch: refs/heads/omid2
Commit: ddf73283c1894faa5b4fcac3f84fc83093990292
Parents: 5bdf80d
Author: James Taylor 
Authored: Wed Nov 14 22:56:07 2018 -0800
Committer: James Taylor 
Committed: Wed Nov 14 22:56:07 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ddf73283/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 8049967..fadc6bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,7 +101,7 @@
 1.12.0
 8.1.7.v20120910
 0.15.0-incubating
-0.9.1.0-SNAPSHOT
+1.0.0.0
 2.3.2
 2.11.8
 2.11



[2/6] phoenix git commit: PHOENIX-5017 Fix testRecreateViewWhoseParentWasDropped test flapper

2018-11-14 Thread jamestaylor
PHOENIX-5017 Fix testRecreateViewWhoseParentWasDropped test flapper


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

Branch: refs/heads/omid2
Commit: c7a400933c25de8324b19f085ea267e0ff11e5a2
Parents: 8cd7898
Author: Thomas D'Silva 
Authored: Tue Nov 13 15:42:19 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Nov 13 15:43:45 2018 -0800

--
 .../phoenix/coprocessor/MetaDataEndpointImpl.java   | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c7a40093/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index d899e32..5562340 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -2035,8 +2035,7 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 }
 }
 
-// check if the table was dropped, but had child views that were 
have not yet
-// been cleaned up by compaction
+// check if the table was dropped, but had child views that were 
have not yet been cleaned up
 if 
(!Bytes.toString(schemaName).equals(QueryConstants.SYSTEM_SCHEMA_NAME)) {
 dropChildViews(env, tenantIdBytes, schemaName, tableName);
 }
@@ -2434,8 +2433,13 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 MetaDataClient client = new MetaDataClient(connection);
 org.apache.phoenix.parse.TableName viewTableName = 
org.apache.phoenix.parse.TableName
 .create(Bytes.toString(viewSchemaName), 
Bytes.toString(viewName));
-client.dropTable(
-new DropTableStatement(viewTableName, 
PTableType.VIEW, false, true, true));
+try {
+client.dropTable(
+new DropTableStatement(viewTableName, 
PTableType.VIEW, false, true, true));
+}
+catch (TableNotFoundException e) {
+logger.info("Ignoring view "+viewTableName+" as it has 
already been dropped");
+}
 }
 }
 }



[1/6] phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-14 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 28b9dd576 -> ddf73283c


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


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

Branch: refs/heads/omid2
Commit: 8cd7898a1acf1368a05a2e893253cecc53416080
Parents: 169270d
Author: Ankit Singhal 
Authored: Tue Nov 13 11:39:58 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:39:58 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8cd7898a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



[5/6] phoenix git commit: Merge branch '4.x-HBase-1.3' into omid2

2018-11-14 Thread jamestaylor
Merge branch '4.x-HBase-1.3' into omid2


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

Branch: refs/heads/omid2
Commit: 5bdf80d32778cf4b4896cd2feb5fb6c7ab854a65
Parents: 28b9dd5 7b038fb
Author: James Taylor 
Authored: Wed Nov 14 22:34:30 2018 -0800
Committer: James Taylor 
Committed: Wed Nov 14 22:34:30 2018 -0800

--
 .../SystemCatalogCreationOnConnectionIT.java| 95 +---
 .../coprocessor/MetaDataEndpointImpl.java   | 12 ++-
 .../query/ConnectionQueryServicesImpl.java  |  4 +-
 .../apache/phoenix/query/GuidePostsCache.java   | 18 +++-
 4 files changed, 108 insertions(+), 21 deletions(-)
--




[4/6] phoenix git commit: PHOENIX-5008 (Addendum): CQSI.init should not bubble up RetriableUpgradeException to client in case of an UpgradeRequiredException

2018-11-14 Thread jamestaylor
PHOENIX-5008 (Addendum): CQSI.init should not bubble up 
RetriableUpgradeException to client in case of an UpgradeRequiredException


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

Branch: refs/heads/omid2
Commit: 7b038fba542173a91a7b919651ff067e1acc4fdf
Parents: b2230b4
Author: Chinmay Kulkarni 
Authored: Tue Nov 13 17:11:53 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Nov 13 17:27:28 2018 -0800

--
 .../phoenix/end2end/SystemCatalogCreationOnConnectionIT.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b038fba/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
index eadd391..7a5f80c 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
@@ -504,7 +504,7 @@ public class SystemCatalogCreationOnConnectionIT {
  */
 private Set getHBaseTables() throws IOException {
 Set tables = new HashSet<>();
-for (TableName tn : testUtil.getAdmin().listTableNames()) {
+for (TableName tn : testUtil.getHBaseAdmin().listTableNames()) {
 tables.add(tn.getNameAsString());
 }
 return tables;



phoenix git commit: Move to newer version of spark to match head of 4.x-HBase-1.3

2018-11-13 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 d03eadc23 -> 28b9dd576


Move to newer version of spark to match head of 4.x-HBase-1.3


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

Branch: refs/heads/omid2
Commit: 28b9dd576344ad2ff9b4a06363a49049f3edceb2
Parents: d03eadc
Author: James Taylor 
Authored: Tue Nov 13 11:42:34 2018 -0800
Committer: James Taylor 
Committed: Tue Nov 13 11:42:34 2018 -0800

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/28b9dd57/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 27854ff..8049967 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,7 +102,7 @@
 8.1.7.v20120910
 0.15.0-incubating
 0.9.1.0-SNAPSHOT
-2.0.2
+2.3.2
 2.11.8
 2.11
 2.9.5



[18/22] phoenix git commit: Revert "PHOENIX-4971 Drop index will execute successfully using Incorrect name of parent tables"

2018-11-10 Thread jamestaylor
Revert "PHOENIX-4971 Drop index will execute successfully using Incorrect name 
of parent tables"

This reverts commit 527098ed621d62ba18fc19099ec67d8b29e027f4.


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

Branch: refs/heads/omid2
Commit: fd7ae94065ae33f1bb20bca60b7756595f8b10b9
Parents: d6083ae
Author: Thomas D'Silva 
Authored: Wed Nov 7 11:10:05 2018 -0800
Committer: Thomas D'Silva 
Committed: Wed Nov 7 11:10:05 2018 -0800

--
 .../phoenix/end2end/index/DropMetadataIT.java   | 23 +---
 .../phoenix/exception/SQLExceptionCode.java |  2 --
 .../apache/phoenix/schema/MetaDataClient.java   | 15 -
 3 files changed, 1 insertion(+), 39 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd7ae940/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
index 3c670c5..b92ed8d 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
@@ -18,12 +18,9 @@
 package org.apache.phoenix.end2end.index;
 
 import static org.apache.phoenix.util.TestUtil.HBASE_NATIVE_SCHEMA_NAME;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
-import java.sql.SQLException;
 import java.util.Properties;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -32,7 +29,6 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
-import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -60,24 +56,7 @@ public class DropMetadataIT extends ParallelStatsDisabledIT {
 String url = QueryUtil.getConnectionUrl(props, config, PRINCIPAL);
 return DriverManager.getConnection(url, props);
 }
-
-@Test
-public void testDropIndexTableHasSameNameWithDataTable() {
-String tableName = generateUniqueName();
-String indexName = "IDX_" + tableName;
-try (Connection conn = DriverManager.getConnection(getUrl())) {
-String createTable = "CREATE TABLE " + tableName + "  (id varchar 
not null primary key, col integer)";
-conn.createStatement().execute(createTable);
-String createIndex = "CREATE INDEX " + indexName + " on " + 
tableName + "(col)";
-conn.createStatement().execute(createIndex);
-String dropIndex = "DROP INDEX " + indexName + " on " + indexName;
-conn.createStatement().execute(dropIndex);
-fail("should not execute successfully");
-} catch (SQLException e) {
-assertTrue(SQLExceptionCode.PARENT_TABLE_NOT_FOUND.getErrorCode() 
== e.getErrorCode());
-}
-}
-
+
 @Test
 public void testDropViewKeepsHTable() throws Exception {
 Connection conn = getConnection();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd7ae940/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
index 5bffed5..d557714 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
@@ -185,8 +185,6 @@ public enum SQLExceptionCode {
  INVALID_REPLAY_AT(533, "42910", "Value of REPLAY_AT cannot be less than 
zero."),
  UNEQUAL_SCN_AND_BUILD_INDEX_AT(534, "42911", "If both specified, values 
of CURRENT_SCN and BUILD_INDEX_AT must be equal."),
  ONLY_INDEX_UPDATABLE_AT_SCN(535, "42912", "Only an index may be updated 
when the BUILD_INDEX_AT property is specified"),
- PARENT_TABLE_NOT_FOUND(536, "42913", "Can't drop the index because the 
parent table in the DROP statement is incorrect."),
-
  /**
  * HBase and Phoenix specific implementation defined sub-classes.
  * Column family related exceptions.


[19/22] phoenix git commit: PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled

2018-11-10 Thread jamestaylor
PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled


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

Branch: refs/heads/omid2
Commit: d1efd665fa84f611e1ad544ed0859f1fecb4f616
Parents: fd7ae94
Author: James Taylor 
Authored: Sat Nov 10 11:04:48 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:04:48 2018 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java  | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d1efd665/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index c99f145..e096bb5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -58,7 +58,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -67,8 +66,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-@Category(NeedsOwnMiniClusterTest.class)
-public class IndexToolIT extends ParallelStatsEnabledIT {
+public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
 
 private final boolean localIndex;
 private final boolean transactional;
@@ -99,9 +97,13 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 @BeforeClass
 public static void setup() throws Exception {
 Map serverProps = Maps.newHashMapWithExpectedSize(2);
+serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Long.toString(20));
+
serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, 
Long.toString(5));
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(2);
+clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, 
Boolean.toString(true));
+clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, 
Long.toString(5));
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
 clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.TRUE.toString());
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),



[02/22] phoenix git commit: PHOENIX-4764 Cleanup metadata of child views for a base table that has been dropped

2018-11-10 Thread jamestaylor
PHOENIX-4764 Cleanup metadata of child views for a base table that has been 
dropped


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

Branch: refs/heads/omid2
Commit: 3903ad768496d0a6517298a8f196863b87290e72
Parents: a48e42e
Author: Kadir 
Authored: Wed Sep 26 23:32:31 2018 -0700
Committer: Karan Mehta 
Committed: Fri Oct 26 14:40:48 2018 -0700

--
 .../phoenix/end2end/BasePermissionsIT.java  |   4 +-
 .../phoenix/end2end/DropTableWithViewsIT.java   | 151 ++
 .../end2end/QueryDatabaseMetaDataIT.java|   4 +
 .../end2end/TenantSpecificTablesDDLIT.java  |   4 +-
 .../coprocessor/MetaDataEndpointImpl.java   |  46 ++-
 .../phoenix/coprocessor/TaskRegionObserver.java | 292 +++
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |   9 +-
 .../query/ConnectionQueryServicesImpl.java  |  20 +-
 .../query/ConnectionlessQueryServicesImpl.java  |   9 +
 .../apache/phoenix/query/QueryConstants.java|  17 +-
 .../org/apache/phoenix/query/QueryServices.java |   6 +
 .../phoenix/query/QueryServicesOptions.java |   4 +
 .../java/org/apache/phoenix/schema/PTable.java  |  31 +-
 .../phoenix/schema/stats/StatisticsUtil.java|   2 +
 .../org/apache/phoenix/util/SchemaUtil.java |  10 +
 .../java/org/apache/phoenix/query/BaseTest.java |   1 +
 16 files changed, 589 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3903ad76/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
index 88a942e..932ce9f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
@@ -428,7 +428,7 @@ public class BasePermissionsIT extends BaseTest {
 @Override
 public Object run() throws Exception {
 try (Connection conn = getConnection(); Statement stmt = 
conn.createStatement();) {
-assertFalse(stmt.execute("DROP TABLE IF EXISTS " + 
tableName));
+assertFalse(stmt.execute(String.format("DROP TABLE IF 
EXISTS %s CASCADE", tableName)));
 }
 return null;
 }
@@ -653,7 +653,7 @@ public class BasePermissionsIT extends BaseTest {
 @Override
 public Object run() throws Exception {
 try (Connection conn = getConnection(); Statement stmt = 
conn.createStatement();) {
-assertFalse(stmt.execute("DROP VIEW " + viewName));
+assertFalse(stmt.execute(String.format("DROP VIEW %s 
CASCADE", viewName)));
 }
 return null;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3903ad76/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java
new file mode 100644
index 000..9502218
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java
@@ -0,0 +1,151 @@
+/*
+ * 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 static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Arrays;
+import 

[05/22] phoenix git commit: PHOENIX-4891: An index should inherit UPDATE_CACHE_FREQUENCY setting rom parent table

2018-11-10 Thread jamestaylor
PHOENIX-4891: An index should inherit UPDATE_CACHE_FREQUENCY setting rom parent 
table


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

Branch: refs/heads/omid2
Commit: 647887947f631d624d6897d729bce3acb07a94bf
Parents: fe466eb
Author: Chinmay Kulkarni 
Authored: Tue Oct 30 14:52:26 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue Oct 30 16:23:42 2018 -0700

--
 .../phoenix/end2end/PropertiesInSyncIT.java | 172 ++-
 .../phoenix/end2end/index/IndexMetadataIT.java  | 145 +++-
 .../org/apache/phoenix/rpc/UpdateCacheIT.java   | 134 ++-
 .../phoenix/exception/SQLExceptionCode.java |   7 +-
 .../query/ConnectionQueryServicesImpl.java  |   6 +-
 .../apache/phoenix/schema/MetaDataClient.java   |  33 +++-
 .../org/apache/phoenix/util/MetaDataUtil.java   |   6 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  79 -
 8 files changed, 476 insertions(+), 106 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/64788794/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertiesInSyncIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertiesInSyncIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertiesInSyncIT.java
index db44735..348b195 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertiesInSyncIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertiesInSyncIT.java
@@ -23,9 +23,12 @@ import org.apache.hadoop.hbase.KeepDeletedCells;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
@@ -33,17 +36,23 @@ import org.junit.Test;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 import static 
org.apache.phoenix.query.QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES;
-import static 
org.apache.phoenix.util.MetaDataUtil.SYNCED_DATA_TABLE_AND_INDEX_PROPERTIES;
+import static 
org.apache.phoenix.util.MetaDataUtil.SYNCED_DATA_TABLE_AND_INDEX_COL_FAM_PROPERTIES;
 import static org.apache.phoenix.util.MetaDataUtil.VIEW_INDEX_TABLE_PREFIX;
+import static 
org.apache.phoenix.util.UpgradeUtil.UPSERT_UPDATE_CACHE_FREQUENCY;
 import static org.apache.phoenix.util.UpgradeUtil.syncTableAndIndexProperties;
+import static 
org.apache.phoenix.util.UpgradeUtil.syncUpdateCacheFreqAllIndexes;
+import static 
org.apache.phoenix.end2end.index.IndexMetadataIT.assertUpdateCacheFreq;
 
 /**
  * Test properties that need to be kept in sync amongst all column families 
and indexes of a table
@@ -56,12 +65,16 @@ public class PropertiesInSyncIT extends 
ParallelStatsDisabledIT {
 private static final int INITIAL_TTL_VALUE = 700;
 private static final KeepDeletedCells INITIAL_KEEP_DELETED_CELLS_VALUE = 
KeepDeletedCells.TRUE;
 private static final int INITIAL_REPLICATION_SCOPE_VALUE = 1;
+private static final int INITIAL_UPDATE_CACHE_FREQUENCY = 100;
+private static final int INITIAL_UPDATE_CACHE_FREQUENCY_VIEWS = 900;
 private static final int MODIFIED_TTL_VALUE = INITIAL_TTL_VALUE + 300;
 private static final KeepDeletedCells MODIFIED_KEEP_DELETED_CELLS_VALUE =
-(INITIAL_KEEP_DELETED_CELLS_VALUE == KeepDeletedCells.TRUE)
-? KeepDeletedCells.FALSE: KeepDeletedCells.TRUE;
+(INITIAL_KEEP_DELETED_CELLS_VALUE == KeepDeletedCells.TRUE) ?
+KeepDeletedCells.FALSE: KeepDeletedCells.TRUE;
 private static final int MODIFIED_REPLICATION_SCOPE_VALUE =
 (INITIAL_REPLICATION_SCOPE_VALUE == 1) ? 0 : 1;
+private static final int MODIFIED_UPDATE_CACHE_FREQUENCY = 
INITIAL_UPDATE_CACHE_FREQUENCY + 300;
+private static final int MODIFIED_UPDATE_CACHE_FREQUENCY_VIEWS = 
INITIAL_UPDATE_CACHE_FREQUENCY_VIEWS + 300;
 
 
 // Test that we disallow specifying synced properties to be set per column 

[17/22] phoenix git commit: PHOENIX-4996: Refactor PTableImpl to use Builder Pattern

2018-11-10 Thread jamestaylor
PHOENIX-4996: Refactor PTableImpl to use Builder Pattern


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

Branch: refs/heads/omid2
Commit: d6083ae5c598f5293adbfb24370b8e40962bc3d7
Parents: 9bfaf18
Author: Chinmay Kulkarni 
Authored: Fri Nov 2 14:00:09 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue Nov 6 15:19:09 2018 -0800

--
 .../apache/phoenix/compile/DeleteCompiler.java  |5 +-
 .../apache/phoenix/compile/FromCompiler.java|   66 +-
 .../apache/phoenix/compile/JoinCompiler.java|   53 +-
 .../compile/TupleProjectionCompiler.java|   60 +-
 .../apache/phoenix/compile/UnionCompiler.java   |   41 +-
 .../apache/phoenix/compile/UpsertCompiler.java  |   12 +-
 .../coprocessor/MetaDataEndpointImpl.java   |   96 +-
 .../UngroupedAggregateRegionObserver.java   |6 +-
 .../coprocessor/WhereConstantParser.java|3 +-
 .../query/ConnectionlessQueryServicesImpl.java  |9 +-
 .../apache/phoenix/schema/MetaDataClient.java   |  215 ++-
 .../apache/phoenix/schema/PMetaDataImpl.java|   28 +-
 .../org/apache/phoenix/schema/PTableImpl.java   | 1259 +++---
 .../org/apache/phoenix/schema/TableRef.java |   17 +-
 .../phoenix/execute/CorrelatePlanTest.java  |   32 +-
 .../execute/LiteralResultIteratorPlanTest.java  |   33 +-
 16 files changed, 1303 insertions(+), 632 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d6083ae5/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
index 583085e..8c9a930 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
@@ -89,7 +89,6 @@ import org.apache.phoenix.schema.types.PLong;
 import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.IndexUtil;
-import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.ScanUtil;
 
 import com.google.common.base.Preconditions;
@@ -615,7 +614,9 @@ public class DeleteCompiler {
 }
 });
 }
-PTable projectedTable = PTableImpl.makePTable(table, 
PTableType.PROJECTED, adjustedProjectedColumns);
+PTable projectedTable = PTableImpl.builderWithColumns(table, 
adjustedProjectedColumns)
+.setType(PTableType.PROJECTED)
+.build();
 final TableRef projectedTableRef = new TableRef(projectedTable, 
targetTableRef.getLowerBoundTimeStamp(), targetTableRef.getTimeStamp());
 
 QueryPlan bestPlanToBe = dataPlan;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d6083ae5/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
index efc66a9..2701af0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
@@ -32,8 +32,6 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MutationCode;
-import org.apache.phoenix.exception.SQLExceptionCode;
-import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.parse.AliasedNode;
@@ -82,6 +80,7 @@ import org.apache.phoenix.schema.PTableImpl;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.schema.ProjectedColumn;
+import org.apache.phoenix.schema.RowKeySchema;
 import org.apache.phoenix.schema.SchemaNotFoundException;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.TableNotFoundException;
@@ -284,7 +283,8 @@ public class FromCompiler {
 column.getTimestamp());
 projectedColumns.add(projectedColumn);
 }
-PTable t = PTableImpl.makePTable(table, projectedColumns);
+PTable t = 

[22/22] phoenix git commit: Remove unnecessary dependencies in assembly

2018-11-10 Thread jamestaylor
Remove unnecessary dependencies in assembly


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

Branch: refs/heads/omid2
Commit: d03eadc23f7da4bcfa36c7add810ff43707e5700
Parents: cf08715
Author: James Taylor 
Authored: Sat Nov 10 12:56:59 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 12:58:32 2018 -0800

--
 phoenix-assembly/pom.xml | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d03eadc2/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 9d3c891..e2543c5 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -127,23 +127,13 @@
   phoenix-queryserver-client
 
 
-  com.google.inject
-  guice
-  3.0
+  org.apache.phoenix
+  phoenix-load-balancer
 
 
   org.apache.omid
   omid-hbase-tools-hbase1.x
   ${omid.version}
 
-
-  org.apache.htrace
-  htrace-core
-  3.2.0-incubating
-
-
-  org.apache.phoenix
-  phoenix-load-balancer
-
   
 



[07/22] phoenix git commit: PHOENIX-4909 Missing the phoenix-loadbalancer module dependency in phoenix-assembly/pom.xml

2018-11-10 Thread jamestaylor
PHOENIX-4909 Missing the phoenix-loadbalancer module dependency in 
phoenix-assembly/pom.xml

Closes #352

Signed-off-by: Josh Elser 


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

Branch: refs/heads/omid2
Commit: fc35ccecc6fa497da506aff48d601657e41d2a70
Parents: c936d81
Author: Vitaliy 
Authored: Wed Sep 19 01:09:01 2018 +0300
Committer: Josh Elser 
Committed: Wed Oct 31 12:20:52 2018 -0400

--
 bin/phoenix_utils.py  | 2 ++
 phoenix-assembly/pom.xml  | 4 
 phoenix-assembly/src/build/components/all-common-jars.xml | 8 
 3 files changed, 14 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc35ccec/bin/phoenix_utils.py
--
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index aa04a5b..98a0896 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -166,6 +166,8 @@ def setPath():
 global phoenix_loadbalancer_jar
 phoenix_loadbalancer_jar = find(PHOENIX_LOADBALANCER_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-loadbalancer", "target", "*"))
 if phoenix_loadbalancer_jar == "":
+phoenix_loadbalancer_jar = 
findFileInPathWithoutRecursion(PHOENIX_LOADBALANCER_JAR_PATTERN, 
os.path.join(current_dir, "..", "lib"))
+if phoenix_loadbalancer_jar == "":
 phoenix_loadbalancer_jar = 
findFileInPathWithoutRecursion(PHOENIX_LOADBALANCER_JAR_PATTERN, 
os.path.join(current_dir, ".."))
 
 global phoenix_traceserver_jar

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc35ccec/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index f11645a..e41d7e6 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -126,5 +126,9 @@
   org.apache.phoenix
   phoenix-queryserver-client
 
+
+  org.apache.phoenix
+  phoenix-load-balancer
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc35ccec/phoenix-assembly/src/build/components/all-common-jars.xml
--
diff --git a/phoenix-assembly/src/build/components/all-common-jars.xml 
b/phoenix-assembly/src/build/components/all-common-jars.xml
index 3d27b26..08ca29a 100644
--- a/phoenix-assembly/src/build/components/all-common-jars.xml
+++ b/phoenix-assembly/src/build/components/all-common-jars.xml
@@ -158,5 +158,13 @@
   
   0644
 
+
+  
${project.basedir}/../phoenix-load-balancer/target/
+  lib
+  
+phoenix-*.jar
+  
+  0644
+
   
 



[11/22] phoenix git commit: PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using phoenix-spark

2018-11-10 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bfaf183/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
index c9168f1..69c9869 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
@@ -37,104 +37,18 @@ import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.junit.Test;
 
-
 /**
  * Tests for table with transparent salting.
  */
 
-public class SaltedTableIT extends ParallelStatsDisabledIT {
-
-   private static String getUniqueTableName() {
-   return SchemaUtil.getTableName(generateUniqueName(), 
generateUniqueName());
-   }
-   
-private static String initTableValues(byte[][] splits) throws Exception {
-   String tableName = getUniqueTableName();
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-Connection conn = DriverManager.getConnection(getUrl(), props);
-
-// Rows we inserted:
-// 1ab123abc111
-// 1abc456abc111
-// 1de123abc111
-// 2abc123def222 
-// 3abc123ghi333
-// 4abc123jkl444
-try {
-// Upsert with no column specifies.
-ensureTableCreated(getUrl(), tableName, TABLE_WITH_SALTING, 
splits, null, null);
-String query = "UPSERT INTO " + tableName + " VALUES(?,?,?,?,?)";
-PreparedStatement stmt = conn.prepareStatement(query);
-stmt.setInt(1, 1);
-stmt.setString(2, "ab");
-stmt.setString(3, "123");
-stmt.setString(4, "abc");
-stmt.setInt(5, 111);
-stmt.execute();
-conn.commit();
-
-stmt.setInt(1, 1);
-stmt.setString(2, "abc");
-stmt.setString(3, "456");
-stmt.setString(4, "abc");
-stmt.setInt(5, 111);
-stmt.execute();
-conn.commit();
-
-// Test upsert when statement explicitly specifies the columns to 
upsert into.
-query = "UPSERT INTO " + tableName +
-" (a_integer, a_string, a_id, b_string, b_integer) " + 
-" VALUES(?,?,?,?,?)";
-stmt = conn.prepareStatement(query);
-
-stmt.setInt(1, 1);
-stmt.setString(2, "de");
-stmt.setString(3, "123");
-stmt.setString(4, "abc");
-stmt.setInt(5, 111);
-stmt.execute();
-conn.commit();
-
-stmt.setInt(1, 2);
-stmt.setString(2, "abc");
-stmt.setString(3, "123");
-stmt.setString(4, "def");
-stmt.setInt(5, 222);
-stmt.execute();
-conn.commit();
-
-// Test upsert when order of column is shuffled.
-query = "UPSERT INTO " + tableName +
-" (a_string, a_integer, a_id, b_string, b_integer) " + 
-" VALUES(?,?,?,?,?)";
-stmt = conn.prepareStatement(query);
-stmt.setString(1, "abc");
-stmt.setInt(2, 3);
-stmt.setString(3, "123");
-stmt.setString(4, "ghi");
-stmt.setInt(5, 333);
-stmt.execute();
-conn.commit();
-
-stmt.setString(1, "abc");
-stmt.setInt(2, 4);
-stmt.setString(3, "123");
-stmt.setString(4, "jkl");
-stmt.setInt(5, 444);
-stmt.execute();
-conn.commit();
-} finally {
-conn.close();
-}
-return tableName;
-}
+public class SaltedTableIT extends BaseSaltedTableIT {
 
 @Test
 public void testTableWithInvalidBucketNumber() throws Exception {
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 Connection conn = DriverManager.getConnection(getUrl(), props);
 try {
-String query = "create table " + getUniqueTableName() + " 
(a_integer integer not null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS 
= 257";
+String query = "create table " + generateUniqueName() + " 
(a_integer integer not null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS 
= 257";
 PreparedStatement stmt = conn.prepareStatement(query);
 stmt.execute();
 fail("Should have caught exception");
@@ -148,370 +62,12 @@ public class SaltedTableIT extends 
ParallelStatsDisabledIT {
 @Test
 public void testTableWithSplit() throws Exception {
 try {
-createTestTable(getUrl(), "create table " + 

[21/22] phoenix git commit: Merge branch '4.x-HBase-1.3' into omid2

2018-11-10 Thread jamestaylor
Merge branch '4.x-HBase-1.3' into omid2


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

Branch: refs/heads/omid2
Commit: cf087158170dbf7c9d18c02bedb76f5ec91d7b23
Parents: 0f2b1b8 169270d
Author: James Taylor 
Authored: Sat Nov 10 12:14:49 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 12:14:49 2018 -0800

--
 bin/phoenix_utils.py|2 +
 phoenix-assembly/pom.xml|4 +
 .../src/build/components/all-common-jars.xml|8 +
 .../org/apache/phoenix/end2end/AggregateIT.java |  987 +-
 .../apache/phoenix/end2end/BaseAggregateIT.java | 1022 ++
 .../apache/phoenix/end2end/BaseOrderByIT.java   |  940 +
 .../phoenix/end2end/BasePermissionsIT.java  |4 +-
 .../phoenix/end2end/CsvBulkLoadToolIT.java  |   51 +
 .../phoenix/end2end/DropTableWithViewsIT.java   |  151 +++
 .../MigrateSystemTablesToSystemNamespaceIT.java |4 +-
 .../org/apache/phoenix/end2end/OrderByIT.java   |  943 ++---
 .../end2end/ParallelStatsDisabledIT.java|   40 +
 .../phoenix/end2end/PropertiesInSyncIT.java |  172 ++-
 .../end2end/QueryDatabaseMetaDataIT.java|4 +
 .../SystemCatalogCreationOnConnectionIT.java|4 +-
 .../end2end/TableSnapshotReadsMapReduceIT.java  |  122 +-
 .../end2end/TenantSpecificTablesDDLIT.java  |4 +-
 .../phoenix/end2end/index/IndexMetadataIT.java  |  145 +-
 .../end2end/salted/BaseSaltedTableIT.java   |  474 +++
 .../phoenix/end2end/salted/SaltedTableIT.java   |  450 +--
 .../monitoring/BasePhoenixMetricsIT.java|4 +-
 .../org/apache/phoenix/rpc/UpdateCacheIT.java   |  134 +-
 .../apache/phoenix/compile/DeleteCompiler.java  |5 +-
 .../apache/phoenix/compile/FromCompiler.java|   66 +-
 .../apache/phoenix/compile/JoinCompiler.java|   53 +-
 .../compile/TupleProjectionCompiler.java|   60 +-
 .../apache/phoenix/compile/UnionCompiler.java   |   41 +-
 .../apache/phoenix/compile/UpsertCompiler.java  |   12 +-
 .../coprocessor/MetaDataEndpointImpl.java   |  142 +-
 .../phoenix/coprocessor/TaskRegionObserver.java |  295 
 .../UngroupedAggregateRegionObserver.java   |6 +-
 .../coprocessor/WhereConstantParser.java|3 +-
 .../phoenix/exception/SQLExceptionCode.java |7 +-
 .../index/write/DelegateIndexFailurePolicy.java |5 +-
 .../index/PhoenixIndexFailurePolicy.java|6 +
 .../iterate/MapReduceParallelScanGrouper.java   |   32 +-
 .../iterate/TableSnapshotResultIterator.java|   28 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |9 +-
 .../mapreduce/FormatToBytesWritableMapper.java  |   10 +-
 .../query/ConnectionQueryServicesImpl.java  |   28 +-
 .../query/ConnectionlessQueryServicesImpl.java  |   18 +-
 .../apache/phoenix/query/QueryConstants.java|   17 +-
 .../org/apache/phoenix/query/QueryServices.java |9 +
 .../phoenix/query/QueryServicesOptions.java |5 +
 .../apache/phoenix/schema/MetaDataClient.java   |  248 +++-
 .../apache/phoenix/schema/PMetaDataImpl.java|   28 +-
 .../java/org/apache/phoenix/schema/PTable.java  |   31 +-
 .../org/apache/phoenix/schema/PTableImpl.java   | 1259 +++---
 .../org/apache/phoenix/schema/TableRef.java |   17 +-
 .../phoenix/schema/stats/StatisticsUtil.java|2 +
 .../org/apache/phoenix/util/MetaDataUtil.java   |6 +-
 .../org/apache/phoenix/util/QueryBuilder.java   |  211 +++
 .../java/org/apache/phoenix/util/QueryUtil.java |   38 +-
 .../org/apache/phoenix/util/SchemaUtil.java |   10 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   79 +-
 .../phoenix/execute/CorrelatePlanTest.java  |   32 +-
 .../execute/LiteralResultIteratorPlanTest.java  |   33 +-
 .../index/IndexScrutinyTableOutputTest.java |6 +-
 .../util/PhoenixConfigurationUtilTest.java  |6 +-
 .../java/org/apache/phoenix/query/BaseTest.java |   15 +-
 .../org/apache/phoenix/util/QueryUtilTest.java  |   10 +-
 phoenix-server/pom.xml  |1 +
 phoenix-spark/pom.xml   |8 +
 .../org/apache/phoenix/spark/AggregateIT.java   |   91 ++
 .../org/apache/phoenix/spark/OrderByIT.java |  460 +++
 .../org/apache/phoenix/spark/SaltedTableIT.java |   53 +
 .../org/apache/phoenix/spark/SparkUtil.java |   87 ++
 .../apache/phoenix/spark/PhoenixSparkIT.scala   |9 +-
 .../apache/phoenix/spark/SparkResultSet.java| 1056 +++
 .../org/apache/phoenix/spark/PhoenixRDD.scala   |   27 +-
 70 files changed, 7235 insertions(+), 3114 deletions(-)
--



[01/22] phoenix git commit: PHOENIX-4977 Make KillServerOnFailurePolicy a configurable option in PhoenixIndexFailurePolicy

2018-11-10 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 0f2b1b8ba -> d03eadc23


PHOENIX-4977 Make KillServerOnFailurePolicy a configurable option in 
PhoenixIndexFailurePolicy


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

Branch: refs/heads/omid2
Commit: a48e42e7f639c8194db84155ce73ca9d4df25d91
Parents: 2ff316a
Author: Vincent Poon 
Authored: Tue Oct 23 16:03:22 2018 -0700
Committer: Vincent Poon 
Committed: Thu Oct 25 12:06:31 2018 -0700

--
 .../phoenix/hbase/index/write/DelegateIndexFailurePolicy.java  | 5 -
 .../org/apache/phoenix/index/PhoenixIndexFailurePolicy.java| 6 ++
 .../src/main/java/org/apache/phoenix/query/QueryServices.java  | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a48e42e7/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
index a7fb7ec..caf2b38 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
@@ -28,7 +28,7 @@ import com.google.common.collect.Multimap;
 
 public class DelegateIndexFailurePolicy implements IndexFailurePolicy {
 
-private final IndexFailurePolicy delegate;
+private IndexFailurePolicy delegate;
 
 public DelegateIndexFailurePolicy(IndexFailurePolicy delegate) {
 this.delegate = delegate;
@@ -55,4 +55,7 @@ public class DelegateIndexFailurePolicy implements 
IndexFailurePolicy {
 delegate.stop(arg0);
 }
 
+public void setDelegate(IndexFailurePolicy delegate) {
+this.delegate = delegate;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a48e42e7/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
index 4c2013b..f0af6f6 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
@@ -60,6 +60,7 @@ import 
org.apache.phoenix.hbase.index.table.HTableInterfaceReference;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.hbase.index.write.DelegateIndexFailurePolicy;
 import org.apache.phoenix.hbase.index.write.KillServerOnFailurePolicy;
+import org.apache.phoenix.hbase.index.write.LeaveIndexActiveFailurePolicy;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.query.QueryServices;
@@ -133,6 +134,11 @@ public class PhoenixIndexFailurePolicy extends 
DelegateIndexFailurePolicy {
 } else {
throwIndexWriteFailure = Boolean.parseBoolean(value);
 }
+
+boolean killServer = 
env.getConfiguration().getBoolean(QueryServices.INDEX_FAILURE_KILL_SERVER, 
true);
+if (!killServer) {
+setDelegate(new LeaveIndexActiveFailurePolicy());
+} // else, default in constructor is KillServerOnFailurePolicy
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a48e42e7/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index d3c8dc0..337bb05 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -154,6 +154,7 @@ public interface QueryServices extends SQLCloseable {
 public static final String INDEX_FAILURE_BLOCK_WRITE = 
"phoenix.index.failure.block.write";
 public static final String INDEX_FAILURE_DISABLE_INDEX = 
"phoenix.index.failure.disable.index";
 public static final String INDEX_FAILURE_THROW_EXCEPTION_ATTRIB = 
"phoenix.index.failure.throw.exception";
+public static final String INDEX_FAILURE_KILL_SERVER = 

[15/22] phoenix git commit: PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using phoenix-spark

2018-11-10 Thread jamestaylor
PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using 
phoenix-spark


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

Branch: refs/heads/omid2
Commit: 9bfaf183a3d092bce6b2dfcacd77ba46aa1b078b
Parents: 1b2a3d5
Author: Thomas D'Silva 
Authored: Thu Oct 18 22:00:01 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue Nov 6 14:51:13 2018 -0800

--
 .../org/apache/phoenix/end2end/AggregateIT.java |  987 +---
 .../apache/phoenix/end2end/BaseAggregateIT.java | 1022 +
 .../apache/phoenix/end2end/BaseOrderByIT.java   |  940 
 .../org/apache/phoenix/end2end/OrderByIT.java   |  943 ++--
 .../end2end/ParallelStatsDisabledIT.java|   40 +
 .../end2end/salted/BaseSaltedTableIT.java   |  474 
 .../phoenix/end2end/salted/SaltedTableIT.java   |  450 +---
 .../org/apache/phoenix/util/QueryBuilder.java   |  211 
 .../java/org/apache/phoenix/util/QueryUtil.java |   38 +-
 .../index/IndexScrutinyTableOutputTest.java |6 +-
 .../util/PhoenixConfigurationUtilTest.java  |6 +-
 .../org/apache/phoenix/util/QueryUtilTest.java  |   10 +-
 phoenix-spark/pom.xml   |8 +
 .../org/apache/phoenix/spark/AggregateIT.java   |   91 ++
 .../org/apache/phoenix/spark/OrderByIT.java |  460 
 .../org/apache/phoenix/spark/SaltedTableIT.java |   53 +
 .../org/apache/phoenix/spark/SparkUtil.java |   87 ++
 .../apache/phoenix/spark/PhoenixSparkIT.scala   |9 +-
 .../apache/phoenix/spark/SparkResultSet.java| 1056 ++
 .../org/apache/phoenix/spark/PhoenixRDD.scala   |   27 +-
 pom.xml |2 +-
 21 files changed, 4650 insertions(+), 2270 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bfaf183/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateIT.java
index 2059311..8916d4d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateIT.java
@@ -18,506 +18,28 @@
 package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.apache.phoenix.util.TestUtil.assertResultSet;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.apache.phoenix.util.TestUtil.assertResultSet;
 
-import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.List;
 import java.util.Properties;
 
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.compile.QueryPlan;
-import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
-import org.apache.phoenix.jdbc.PhoenixStatement;
-import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.schema.AmbiguousColumnException;
-import org.apache.phoenix.schema.types.PChar;
-import org.apache.phoenix.schema.types.PInteger;
-import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.PropertiesUtil;
-import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.QueryBuilder;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
 
+public class AggregateIT extends BaseAggregateIT {
 
-public class AggregateIT extends ParallelStatsDisabledIT {
-private static void initData(Connection conn, String tableName) throws 
SQLException {
-conn.createStatement().execute("create table " + tableName +
-"   (id varchar not null primary key,\n" +
-"uri varchar, appcpu integer)");
-insertRow(conn, tableName, "Report1", 10, 1);
-insertRow(conn, tableName, "Report2", 10, 2);
-insertRow(conn, tableName, "Report3", 30, 3);
-insertRow(conn, tableName, "Report4", 30, 4);
-insertRow(conn, tableName, "SOQL1", 10, 5);
-insertRow(conn, tableName, "SOQL2", 10, 6);
-insertRow(conn, tableName, "SOQL3", 30, 7);
-insertRow(conn, tableName, "SOQL4", 30, 8);
-conn.commit();
-}
-
-private static void insertRow(Connection conn, String tableName, String 
uri, int appcpu, int id) 

[09/22] phoenix git commit: PHOENIX-4997 Phoenix MR on snapshots can produce duplicate rows

2018-11-10 Thread jamestaylor
PHOENIX-4997 Phoenix MR on snapshots can produce duplicate rows


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

Branch: refs/heads/omid2
Commit: 1b2a3d5c7f25864158cd5062f2cd58d834fb5e1f
Parents: c3ed4f8
Author: Karan Mehta 
Authored: Thu Nov 1 17:15:26 2018 -0700
Committer: Karan Mehta 
Committed: Thu Nov 1 17:54:37 2018 -0700

--
 .../end2end/TableSnapshotReadsMapReduceIT.java  | 122 +++
 .../iterate/MapReduceParallelScanGrouper.java   |  32 -
 .../iterate/TableSnapshotResultIterator.java|  28 +++--
 .../java/org/apache/phoenix/query/BaseTest.java |  14 +--
 4 files changed, 122 insertions(+), 74 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b2a3d5c/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
index cae91a3..e35e159 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
@@ -36,6 +36,7 @@ import java.util.UUID;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -49,12 +50,18 @@ import 
org.apache.phoenix.mapreduce.index.PhoenixIndexDBWritable;
 import org.apache.phoenix.mapreduce.util.PhoenixMapReduceUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Maps;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class TableSnapshotReadsMapReduceIT extends BaseUniqueNamesOwnClusterIT 
{
+
+  private static final Logger logger = 
LoggerFactory.getLogger(TableSnapshotReadsMapReduceIT.class);
+
   private final static String SNAPSHOT_NAME = "FOO";
   private static final String FIELD1 = "FIELD1";
   private static final String FIELD2 = "FIELD2";
@@ -66,6 +73,9 @@ public class TableSnapshotReadsMapReduceIT extends 
BaseUniqueNamesOwnClusterIT {
   private static List> result;
   private long timestamp;
   private String tableName;
+  private Job job;
+  private Path tmpDir;
+  private Configuration conf;
 
   @BeforeClass
   public static void doSetup() throws Exception {
@@ -73,8 +83,8 @@ public class TableSnapshotReadsMapReduceIT extends 
BaseUniqueNamesOwnClusterIT {
   setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
   }
 
-  @Test
-  public void testMapReduceSnapshots() throws Exception {
+  @Before
+  public void before() throws SQLException, IOException {
 // create table
 Connection conn = DriverManager.getConnection(getUrl());
 tableName = generateUniqueName();
@@ -82,58 +92,43 @@ public class TableSnapshotReadsMapReduceIT extends 
BaseUniqueNamesOwnClusterIT {
 conn.commit();
 
 // configure Phoenix M/R job to read snapshot
-final Configuration conf = getUtility().getConfiguration();
-Job job = Job.getInstance(conf);
-Path tmpDir = getUtility().getRandomDir();
+conf = getUtility().getConfiguration();
+job = Job.getInstance(conf);
+tmpDir = getUtility().getRandomDir();
+  }
 
-
PhoenixMapReduceUtil.setInput(job,PhoenixIndexDBWritable.class,SNAPSHOT_NAME,tableName,tmpDir,
 null, FIELD1, FIELD2, FIELD3);
+  @Test
+  public void testMapReduceSnapshots() throws Exception {
+PhoenixMapReduceUtil.setInput(job,PhoenixIndexDBWritable.class,
+SNAPSHOT_NAME, tableName, tmpDir, null, FIELD1, FIELD2, FIELD3);
+configureJob(job, tableName, null, null, false);
+  }
 
-// configure and test job
-configureJob(job, tableName, null, null);
+  @Test
+  public void testMapReduceSnapshotsMultiRegion() throws Exception {
+PhoenixMapReduceUtil.setInput(job,PhoenixIndexDBWritable.class,
+SNAPSHOT_NAME, tableName, tmpDir, null, FIELD1, FIELD2, FIELD3);
+configureJob(job, tableName, null, null, true);
   }
 
   @Test
   public void testMapReduceSnapshotsWithCondition() throws Exception {
-// create table
-Connection conn = DriverManager.getConnection(getUrl());
-tableName = generateUniqueName();
-conn.createStatement().execute(String.format(CREATE_TABLE, tableName));
-

[08/22] phoenix git commit: PHOENIX-4989 Include disruptor jar in shaded dependency

2018-11-10 Thread jamestaylor
PHOENIX-4989 Include disruptor jar in shaded dependency


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

Branch: refs/heads/omid2
Commit: c3ed4f8f80ea9825f1b6f1db0933ceddcd22
Parents: fc35cce
Author: Aman Poonia 
Authored: Tue Oct 30 13:57:52 2018 -0700
Committer: Vincent Poon 
Committed: Thu Nov 1 17:21:15 2018 -0700

--
 phoenix-server/pom.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c3ed4f84/phoenix-server/pom.xml
--
diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml
index f5ba7f7..339bf8a 100644
--- a/phoenix-server/pom.xml
+++ b/phoenix-server/pom.xml
@@ -139,6 +139,7 @@
   com.ibm.icu:icu4j
   com.ibm.icu:icu4j-charset
   com.ibm.icu:icu4j-localespi
+  com.lmax:disruptor
 
   
 org.apache.phoenix:phoenix-server



[03/22] phoenix git commit: PHOENIX-4971 Drop index will execute successfully using Incorrect name of parent tables

2018-11-10 Thread jamestaylor
PHOENIX-4971 Drop index will execute successfully using Incorrect name of 
parent tables

Signed-off-by: Geoffrey Jacoby 


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

Branch: refs/heads/omid2
Commit: 527098ed621d62ba18fc19099ec67d8b29e027f4
Parents: 3903ad7
Author: Jaanai 
Authored: Sun Oct 28 19:10:51 2018 +0800
Committer: Geoffrey Jacoby 
Committed: Sun Oct 28 15:28:39 2018 -0700

--
 .../phoenix/end2end/index/DropMetadataIT.java   | 23 +++-
 .../phoenix/exception/SQLExceptionCode.java |  2 ++
 .../apache/phoenix/schema/MetaDataClient.java   | 15 +
 3 files changed, 39 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/527098ed/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
index b92ed8d..3c670c5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropMetadataIT.java
@@ -18,9 +18,12 @@
 package org.apache.phoenix.end2end.index;
 
 import static org.apache.phoenix.util.TestUtil.HBASE_NATIVE_SCHEMA_NAME;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.SQLException;
 import java.util.Properties;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -29,6 +32,7 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
+import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -56,7 +60,24 @@ public class DropMetadataIT extends ParallelStatsDisabledIT {
 String url = QueryUtil.getConnectionUrl(props, config, PRINCIPAL);
 return DriverManager.getConnection(url, props);
 }
-
+
+@Test
+public void testDropIndexTableHasSameNameWithDataTable() {
+String tableName = generateUniqueName();
+String indexName = "IDX_" + tableName;
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+String createTable = "CREATE TABLE " + tableName + "  (id varchar 
not null primary key, col integer)";
+conn.createStatement().execute(createTable);
+String createIndex = "CREATE INDEX " + indexName + " on " + 
tableName + "(col)";
+conn.createStatement().execute(createIndex);
+String dropIndex = "DROP INDEX " + indexName + " on " + indexName;
+conn.createStatement().execute(dropIndex);
+fail("should not execute successfully");
+} catch (SQLException e) {
+assertTrue(SQLExceptionCode.PARENT_TABLE_NOT_FOUND.getErrorCode() 
== e.getErrorCode());
+}
+}
+
 @Test
 public void testDropViewKeepsHTable() throws Exception {
 Connection conn = getConnection();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/527098ed/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
index d84857d..6696521 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
@@ -184,6 +184,8 @@ public enum SQLExceptionCode {
  INVALID_REPLAY_AT(533, "42910", "Value of REPLAY_AT cannot be less than 
zero."),
  UNEQUAL_SCN_AND_BUILD_INDEX_AT(534, "42911", "If both specified, values 
of CURRENT_SCN and BUILD_INDEX_AT must be equal."),
  ONLY_INDEX_UPDATABLE_AT_SCN(535, "42912", "Only an index may be updated 
when the BUILD_INDEX_AT property is specified"),
+ PARENT_TABLE_NOT_FOUND(536, "42913", "Can't drop the index because the 
parent table in the DROP statement is incorrect."),
+
  /**
  * HBase and Phoenix specific implementation defined sub-classes.
  * Column family related exceptions.


[04/22] phoenix git commit: PHOENIX-4872: BulkLoad has bug when loading on single-cell-array-with-offsets table.

2018-11-10 Thread jamestaylor
PHOENIX-4872: BulkLoad has bug when loading on single-cell-array-with-offsets 
table.


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

Branch: refs/heads/omid2
Commit: fe466ebe8e546c24f686232e7f3be03f96f1448a
Parents: 527098e
Author: s.kadam 
Authored: Mon Oct 29 14:47:21 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue Oct 30 14:56:22 2018 -0700

--
 .../phoenix/end2end/CsvBulkLoadToolIT.java  | 51 
 .../mapreduce/FormatToBytesWritableMapper.java  | 10 ++--
 2 files changed, 56 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe466ebe/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
index 40fe900..7e4226d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
@@ -35,7 +35,10 @@ import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapred.FileAlreadyExistsException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.CsvBulkLoadTool;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.util.DateUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -446,4 +449,52 @@ public class CsvBulkLoadToolIT extends BaseOwnClusterIT {
 rs.close();
 stmt.close();
 }
+
+/**
+ * This test case validates the import using CsvBulkLoadTool in
+ * SingleCellArrayWithOffsets table.
+ * PHOENIX-4872
+ */
+
+@Test
+public void testImportInSingleCellArrayWithOffsetsTable() throws Exception 
{
+Statement stmt = conn.createStatement();
+stmt.execute("CREATE IMMUTABLE TABLE S.TABLE12 (ID INTEGER NOT NULL 
PRIMARY KEY," +
+" CF0.NAME VARCHAR, CF0.T DATE, CF1.T2 DATE, CF2.T3 DATE) " +
+"IMMUTABLE_STORAGE_SCHEME=SINGLE_CELL_ARRAY_WITH_OFFSETS");
+PhoenixConnection phxConn = conn.unwrap(PhoenixConnection.class);
+PTable table = phxConn.getTable(new PTableKey(null, "S.TABLE12"));
+
+
assertEquals(PTable.ImmutableStorageScheme.SINGLE_CELL_ARRAY_WITH_OFFSETS,
+table.getImmutableStorageScheme());
+
+FileSystem fs = FileSystem.get(getUtility().getConfiguration());
+FSDataOutputStream outputStream = fs.create(new 
Path("/tmp/inputSCAWO.csv"));
+PrintWriter printWriter = new PrintWriter(outputStream);
+printWriter.println("1,Name 1,1970/01/01,1970/02/01,1970/03/01");
+printWriter.println("2,Name 2,1970/01/02,1970/02/02,1970/03/02");
+printWriter.println("3,Name 1,1970/01/01,1970/02/03,1970/03/01");
+printWriter.println("4,Name 2,1970/01/02,1970/02/04,1970/03/02");
+printWriter.println("5,Name 1,1970/01/01,1970/02/05,1970/03/01");
+printWriter.println("6,Name 2,1970/01/02,1970/02/06,1970/03/02");
+printWriter.close();
+
+CsvBulkLoadTool csvBulkLoadTool = new CsvBulkLoadTool();
+csvBulkLoadTool.setConf(new 
Configuration(getUtility().getConfiguration()));
+csvBulkLoadTool.getConf().set(DATE_FORMAT_ATTRIB,"/MM/dd");
+int exitCode = csvBulkLoadTool.run(new String[] {
+"--input", "/tmp/inputSCAWO.csv",
+"--table", "table12",
+"--schema", "s",
+"--zookeeper", zkQuorum});
+assertEquals(0, exitCode);
+
+ResultSet rs = stmt.executeQuery("SELECT COUNT(1) FROM S.TABLE12");
+assertTrue(rs.next());
+assertEquals(6, rs.getInt(1));
+
+rs.close();
+stmt.close();
+
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe466ebe/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
index 360859e..93ab188 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
+++ 

[12/22] phoenix git commit: PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using phoenix-spark

2018-11-10 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bfaf183/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
index 578a3af..792d08f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
@@ -17,17 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.apache.phoenix.util.TestUtil.ROW1;
-import static org.apache.phoenix.util.TestUtil.ROW2;
-import static org.apache.phoenix.util.TestUtil.ROW3;
-import static org.apache.phoenix.util.TestUtil.ROW4;
-import static org.apache.phoenix.util.TestUtil.ROW5;
-import static org.apache.phoenix.util.TestUtil.ROW6;
-import static org.apache.phoenix.util.TestUtil.ROW7;
-import static org.apache.phoenix.util.TestUtil.ROW8;
-import static org.apache.phoenix.util.TestUtil.ROW9;
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.apache.phoenix.util.TestUtil.assertResultSet;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -40,83 +30,10 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Properties;
 
-import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 
-
-public class OrderByIT extends ParallelStatsDisabledIT {
-
-@Test
-public void testMultiOrderByExpr() throws Exception {
-String tenantId = getOrganizationId();
-String tableName = initATableValues(tenantId, 
getDefaultSplits(tenantId), getUrl());
-String query = "SELECT entity_id FROM " + tableName + " ORDER BY 
b_string, entity_id";
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-Connection conn = DriverManager.getConnection(getUrl(), props);
-try {
-PreparedStatement statement = conn.prepareStatement(query);
-ResultSet rs = statement.executeQuery();
-assertTrue (rs.next());
-assertEquals(ROW1,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW4,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW7,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW2,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW5,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW8,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW3,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW6,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW9,rs.getString(1));
-
-assertFalse(rs.next());
-} finally {
-conn.close();
-}
-}
-
-
-@Test
-public void testDescMultiOrderByExpr() throws Exception {
-String tenantId = getOrganizationId();
-String tableName = initATableValues(tenantId, 
getDefaultSplits(tenantId), getUrl());
-String query = "SELECT entity_id FROM " + tableName + " ORDER BY 
b_string || entity_id desc";
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-Connection conn = DriverManager.getConnection(getUrl(), props);
-try {
-PreparedStatement statement = conn.prepareStatement(query);
-ResultSet rs = statement.executeQuery();
-assertTrue (rs.next());
-assertEquals(ROW9,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW6,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW3,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW8,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW5,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW2,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW7,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW4,rs.getString(1));
-assertTrue (rs.next());
-assertEquals(ROW1,rs.getString(1));
-
-assertFalse(rs.next());
-} finally {
-conn.close();
-}
-}
+public class OrderByIT extends BaseOrderByIT {
 
 @Test
 public void testOrderByWithPosition() throws Exception {
@@ -151,8 +68,8 @@ public class OrderByIT extends ParallelStatsDisabledIT {
 assertTrue(rs.next());
 assertEquals(1,rs.getInt(1));
 assertTrue(rs.next());
-assertEquals(1,rs.getInt(1));  
-assertFalse(rs.next());  
+  

[13/22] phoenix git commit: PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using phoenix-spark

2018-11-10 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bfaf183/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseOrderByIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseOrderByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseOrderByIT.java
new file mode 100644
index 000..31bf050
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseOrderByIT.java
@@ -0,0 +1,940 @@
+/*
+ * 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 static org.apache.phoenix.util.TestUtil.ROW1;
+import static org.apache.phoenix.util.TestUtil.ROW2;
+import static org.apache.phoenix.util.TestUtil.ROW3;
+import static org.apache.phoenix.util.TestUtil.ROW4;
+import static org.apache.phoenix.util.TestUtil.ROW5;
+import static org.apache.phoenix.util.TestUtil.ROW6;
+import static org.apache.phoenix.util.TestUtil.ROW7;
+import static org.apache.phoenix.util.TestUtil.ROW8;
+import static org.apache.phoenix.util.TestUtil.ROW9;
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.apache.phoenix.util.TestUtil.assertResultSet;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import com.google.common.collect.Lists;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.QueryBuilder;
+import org.junit.Test;
+
+
+public abstract class BaseOrderByIT extends ParallelStatsDisabledIT {
+
+@Test
+public void testMultiOrderByExpr() throws Exception {
+String tenantId = getOrganizationId();
+String tableName = initATableValues(tenantId, 
getDefaultSplits(tenantId), getUrl());
+QueryBuilder queryBuilder = new QueryBuilder()
+.setSelectColumns(
+Lists.newArrayList("ENTITY_ID", "B_STRING"))
+.setFullTableName(tableName)
+.setOrderByClause("B_STRING, ENTITY_ID");
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+ResultSet rs = executeQuery(conn, queryBuilder);
+assertTrue (rs.next());
+assertEquals(ROW1,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW4,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW7,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW2,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW5,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW8,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW3,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW6,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW9,rs.getString(1));
+
+assertFalse(rs.next());
+}
+}
+
+
+@Test
+public void testDescMultiOrderByExpr() throws Exception {
+String tenantId = getOrganizationId();
+String tableName = initATableValues(tenantId, 
getDefaultSplits(tenantId), getUrl());
+QueryBuilder queryBuilder = new QueryBuilder()
+.setSelectColumns(
+Lists.newArrayList("ENTITY_ID", "B_STRING"))
+.setFullTableName(tableName)
+.setOrderByClause("B_STRING || ENTITY_ID DESC");
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+ResultSet rs = executeQuery(conn, queryBuilder);
+assertTrue (rs.next());
+assertEquals(ROW9,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW6,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW3,rs.getString(1));
+assertTrue 

[16/22] phoenix git commit: PHOENIX-4996: Refactor PTableImpl to use Builder Pattern

2018-11-10 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d6083ae5/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index 9f06e04..7939b97 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -36,6 +36,7 @@ import java.util.Map.Entry;
 
 import javax.annotation.Nonnull;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.client.Delete;
@@ -69,7 +70,6 @@ import org.apache.phoenix.schema.types.PChar;
 import org.apache.phoenix.schema.types.PDataType;
 import org.apache.phoenix.schema.types.PDouble;
 import org.apache.phoenix.schema.types.PFloat;
-import org.apache.phoenix.schema.types.PLong;
 import org.apache.phoenix.schema.types.PVarchar;
 import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.ByteUtil;
@@ -102,164 +102,661 @@ import com.google.common.collect.Maps;
 public class PTableImpl implements PTable {
 private static final Integer NO_SALTING = -1;
 
-private PTableKey key;
-private PName name;
-private PName schemaName = PName.EMPTY_NAME;
-private PName tableName = PName.EMPTY_NAME;
-private PName tenantId;
-private PTableType type;
-private PIndexState state;
-private long sequenceNumber;
-private long timeStamp;
-private long indexDisableTimestamp;
+private IndexMaintainer indexMaintainer;
+private ImmutableBytesWritable indexMaintainersPtr;
+
+private final PTableKey key;
+private final PName name;
+private final PName schemaName;
+private final PName tableName;
+private final PName tenantId;
+private final PTableType type;
+private final PIndexState state;
+private final long sequenceNumber;
+private final long timeStamp;
+private final long indexDisableTimestamp;
 // Have MultiMap for String->PColumn (may need family qualifier)
-private List pkColumns;
-private List allColumns;
+private final List pkColumns;
+private final List allColumns;
 // columns that were inherited from a parent table but that were dropped 
in the view
-private List excludedColumns;
-private List families;
-private Map familyByBytes;
-private Map familyByString;
-private ListMultimap columnsByName;
-private Map kvColumnsByQualifiers;
-private PName pkName;
-private Integer bucketNum;
-private RowKeySchema rowKeySchema;
+private final List excludedColumns;
+private final List families;
+private final Map familyByBytes;
+private final Map familyByString;
+private final ListMultimap columnsByName;
+private final Map kvColumnsByQualifiers;
+private final PName pkName;
+private final Integer bucketNum;
+private final RowKeySchema rowKeySchema;
 // Indexes associated with this table.
-private List indexes;
+private final List indexes;
 // Data table name that the index is created on.
-private PName parentName;
-private PName parentSchemaName;
-private PName parentTableName;
-private List physicalNames;
-private boolean isImmutableRows;
-private IndexMaintainer indexMaintainer;
-private ImmutableBytesWritable indexMaintainersPtr;
-private PName defaultFamilyName;
-private String viewStatement;
-private boolean disableWAL;
-private boolean multiTenant;
-private boolean storeNulls;
-private TransactionFactory.Provider transactionProvider;
-private ViewType viewType;
-private PDataType viewIndexType;
-private Long viewIndexId;
-private int estimatedSize;
-private IndexType indexType;
-private int baseColumnCount;
-private boolean rowKeyOrderOptimizable; // TODO: remove when required that 
tables have been upgrade for PHOENIX-2067
-private boolean hasColumnsRequiringUpgrade; // TODO: remove when required 
that tables have been upgrade for PHOENIX-2067
-private int rowTimestampColPos;
-private long updateCacheFrequency;
-private boolean isNamespaceMapped;
-private String autoPartitionSeqName;
-private boolean isAppendOnlySchema;
-private ImmutableStorageScheme immutableStorageScheme;
-private QualifierEncodingScheme qualifierEncodingScheme;
-private EncodedCQCounter encodedCQCounter;
-private Boolean useStatsForParallelization;
-
-public PTableImpl() {
-this.indexes = Collections.emptyList();
-this.physicalNames = Collections.emptyList();
-this.rowKeySchema = RowKeySchema.EMPTY_SCHEMA;
-}
-
-// Constructor used at table creation time
-public PTableImpl(PName tenantId, String 

[20/22] phoenix git commit: PHOENIX-5013 Increase timeout for Tephra discovery service

2018-11-10 Thread jamestaylor
PHOENIX-5013 Increase timeout for Tephra discovery service


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

Branch: refs/heads/omid2
Commit: 169270daa894628f3dacf2957ef6cfc8a99d2f6a
Parents: d1efd66
Author: James Taylor 
Authored: Sat Nov 10 11:07:02 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:07:02 2018 -0800

--
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  6 +++---
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 ++
 2 files changed, 17 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/169270da/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 841abb6..49fb8e8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -25,8 +25,8 @@ import 
org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
 import org.apache.phoenix.transaction.OmidTransactionProvider;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
 import org.apache.tephra.TxConstants;
-import org.apache.twill.internal.utils.Networks;
 
 
 /**
@@ -129,12 +129,12 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
 .set(TxConstants.Manager.CFG_DO_PERSIST, false)
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, 
"n-times")
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
-.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
Networks.getRandomPort())
+.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
TestUtil.getRandomPort())
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, 
Files.createTempDir().getAbsolutePath())
 .set(TxConstants.Manager.CFG_TX_TIMEOUT, 
DEFAULT_TXN_TIMEOUT_SECONDS)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)
 // setup default test configs for Omid
-.set(OmidTransactionProvider.OMID_TSO_PORT, 
Networks.getRandomPort())
+.set(OmidTransactionProvider.OMID_TSO_PORT, 
TestUtil.getRandomPort())
 ;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/169270da/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java 
b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index f0a26b9..f3faa0c 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -36,6 +36,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.net.ServerSocket;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.DriverManager;
@@ -1105,4 +1106,17 @@ public class TestUtil {
 }
 return filteredData;
 }
+
+/**
+ * Find a random free port in localhost for binding.
+ * @return A port number or -1 for failure.
+ */
+public static int getRandomPort() {
+try (ServerSocket socket = new ServerSocket(0)) {
+socket.setReuseAddress(true);
+return socket.getLocalPort();
+} catch (IOException e) {
+return -1;
+}
+}
 }



[10/22] phoenix git commit: PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using phoenix-spark

2018-11-10 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bfaf183/phoenix-spark/src/main/java/org/apache/phoenix/spark/SparkResultSet.java
--
diff --git 
a/phoenix-spark/src/main/java/org/apache/phoenix/spark/SparkResultSet.java 
b/phoenix-spark/src/main/java/org/apache/phoenix/spark/SparkResultSet.java
new file mode 100644
index 000..0cb8009
--- /dev/null
+++ b/phoenix-spark/src/main/java/org/apache/phoenix/spark/SparkResultSet.java
@@ -0,0 +1,1056 @@
+/*
+ * 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.spark;
+
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
+import org.apache.phoenix.util.SQLCloseable;
+import org.apache.spark.sql.Row;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Helper class to convert a List of Rows returned from a dataset to a sql 
ResultSet
+ */
+public class SparkResultSet implements ResultSet, SQLCloseable {
+
+private int index = -1;
+private List dataSetRows;
+private List columnNames;
+private boolean wasNull = false;
+
+public SparkResultSet(List rows, String[] columnNames) {
+this.dataSetRows = rows;
+this.columnNames = Arrays.asList(columnNames);
+}
+
+private Row getCurrentRow() {
+return dataSetRows.get(index);
+}
+
+@Override
+public boolean absolute(int row) throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public void afterLast() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public void beforeFirst() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public void cancelRowUpdates() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public void clearWarnings() throws SQLException {
+}
+
+@Override
+public void close() throws SQLException {
+}
+
+@Override
+public void deleteRow() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public int findColumn(String columnLabel) throws SQLException {
+return columnNames.indexOf(columnLabel.toUpperCase())+1;
+}
+
+@Override
+public boolean first() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public Array getArray(int columnIndex) throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public Array getArray(String columnLabel) throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public InputStream getAsciiStream(int columnIndex) throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public InputStream getAsciiStream(String columnLabel) throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+private void checkOpen() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+private void checkCursorState() throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+throw new SQLFeatureNotSupportedException();
+}
+
+@Override
+public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+ 

[06/22] phoenix git commit: PHOENIX-4764 Cleanup metadata of child views for a base table that has been dropped (addendum)

2018-11-10 Thread jamestaylor
PHOENIX-4764 Cleanup metadata of child views for a base table that has been 
dropped (addendum)


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

Branch: refs/heads/omid2
Commit: c936d815119b73dc927a7b3bb6a2b577b4a2f91c
Parents: 6478879
Author: Kadir 
Authored: Tue Oct 30 17:47:26 2018 -0700
Committer: Karan Mehta 
Committed: Tue Oct 30 18:33:10 2018 -0700

--
 .../end2end/MigrateSystemTablesToSystemNamespaceIT.java   | 4 ++--
 .../phoenix/end2end/SystemCatalogCreationOnConnectionIT.java  | 4 ++--
 .../org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java   | 4 +++-
 .../org/apache/phoenix/coprocessor/TaskRegionObserver.java| 7 +--
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 +-
 .../src/main/java/org/apache/phoenix/query/QueryServices.java | 2 ++
 .../java/org/apache/phoenix/query/QueryServicesOptions.java   | 3 ++-
 7 files changed, 17 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c936d815/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
index ffac4d6..b6f061e 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
@@ -62,10 +62,10 @@ public class MigrateSystemTablesToSystemNamespaceIT extends 
BaseTest {
 
 private static final Set PHOENIX_SYSTEM_TABLES = new 
HashSet<>(Arrays.asList(
 "SYSTEM.CATALOG", "SYSTEM.SEQUENCE", "SYSTEM.STATS", 
"SYSTEM.FUNCTION",
-"SYSTEM.MUTEX","SYSTEM.LOG", "SYSTEM.CHILD_LINK"));
+"SYSTEM.MUTEX","SYSTEM.LOG", "SYSTEM.CHILD_LINK", "SYSTEM.TASK"));
 private static final Set PHOENIX_NAMESPACE_MAPPED_SYSTEM_TABLES = 
new HashSet<>(
 Arrays.asList("SYSTEM:CATALOG", "SYSTEM:SEQUENCE", "SYSTEM:STATS", 
"SYSTEM:FUNCTION",
-"SYSTEM:MUTEX","SYSTEM:LOG", "SYSTEM:CHILD_LINK"));
+"SYSTEM:MUTEX","SYSTEM:LOG", "SYSTEM:CHILD_LINK", 
"SYSTEM:TASK"));
 private static final String SCHEMA_NAME = "MIGRATETEST";
 private static final String TABLE_NAME =
 SCHEMA_NAME + "." + 
MigrateSystemTablesToSystemNamespaceIT.class.getSimpleName().toUpperCase();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c936d815/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
index aa2d971..a1685c44 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogCreationOnConnectionIT.java
@@ -72,11 +72,11 @@ public class SystemCatalogCreationOnConnectionIT {
 
 private static final Set PHOENIX_SYSTEM_TABLES = new 
HashSet<>(Arrays.asList(
   "SYSTEM.CATALOG", "SYSTEM.SEQUENCE", "SYSTEM.STATS", "SYSTEM.FUNCTION",
-  "SYSTEM.MUTEX", "SYSTEM.LOG", "SYSTEM.CHILD_LINK"));
+  "SYSTEM.MUTEX", "SYSTEM.LOG", "SYSTEM.CHILD_LINK", "SYSTEM.TASK"));
 
 private static final Set PHOENIX_NAMESPACE_MAPPED_SYSTEM_TABLES = 
new HashSet<>(
   Arrays.asList("SYSTEM:CATALOG", "SYSTEM:SEQUENCE", "SYSTEM:STATS", 
"SYSTEM:FUNCTION",
-"SYSTEM:MUTEX", "SYSTEM:LOG", "SYSTEM:CHILD_LINK"));
+"SYSTEM:MUTEX", "SYSTEM:LOG", "SYSTEM:CHILD_LINK", "SYSTEM:TASK"));
 
 private static class PhoenixSysCatCreationServices extends 
ConnectionQueryServicesImpl {
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c936d815/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java
index 5c016f6..9c2b763 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java
@@ -19,6 +19,7 @@ 

[14/22] phoenix git commit: PHOENIX-4981 Add tests for ORDER BY, GROUP BY and salted tables using phoenix-spark

2018-11-10 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bfaf183/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseAggregateIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseAggregateIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseAggregateIT.java
new file mode 100644
index 000..5b466df
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseAggregateIT.java
@@ -0,0 +1,1022 @@
+/*
+ * 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 static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.apache.phoenix.util.TestUtil.assertResultSet;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+import java.util.Properties;
+
+import com.google.common.collect.Lists;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.compile.QueryPlan;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.jdbc.PhoenixStatement;
+import org.apache.phoenix.query.KeyRange;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.AmbiguousColumnException;
+import org.apache.phoenix.schema.types.PChar;
+import org.apache.phoenix.schema.types.PInteger;
+import org.apache.phoenix.util.ByteUtil;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.QueryBuilder;
+import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Test;
+
+
+public abstract class BaseAggregateIT extends ParallelStatsDisabledIT {
+
+private static void initData(Connection conn, String tableName) throws 
SQLException {
+conn.createStatement().execute("create table " + tableName +
+"   (id varchar not null primary key,\n" +
+"uri varchar, appcpu integer)");
+insertRow(conn, tableName, "Report1", 10, 1);
+insertRow(conn, tableName, "Report2", 10, 2);
+insertRow(conn, tableName, "Report3", 30, 3);
+insertRow(conn, tableName, "Report4", 30, 4);
+insertRow(conn, tableName, "SOQL1", 10, 5);
+insertRow(conn, tableName, "SOQL2", 10, 6);
+insertRow(conn, tableName, "SOQL3", 30, 7);
+insertRow(conn, tableName, "SOQL4", 30, 8);
+conn.commit();
+}
+
+private static void insertRow(Connection conn, String tableName, String 
uri, int appcpu, int id) throws SQLException {
+PreparedStatement statement = conn.prepareStatement("UPSERT INTO " + 
tableName + "(id, uri, appcpu) values (?,?,?)");
+statement.setString(1, "id" + id);
+statement.setString(2, uri);
+statement.setInt(3, appcpu);
+statement.executeUpdate();
+}
+
+@Test
+public void testDuplicateTrailingAggExpr() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.FALSE.toString());
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String tableName = generateUniqueName();
+
+conn.createStatement().execute("create table " + tableName +
+"   (nam VARCHAR(20), address VARCHAR(20), id BIGINT "
++ "constraint my_pk primary key (id))");
+PreparedStatement statement = conn.prepareStatement("UPSERT INTO " + 
tableName + "(nam, address, id) values (?,?,?)");
+statement.setString(1, "pulkit");
+statement.setString(2, "badaun");
+statement.setInt(3, 1);
+statement.executeUpdate();
+conn.commit();
+
+QueryBuilder queryBuilder = new QueryBuilder()
+.setDistinct(true)
+.setSelectExpression("'harshit' as 

[1/2] phoenix git commit: PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled

2018-11-10 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 0e1984f2f -> d9d8fd0c4


PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled


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

Branch: refs/heads/master
Commit: 7a97b68c6254291dcfaeb990f6554cc1ec669778
Parents: 0e1984f
Author: James Taylor 
Authored: Sat Nov 10 11:04:48 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:15:02 2018 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java  | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7a97b68c/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index eec88a0..dfe4634 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -57,7 +57,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -66,8 +65,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-@Category(NeedsOwnMiniClusterTest.class)
-public class IndexToolIT extends ParallelStatsEnabledIT {
+public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
 
 private final boolean localIndex;
 private final boolean transactional;
@@ -98,9 +96,13 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 @BeforeClass
 public static void setup() throws Exception {
 Map serverProps = Maps.newHashMapWithExpectedSize(2);
+serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Long.toString(20));
+
serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, 
Long.toString(5));
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(2);
+clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, 
Boolean.toString(true));
+clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, 
Long.toString(5));
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
 clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.TRUE.toString());
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),



[2/2] phoenix git commit: PHOENIX-5013 Increase timeout for Tephra discovery service

2018-11-10 Thread jamestaylor
PHOENIX-5013 Increase timeout for Tephra discovery service


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

Branch: refs/heads/master
Commit: d9d8fd0c449553f3abc9a6e7cba917378ee12e8d
Parents: 7a97b68
Author: James Taylor 
Authored: Sat Nov 10 11:07:02 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:15:06 2018 -0800

--
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  6 +++---
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 ++
 2 files changed, 17 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d9d8fd0c/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 841abb6..49fb8e8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -25,8 +25,8 @@ import 
org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
 import org.apache.phoenix.transaction.OmidTransactionProvider;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
 import org.apache.tephra.TxConstants;
-import org.apache.twill.internal.utils.Networks;
 
 
 /**
@@ -129,12 +129,12 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
 .set(TxConstants.Manager.CFG_DO_PERSIST, false)
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, 
"n-times")
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
-.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
Networks.getRandomPort())
+.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
TestUtil.getRandomPort())
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, 
Files.createTempDir().getAbsolutePath())
 .set(TxConstants.Manager.CFG_TX_TIMEOUT, 
DEFAULT_TXN_TIMEOUT_SECONDS)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)
 // setup default test configs for Omid
-.set(OmidTransactionProvider.OMID_TSO_PORT, 
Networks.getRandomPort())
+.set(OmidTransactionProvider.OMID_TSO_PORT, 
TestUtil.getRandomPort())
 ;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d9d8fd0c/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java 
b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index a1b6a88..40b9cfb 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -36,6 +36,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.net.ServerSocket;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.DriverManager;
@@ -1112,4 +1113,17 @@ public class TestUtil {
 }
 return filteredData;
 }
+
+/**
+ * Find a random free port in localhost for binding.
+ * @return A port number or -1 for failure.
+ */
+public static int getRandomPort() {
+try (ServerSocket socket = new ServerSocket(0)) {
+socket.setReuseAddress(true);
+return socket.getLocalPort();
+} catch (IOException e) {
+return -1;
+}
+}
 }



[1/2] phoenix git commit: PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled

2018-11-10 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.4 131ff09b2 -> 70a699e30


PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled


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

Branch: refs/heads/4.x-HBase-1.4
Commit: 483d9deb8fb75b2dc0b653e399a7fe98cfd5409c
Parents: 131ff09
Author: James Taylor 
Authored: Sat Nov 10 11:04:48 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:12:42 2018 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java  | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/483d9deb/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index c99f145..e096bb5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -58,7 +58,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -67,8 +66,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-@Category(NeedsOwnMiniClusterTest.class)
-public class IndexToolIT extends ParallelStatsEnabledIT {
+public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
 
 private final boolean localIndex;
 private final boolean transactional;
@@ -99,9 +97,13 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 @BeforeClass
 public static void setup() throws Exception {
 Map serverProps = Maps.newHashMapWithExpectedSize(2);
+serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Long.toString(20));
+
serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, 
Long.toString(5));
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(2);
+clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, 
Boolean.toString(true));
+clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, 
Long.toString(5));
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
 clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.TRUE.toString());
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),



[2/2] phoenix git commit: PHOENIX-5013 Increase timeout for Tephra discovery service

2018-11-10 Thread jamestaylor
PHOENIX-5013 Increase timeout for Tephra discovery service


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

Branch: refs/heads/4.x-HBase-1.4
Commit: 70a699e30d7d1a2b8448168d7d06e2a5926c9c61
Parents: 483d9de
Author: James Taylor 
Authored: Sat Nov 10 11:07:02 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:12:47 2018 -0800

--
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  6 +++---
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 ++
 2 files changed, 17 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/70a699e3/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 841abb6..49fb8e8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -25,8 +25,8 @@ import 
org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
 import org.apache.phoenix.transaction.OmidTransactionProvider;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
 import org.apache.tephra.TxConstants;
-import org.apache.twill.internal.utils.Networks;
 
 
 /**
@@ -129,12 +129,12 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
 .set(TxConstants.Manager.CFG_DO_PERSIST, false)
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, 
"n-times")
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
-.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
Networks.getRandomPort())
+.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
TestUtil.getRandomPort())
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, 
Files.createTempDir().getAbsolutePath())
 .set(TxConstants.Manager.CFG_TX_TIMEOUT, 
DEFAULT_TXN_TIMEOUT_SECONDS)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)
 // setup default test configs for Omid
-.set(OmidTransactionProvider.OMID_TSO_PORT, 
Networks.getRandomPort())
+.set(OmidTransactionProvider.OMID_TSO_PORT, 
TestUtil.getRandomPort())
 ;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/70a699e3/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java 
b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index f0a26b9..f3faa0c 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -36,6 +36,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.net.ServerSocket;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.DriverManager;
@@ -1105,4 +1106,17 @@ public class TestUtil {
 }
 return filteredData;
 }
+
+/**
+ * Find a random free port in localhost for binding.
+ * @return A port number or -1 for failure.
+ */
+public static int getRandomPort() {
+try (ServerSocket socket = new ServerSocket(0)) {
+socket.setReuseAddress(true);
+return socket.getLocalPort();
+} catch (IOException e) {
+return -1;
+}
+}
 }



[1/2] phoenix git commit: PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled

2018-11-10 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 dad5f6202 -> 526de5336


PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled


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

Branch: refs/heads/4.x-HBase-1.2
Commit: aba9cb3b1bacaa97b6c8666f28051fd21b84905f
Parents: dad5f62
Author: James Taylor 
Authored: Sat Nov 10 11:04:48 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:10:17 2018 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java  | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/aba9cb3b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index c99f145..e096bb5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -58,7 +58,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -67,8 +66,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-@Category(NeedsOwnMiniClusterTest.class)
-public class IndexToolIT extends ParallelStatsEnabledIT {
+public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
 
 private final boolean localIndex;
 private final boolean transactional;
@@ -99,9 +97,13 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 @BeforeClass
 public static void setup() throws Exception {
 Map serverProps = Maps.newHashMapWithExpectedSize(2);
+serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Long.toString(20));
+
serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, 
Long.toString(5));
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(2);
+clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, 
Boolean.toString(true));
+clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, 
Long.toString(5));
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
 clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.TRUE.toString());
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),



[2/2] phoenix git commit: PHOENIX-5013 Increase timeout for Tephra discovery service

2018-11-10 Thread jamestaylor
PHOENIX-5013 Increase timeout for Tephra discovery service


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 526de53368adff68ce15af6a4c33c161a2468296
Parents: aba9cb3
Author: James Taylor 
Authored: Sat Nov 10 11:07:02 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:10:35 2018 -0800

--
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  6 +++---
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 ++
 2 files changed, 17 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/526de533/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 841abb6..49fb8e8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -25,8 +25,8 @@ import 
org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
 import org.apache.phoenix.transaction.OmidTransactionProvider;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
 import org.apache.tephra.TxConstants;
-import org.apache.twill.internal.utils.Networks;
 
 
 /**
@@ -129,12 +129,12 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
 .set(TxConstants.Manager.CFG_DO_PERSIST, false)
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, 
"n-times")
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
-.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
Networks.getRandomPort())
+.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
TestUtil.getRandomPort())
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, 
Files.createTempDir().getAbsolutePath())
 .set(TxConstants.Manager.CFG_TX_TIMEOUT, 
DEFAULT_TXN_TIMEOUT_SECONDS)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)
 // setup default test configs for Omid
-.set(OmidTransactionProvider.OMID_TSO_PORT, 
Networks.getRandomPort())
+.set(OmidTransactionProvider.OMID_TSO_PORT, 
TestUtil.getRandomPort())
 ;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/526de533/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java 
b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index f0a26b9..f3faa0c 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -36,6 +36,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.net.ServerSocket;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.DriverManager;
@@ -1105,4 +1106,17 @@ public class TestUtil {
 }
 return filteredData;
 }
+
+/**
+ * Find a random free port in localhost for binding.
+ * @return A port number or -1 for failure.
+ */
+public static int getRandomPort() {
+try (ServerSocket socket = new ServerSocket(0)) {
+socket.setReuseAddress(true);
+return socket.getLocalPort();
+} catch (IOException e) {
+return -1;
+}
+}
 }



[1/2] phoenix git commit: PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled

2018-11-10 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 fd7ae9406 -> 169270daa


PHOENIX-5012 Don't derive IndexToolIT from ParallelStatsEnabled


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

Branch: refs/heads/4.x-HBase-1.3
Commit: d1efd665fa84f611e1ad544ed0859f1fecb4f616
Parents: fd7ae94
Author: James Taylor 
Authored: Sat Nov 10 11:04:48 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:04:48 2018 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java  | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d1efd665/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index c99f145..e096bb5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -58,7 +58,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -67,8 +66,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-@Category(NeedsOwnMiniClusterTest.class)
-public class IndexToolIT extends ParallelStatsEnabledIT {
+public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
 
 private final boolean localIndex;
 private final boolean transactional;
@@ -99,9 +97,13 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 @BeforeClass
 public static void setup() throws Exception {
 Map serverProps = Maps.newHashMapWithExpectedSize(2);
+serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Long.toString(20));
+
serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, 
Long.toString(5));
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(2);
+clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, 
Boolean.toString(true));
+clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, 
Long.toString(5));
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
 clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.TRUE.toString());
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),



[2/2] phoenix git commit: PHOENIX-5013 Increase timeout for Tephra discovery service

2018-11-10 Thread jamestaylor
PHOENIX-5013 Increase timeout for Tephra discovery service


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 169270daa894628f3dacf2957ef6cfc8a99d2f6a
Parents: d1efd66
Author: James Taylor 
Authored: Sat Nov 10 11:07:02 2018 -0800
Committer: James Taylor 
Committed: Sat Nov 10 11:07:02 2018 -0800

--
 .../apache/phoenix/query/QueryServicesTestImpl.java   |  6 +++---
 .../test/java/org/apache/phoenix/util/TestUtil.java   | 14 ++
 2 files changed, 17 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/169270da/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 841abb6..49fb8e8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -25,8 +25,8 @@ import 
org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
 import org.apache.phoenix.transaction.OmidTransactionProvider;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
 import org.apache.tephra.TxConstants;
-import org.apache.twill.internal.utils.Networks;
 
 
 /**
@@ -129,12 +129,12 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
 .set(TxConstants.Manager.CFG_DO_PERSIST, false)
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, 
"n-times")
 .set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
-.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
Networks.getRandomPort())
+.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, 
TestUtil.getRandomPort())
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, 
Files.createTempDir().getAbsolutePath())
 .set(TxConstants.Manager.CFG_TX_TIMEOUT, 
DEFAULT_TXN_TIMEOUT_SECONDS)
 .set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)
 // setup default test configs for Omid
-.set(OmidTransactionProvider.OMID_TSO_PORT, 
Networks.getRandomPort())
+.set(OmidTransactionProvider.OMID_TSO_PORT, 
TestUtil.getRandomPort())
 ;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/169270da/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java 
b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index f0a26b9..f3faa0c 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -36,6 +36,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.net.ServerSocket;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.DriverManager;
@@ -1105,4 +1106,17 @@ public class TestUtil {
 }
 return filteredData;
 }
+
+/**
+ * Find a random free port in localhost for binding.
+ * @return A port number or -1 for failure.
+ */
+public static int getRandomPort() {
+try (ServerSocket socket = new ServerSocket(0)) {
+socket.setReuseAddress(true);
+return socket.getLocalPort();
+} catch (IOException e) {
+return -1;
+}
+}
 }



phoenix git commit: PHOENIX-5004 Fix org.jboss.netty.channel.ChannelException: Failed to bind to: flapper (addendum)

2018-11-06 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 e13de05a2 -> 0f2b1b8ba


PHOENIX-5004 Fix org.jboss.netty.channel.ChannelException: Failed to bind to: 
flapper (addendum)


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

Branch: refs/heads/omid2
Commit: 0f2b1b8ba9995e668edac908ef0bf1b4d72167ec
Parents: e13de05
Author: James Taylor 
Authored: Tue Nov 6 12:39:45 2018 -0800
Committer: James Taylor 
Committed: Tue Nov 6 12:39:45 2018 -0800

--
 .../transaction/OmidTransactionProvider.java| 25 +++-
 .../phoenix/query/QueryServicesTestImpl.java|  8 ---
 .../java/org/apache/phoenix/util/TestUtil.java  | 14 +++
 3 files changed, 22 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0f2b1b8b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index 98b56ad..610a5d1 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -18,7 +18,6 @@
 package org.apache.phoenix.transaction;
 
 import java.io.IOException;
-import java.net.ServerSocket;
 import java.sql.SQLException;
 import java.util.Arrays;
 
@@ -42,14 +41,11 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 
 public class OmidTransactionProvider implements PhoenixTransactionProvider {
-private static final Logger logger = 
LoggerFactory.getLogger(OmidTransactionProvider.class);
 private static final OmidTransactionProvider INSTANCE = new 
OmidTransactionProvider();
 public static final String OMID_TSO_PORT = "phoenix.omid.tso.port";
 public static final String OMID_TSO_CONFLICT_MAP_SIZE = 
"phoenix.omid.tso.conflict.map.size";
@@ -122,31 +118,16 @@ public class OmidTransactionProvider implements 
PhoenixTransactionProvider {
 return commitTableClient;
 }
 
-/**
- * Find a random free port in localhost for binding.
- * @return A port number or -1 for failure.
- */
-private static int getRandomPort() {
-  try (ServerSocket socket = new ServerSocket(0)) {
-return socket.getLocalPort();
-  } catch (IOException e) {
-return -1;
-  }
-}
-
 @Override
 public PhoenixTransactionService getTransactionService(Configuration 
config, ConnectionInfo connectionInfo) throws  SQLException{
 TSOServerConfig tsoConfig = new TSOServerConfig();
 TSOServer tso;
 
-int port;
 String portStr = config.get(OMID_TSO_PORT);
-if (portStr == null) { // For testing, we generate a random port.
-port = getRandomPort();
-logger.warn("Using random port for " + OMID_TSO_PORT + " of " + 
port);
-} else {
-port = Integer.parseInt(portStr);
+if (portStr == null) {
+throw new IllegalArgumentException(OMID_TSO_PORT + " config 
parameter must be bound");
 }
+int  port = Integer.parseInt(portStr);
 
 tsoConfig.setPort(port);
 tsoConfig.setConflictMapSize(config.getInt(OMID_TSO_CONFLICT_MAP_SIZE, 
DEFAULT_OMID_TSO_CONFLICT_MAP_SIZE));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0f2b1b8b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index ab45633..49fb8e8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -22,10 +22,11 @@ import static 
org.apache.phoenix.query.QueryServicesOptions.withDefaults;
 
 import org.apache.curator.shaded.com.google.common.io.Files;
 import org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
+import org.apache.phoenix.transaction.OmidTransactionProvider;
 

phoenix git commit: PHOENIX-5004 Fix org.jboss.netty.channel.ChannelException: Failed to bind to: flapper

2018-11-06 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 5728e183f -> e13de05a2


PHOENIX-5004 Fix org.jboss.netty.channel.ChannelException: Failed to bind to: 
flapper


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

Branch: refs/heads/omid2
Commit: e13de05a252a8eb56e1292225199cdefb81c
Parents: 5728e18
Author: James Taylor 
Authored: Tue Nov 6 12:21:32 2018 -0800
Committer: James Taylor 
Committed: Tue Nov 6 12:21:32 2018 -0800

--
 .../org/apache/phoenix/end2end/IndexToolIT.java |  8 ---
 .../transaction/OmidTransactionProvider.java| 25 +---
 .../phoenix/query/QueryServicesTestImpl.java|  4 +---
 3 files changed, 28 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e13de05a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index c99f145..e096bb5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -58,7 +58,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -67,8 +66,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-@Category(NeedsOwnMiniClusterTest.class)
-public class IndexToolIT extends ParallelStatsEnabledIT {
+public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
 
 private final boolean localIndex;
 private final boolean transactional;
@@ -99,9 +97,13 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 @BeforeClass
 public static void setup() throws Exception {
 Map serverProps = Maps.newHashMapWithExpectedSize(2);
+serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Long.toString(20));
+
serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, 
Long.toString(5));
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(2);
+clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, 
Boolean.toString(true));
+clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, 
Long.toString(5));
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
 clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.TRUE.toString());
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e13de05a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index 610a5d1..98b56ad 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -18,6 +18,7 @@
 package org.apache.phoenix.transaction;
 
 import java.io.IOException;
+import java.net.ServerSocket;
 import java.sql.SQLException;
 import java.util.Arrays;
 
@@ -41,11 +42,14 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
 import org.apache.phoenix.transaction.TransactionFactory.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 
 public class OmidTransactionProvider implements PhoenixTransactionProvider {
+private static final Logger logger = 
LoggerFactory.getLogger(OmidTransactionProvider.class);
 private static final OmidTransactionProvider INSTANCE = new 
OmidTransactionProvider();
 public static final String OMID_TSO_PORT = "phoenix.omid.tso.port";
 public static final String OMID_TSO_CONFLICT_MAP_SIZE = 

phoenix git commit: add omid coprocessor classes to phoenix-server. default tso world_time. fix omid run script parameters

2018-11-06 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 0fcca0a76 -> 5728e183f


add omid coprocessor classes to phoenix-server. default tso world_time. fix 
omid run script parameters


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

Branch: refs/heads/omid2
Commit: 5728e183fdb4cbec5aed6c01bf958611733bef4d
Parents: 0fcca0a
Author: Yonatan Gottesman 
Authored: Sun Nov 4 09:03:31 2018 +0200
Committer: James Taylor 
Committed: Tue Nov 6 07:16:59 2018 -0800

--
 bin/omid-env.sh   | 22 +++---
 bin/omid-server-configuration.yml |  3 +++
 phoenix-server/pom.xml|  1 +
 3 files changed, 23 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5728e183/bin/omid-env.sh
--
diff --git a/bin/omid-env.sh b/bin/omid-env.sh
index 578382c..820cdaa 100644
--- a/bin/omid-env.sh
+++ b/bin/omid-env.sh
@@ -21,7 +21,23 @@
 # 
-
 # Check if HADOOP_CONF_DIR and HBASE_CONF_DIR are set
 # 
-
+export JVM_FLAGS=-Xmx4096m
+if [ -z ${HADOOP_CONF_DIR+x} ]; then
+if [ -z ${HADOOP_HOME+x} ]; then
+echo "WARNING: HADOOP_HOME or HADOOP_CONF_DIR are unset";
+else
+export HADOOP_CONF_DIR=${HADOOP_HOME}/conf
+fi
+else
+echo "HADOOP_CONF_DIR is set to '$HADOOP_CONF_DIR'";
+fi
 
-if [ -z ${HADOOP_CONF_DIR+x} ]; then echo "WARNING: HADOOP_CONF_DIR is unset"; 
else echo "HADOOP_CONF_DIR is set to '$HADOOP_CONF_DIR'"; fi
-if [ -z ${HBASE_CONF_DIR+x} ]; then echo "WARNING: HBASE_CONF_DIR is unset"; 
else echo "HBASE_CONF_DIR is set to '$HBASE_CONF_DIR'"; fi
-
+if [ -z ${HBASE_CONF_DIR+x} ]; then
+if [ -z ${HBASE_HOME+x} ]; then
+echo "WARNING: HBASE_HOME or HBASE_CONF_DIR are unset";
+else
+export HBASE_CONF_DIR=${HBASE_HOME}/conf
+fi
+else
+echo "HBASE_CONF_DIR is set to '$HBASE_CONF_DIR'";
+fi

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5728e183/bin/omid-server-configuration.yml
--
diff --git a/bin/omid-server-configuration.yml 
b/bin/omid-server-configuration.yml
index ab80667..8d1616e 100644
--- a/bin/omid-server-configuration.yml
+++ b/bin/omid-server-configuration.yml
@@ -20,3 +20,6 @@ metrics: !!org.apache.omid.metrics.CodahaleMetricsProvider [
   csvDir: "csvMetrics",
 }
 ]
+
+timestampType: WORLD_TIME
+lowLatency: false

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5728e183/phoenix-server/pom.xml
--
diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml
index f5ba7f7..daf9fe5 100644
--- a/phoenix-server/pom.xml
+++ b/phoenix-server/pom.xml
@@ -125,6 +125,7 @@
   org.iq80.snappy:snappy
   org.antlr:antlr*
   org.apache.tephra:tephra*
+  org.apache.omid:omid*
   com.google.code.gson:gson
   org.jruby.joni:joni
   org.jruby.jcodings:jcodings



phoenix git commit: - add omid run script. [OMID-119] - change names of dependencies

2018-10-24 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 408f9bdfd -> 0fcca0a76


- add omid run script. [OMID-119] - change names of dependencies


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

Branch: refs/heads/omid2
Commit: 0fcca0a76201653857a6e3a273803e9b43a7a780
Parents: 408f9bd
Author: Yonatan Gottesman 
Authored: Wed Oct 24 11:51:47 2018 +0300
Committer: James Taylor 
Committed: Wed Oct 24 09:41:19 2018 -0700

--
 bin/omid-env.sh   | 27 ++
 bin/omid-server-configuration.yml | 22 
 bin/omid.sh   | 93 ++
 3 files changed, 142 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0fcca0a7/bin/omid-env.sh
--
diff --git a/bin/omid-env.sh b/bin/omid-env.sh
new file mode 100644
index 000..578382c
--- /dev/null
+++ b/bin/omid-env.sh
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+# Set the flags to pass to the jvm when running omid
+# export JVM_FLAGS=-Xmx8096m
+# 
-
+# Check if HADOOP_CONF_DIR and HBASE_CONF_DIR are set
+# 
-
+
+if [ -z ${HADOOP_CONF_DIR+x} ]; then echo "WARNING: HADOOP_CONF_DIR is unset"; 
else echo "HADOOP_CONF_DIR is set to '$HADOOP_CONF_DIR'"; fi
+if [ -z ${HBASE_CONF_DIR+x} ]; then echo "WARNING: HBASE_CONF_DIR is unset"; 
else echo "HBASE_CONF_DIR is set to '$HBASE_CONF_DIR'"; fi
+

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0fcca0a7/bin/omid-server-configuration.yml
--
diff --git a/bin/omid-server-configuration.yml 
b/bin/omid-server-configuration.yml
new file mode 100644
index 000..ab80667
--- /dev/null
+++ b/bin/omid-server-configuration.yml
@@ -0,0 +1,22 @@
+# 
=
+#
+# Omid TSO Server Configuration
+# 
-
+#
+# Tune here the default values for TSO server config parameters found in 
'default-omid-server-configuration.yml' file
+#
+# 
=
+
+
+timestampStoreModule: 
!!org.apache.omid.timestamp.storage.HBaseTimestampStorageModule [ ]
+commitTableStoreModule: 
!!org.apache.omid.committable.hbase.HBaseCommitTableStorageModule [ ]
+
+metrics: !!org.apache.omid.metrics.CodahaleMetricsProvider [
+!!org.apache.omid.metrics.CodahaleMetricsConfig {
+  outputFreqInSecs: 10,
+  reporters: !!set {
+!!org.apache.omid.metrics.CodahaleMetricsConfig$Reporter CSV
+  },
+  csvDir: "csvMetrics",
+}
+]

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0fcca0a7/bin/omid.sh
--
diff --git a/bin/omid.sh b/bin/omid.sh
new file mode 100755
index 000..5b33ed5
--- /dev/null
+++ b/bin/omid.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# 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 

phoenix git commit: - add omid run script. [OMID-119] - change names of dependencies

2018-10-24 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 f66538074 -> 408f9bdfd


- add omid run script. [OMID-119] - change names of dependencies


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

Branch: refs/heads/omid2
Commit: 408f9bdfd979382c8215efedfc19817bd53a5103
Parents: f665380
Author: Yonatan Gottesman 
Authored: Wed Oct 24 11:51:47 2018 +0300
Committer: James Taylor 
Committed: Wed Oct 24 09:30:31 2018 -0700

--
 phoenix-assembly/pom.xml| 15 +++
 .../components/all-common-dependencies.xml  | 28 
 phoenix-core/pom.xml|  8 +++---
 pom.xml |  8 +++---
 4 files changed, 51 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/408f9bdf/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index f11645a..f9d6d92 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -126,5 +126,20 @@
   org.apache.phoenix
   phoenix-queryserver-client
 
+
+  com.google.inject
+  guice
+  3.0
+
+
+  org.apache.omid
+  omid-hbase-tools-hbase1.x
+  ${omid.version}
+
+
+  org.apache.htrace
+  htrace-core
+  3.2.0-incubating
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/408f9bdf/phoenix-assembly/src/build/components/all-common-dependencies.xml
--
diff --git a/phoenix-assembly/src/build/components/all-common-dependencies.xml 
b/phoenix-assembly/src/build/components/all-common-dependencies.xml
index 336bc4d..84388cd 100644
--- a/phoenix-assembly/src/build/components/all-common-dependencies.xml
+++ b/phoenix-assembly/src/build/components/all-common-dependencies.xml
@@ -45,6 +45,34 @@
 io.netty:netty
 commons-codec:commons-codec
 org.apache.calcite:calcite-avatica*
+
+
+org.apache.omid:omid-tso-server-hbase1.x
+org.apache.omid:omid-hbase-common-hbase1.x
+org.apache.omid:omid-hbase-tools-hbase1.x
+org.apache.omid:omid-common
+org.apache.omid:omid-metrics
+org.apache.omid:omid-timestamp-storage-hbase1.x
+org.apache.omid:omid-hbase-shims-hbase1.x
+org.apache.omid:omid-commit-table
+org.apache.omid:omid-codahale-metrics
+org.apache.omid:omid-hbase-commit-table-hbase1.x
+org.yaml:snakeyaml
+com.google.inject:guice
+commons-beanutils:commons-beanutils
+javax.inject:javax.inject
+aopalliance:aopalliance
+org.apache.commons:commons-pool2
+com.lmax:disruptor
+com.codahale.metrics:metrics-core
+com.beust:jcommander
+commons-collections:commons-collections
+io.netty:netty-all
+org.apache.htrace:htrace-core
+javax.servlet:javax.servlet-api
+commons-cli:commons-cli
+com.yammer.metrics:metrics-core
+com.codahale.metrics:metrics-graphite
   
 
 

phoenix git commit: PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-23 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 b1cb0261c -> a6f17eb5d


PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells 
and no local indexes


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

Branch: refs/heads/4.x-HBase-1.2
Commit: a6f17eb5d1973b151e4603135c48911339ad604c
Parents: b1cb026
Author: James Taylor 
Authored: Tue Oct 16 23:49:23 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 23 09:31:48 2018 -0700

--
 .../phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java   | 9 ++---
 .../org/apache/phoenix/schema/stats/StatsCollectorIT.java   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6f17eb5/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 0a0dd21..9665fb6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -74,9 +74,12 @@ public class StatsEnabledSplitSystemCatalogIT extends 
BaseUniqueNamesOwnClusterI
this.tableDDLOptions = optionBuilder.toString();
}
 
-   @Parameters(name = "transactional = {0}")
-   public static Collection data() {
-   return Arrays.asList(new Object[] { null, "TEPHRA", "OMID" });
+   @Parameters(name = "transactionProvider = {0}")
+   public static Collection data() {
+return TestUtil.filterTxParamData(Arrays.asList(new Object[][] { 
+{ "TEPHRA" },
+{ "OMID" }, 
+{ null }}),0);
}

@BeforeClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6f17eb5/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
index 0caf61a..f1c4e45 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
@@ -635,7 +635,7 @@ public abstract class StatsCollectorIT extends 
BaseUniqueNamesOwnClusterIT {
 // an exact byte count based on the number or rows is not 
possible because
 // it is variable on a row-by-row basis.
 long sumOfGuidePostsWidth = rs.getLong(3);
-assertTrue(hasShadowCells ? sumOfGuidePostsWidth > 2 * c2Bytes 
&& sumOfGuidePostsWidth <= 3 * c2Bytes: rs.getLong(3) == c2Bytes);
+assertTrue(hasShadowCells ? sumOfGuidePostsWidth > c2Bytes : 
sumOfGuidePostsWidth == c2Bytes);
 count++;
 }
 }



[4/5] phoenix git commit: PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-23 Thread jamestaylor
PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells 
and no local indexes


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

Branch: refs/heads/omid2
Commit: 2ff316a8094fee089057e49d080cc8d0d0790531
Parents: 79ca071
Author: James Taylor 
Authored: Tue Oct 16 23:49:23 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 23 08:19:02 2018 -0700

--
 .../phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java   | 9 ++---
 .../org/apache/phoenix/schema/stats/StatsCollectorIT.java   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ff316a8/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 0a0dd21..9665fb6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -74,9 +74,12 @@ public class StatsEnabledSplitSystemCatalogIT extends 
BaseUniqueNamesOwnClusterI
this.tableDDLOptions = optionBuilder.toString();
}
 
-   @Parameters(name = "transactional = {0}")
-   public static Collection data() {
-   return Arrays.asList(new Object[] { null, "TEPHRA", "OMID" });
+   @Parameters(name = "transactionProvider = {0}")
+   public static Collection data() {
+return TestUtil.filterTxParamData(Arrays.asList(new Object[][] { 
+{ "TEPHRA" },
+{ "OMID" }, 
+{ null }}),0);
}

@BeforeClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ff316a8/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
index 0caf61a..f1c4e45 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
@@ -635,7 +635,7 @@ public abstract class StatsCollectorIT extends 
BaseUniqueNamesOwnClusterIT {
 // an exact byte count based on the number or rows is not 
possible because
 // it is variable on a row-by-row basis.
 long sumOfGuidePostsWidth = rs.getLong(3);
-assertTrue(hasShadowCells ? sumOfGuidePostsWidth > 2 * c2Bytes 
&& sumOfGuidePostsWidth <= 3 * c2Bytes: rs.getLong(3) == c2Bytes);
+assertTrue(hasShadowCells ? sumOfGuidePostsWidth > c2Bytes : 
sumOfGuidePostsWidth == c2Bytes);
 count++;
 }
 }



[3/5] phoenix git commit: PHOENIX-4988 Incorrect index rowkey generated when updating only non-indexed columns after a delete

2018-10-23 Thread jamestaylor
PHOENIX-4988 Incorrect index rowkey generated when updating only non-indexed 
columns after a delete


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

Branch: refs/heads/omid2
Commit: 79ca07134f86c5405da5111b4622ff74360e96ae
Parents: 3d5bae8
Author: Vincent Poon 
Authored: Mon Oct 22 10:59:33 2018 -0700
Committer: Vincent Poon 
Committed: Mon Oct 22 13:17:09 2018 -0700

--
 .../phoenix/end2end/index/MutableIndexIT.java   | 38 +++-
 .../filter/ApplyAndFilterDeletesFilter.java |  9 +++--
 2 files changed, 44 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/79ca0713/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
index a994094..5415e87 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
@@ -60,6 +60,7 @@ import org.apache.phoenix.schema.PIndexState;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
+import org.apache.phoenix.util.IndexScrutiny;
 import org.apache.phoenix.util.IndexUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -948,7 +949,42 @@ public class MutableIndexIT extends 
ParallelStatsDisabledIT {
   assertEquals(1, rs.getInt(2));
   assertEquals(0.5F, rs.getFloat(1), 0.0);
   assertEquals("foo", rs.getString(3));
-  } 
+  }
+  }
+
+  /**
+   * PHOENIX-4988
+   * Test updating only a non-indexed column after two successive deletes to 
an indexed row
+   */
+  @Test
+  public void testUpdateNonIndexedColumn() throws Exception {
+  String tableName = "TBL_" + generateUniqueName();
+  String indexName = "IDX_" + generateUniqueName();
+  String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
+  String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
+  try (Connection conn = getConnection()) {
+  conn.setAutoCommit(false);
+  conn.createStatement().execute("CREATE TABLE " + fullTableName + " 
(k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) " + tableDDLOptions);
+  conn.createStatement().execute("CREATE " + (localIndex ? " LOCAL " : 
"") + " INDEX " + indexName + " ON " + fullTableName + " (v2)");
+  conn.createStatement().executeUpdate("UPSERT INTO " + fullTableName 
+ "(k,v1,v2) VALUES ('testKey','v1_1','v2_1')");
+  conn.commit();
+  conn.createStatement().executeUpdate("DELETE FROM " + fullTableName);
+  conn.commit();
+  conn.createStatement().executeUpdate("UPSERT INTO " + fullTableName 
+ "(k,v1,v2) VALUES ('testKey','v1_2','v2_2')");
+  conn.commit();
+  conn.createStatement().executeUpdate("DELETE FROM " + fullTableName);
+  conn.commit();
+  conn.createStatement().executeUpdate("UPSERT INTO " + fullTableName 
+ "(k,v1) VALUES ('testKey','v1_3')");
+  conn.commit();
+  IndexScrutiny.scrutinizeIndex(conn, fullTableName, fullIndexName);
+  // PHOENIX-4980
+  // When there is a flush after a data table update of non-indexed 
columns, the
+  // index gets out of sync on the next write
+  getUtility().getHBaseAdmin().flush(TableName.valueOf(fullTableName));
+  conn.createStatement().executeUpdate("UPSERT INTO " + fullTableName 
+ "(k,v1,v2) VALUES ('testKey','v1_4','v2_3')");
+  conn.commit();
+  IndexScrutiny.scrutinizeIndex(conn, fullTableName, fullIndexName);
+  }
   }
 
 private void upsertRow(String dml, Connection tenantConn, int i) throws 
SQLException {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/79ca0713/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
index a1f01ed..b5c3414 100644
--- 

[1/5] phoenix git commit: PHOENIX-4963 Do not throw when transitioning to PENDING_DISABLE if index is already disabled

2018-10-23 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 688456889 -> f66538074


PHOENIX-4963 Do not throw when transitioning to PENDING_DISABLE if index is 
already disabled


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

Branch: refs/heads/omid2
Commit: 4a05f1489f1293a889e8ff3ca90348dce889e847
Parents: 6b345db
Author: Vincent Poon 
Authored: Tue Oct 16 16:13:11 2018 -0700
Committer: Vincent Poon 
Committed: Tue Oct 16 16:16:19 2018 -0700

--
 .../phoenix/coprocessor/MetaDataEndpointImpl.java| 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4a05f148/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 83c7f4d..21370f3 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -3949,6 +3949,14 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 return;
 }
 } else if (currentState == PIndexState.DISABLE) {
+// Index already disabled, so can't revert to 
PENDING_DISABLE
+if (newState == PIndexState.PENDING_DISABLE) {
+// returning TABLE_ALREADY_EXISTS here means the 
client doesn't throw an exception
+
builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS);
+
builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+done.run(builder.build());
+return;
+}
 // Can't transition back to INACTIVE if 
INDEX_DISABLE_TIMESTAMP is 0
 if (newState != PIndexState.BUILDING && newState != 
PIndexState.DISABLE &&
 (newState != PIndexState.INACTIVE || curTimeStampVal 
== 0)) {
@@ -3961,13 +3969,6 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 if (newState == PIndexState.ACTIVE) {
 newState = PIndexState.DISABLE;
 }
-// Can't transition from DISABLE to PENDING_DISABLE
-if (newState == PIndexState.PENDING_DISABLE) {
-
builder.setReturnCode(MetaDataProtos.MutationCode.UNALLOWED_TABLE_MUTATION);
-
builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
-done.run(builder.build());
-return;
-}
 }
 if (newState == PIndexState.PENDING_DISABLE && currentState != 
PIndexState.PENDING_DISABLE) {
 // reset count for first PENDING_DISABLE



[5/5] phoenix git commit: Merge branch '4.x-HBase-1.3' into omid2

2018-10-23 Thread jamestaylor
Merge branch '4.x-HBase-1.3' into omid2


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

Branch: refs/heads/omid2
Commit: f66538074d9c5b58a29f795403c477548de12a0f
Parents: 6884568 2ff316a
Author: James Taylor 
Authored: Tue Oct 23 09:24:33 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 23 09:24:33 2018 -0700

--
 .../StatsEnabledSplitSystemCatalogIT.java   |  9 +++--
 .../phoenix/end2end/index/MutableIndexIT.java   | 38 +++-
 .../coprocessor/MetaDataEndpointImpl.java   | 19 ++
 .../filter/ApplyAndFilterDeletesFilter.java |  9 +++--
 4 files changed, 62 insertions(+), 13 deletions(-)
--




[2/5] phoenix git commit: PHOENIX-4960 Write to table with global index failed if meta of index changed (split, move, etc)

2018-10-23 Thread jamestaylor
PHOENIX-4960 Write to table with global index failed if meta of index changed 
(split, move, etc)


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

Branch: refs/heads/omid2
Commit: 3d5bae8dcd79651fdd10333f88a2ab8ee37303bf
Parents: 4a05f14
Author: Vincent Poon 
Authored: Mon Oct 15 19:11:40 2018 -0700
Committer: Vincent Poon 
Committed: Mon Oct 22 12:04:15 2018 -0700

--
 .../org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3d5bae8d/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 21370f3..aa78b1b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -3987,6 +3987,10 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 newKVs.remove(disableTimeStampKVIndex);
 newKVs.set(indexStateKVIndex, 
KeyValueUtil.newKeyValue(key, TABLE_FAMILY_BYTES,
 INDEX_STATE_BYTES, timeStamp, 
Bytes.toBytes(newState.getSerializedValue(;
+} else if (disableTimeStampKVIndex == -1) { // clear 
disableTimestamp if client didn't pass it in
+newKVs.add(KeyValueUtil.newKeyValue(key, 
TABLE_FAMILY_BYTES,
+
PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP_BYTES, timeStamp, 
PLong.INSTANCE.toBytes(0)));
+disableTimeStampKVIndex = newKVs.size() - 1;
 }
 } else if (newState == PIndexState.DISABLE) {
 //reset the counter for pending disable when 
transitioning from PENDING_DISABLE to DISABLE



phoenix git commit: PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-23 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 72d6109cd -> 0c28ea285


PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells 
and no local indexes


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

Branch: refs/heads/master
Commit: 0c28ea2856aa0798953b790c002644969a36ae5e
Parents: 72d6109
Author: James Taylor 
Authored: Tue Oct 16 23:49:23 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 23 09:20:49 2018 -0700

--
 .../phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java   | 9 ++---
 .../org/apache/phoenix/schema/stats/StatsCollectorIT.java   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c28ea28/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 0a0dd21..9665fb6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -74,9 +74,12 @@ public class StatsEnabledSplitSystemCatalogIT extends 
BaseUniqueNamesOwnClusterI
this.tableDDLOptions = optionBuilder.toString();
}
 
-   @Parameters(name = "transactional = {0}")
-   public static Collection data() {
-   return Arrays.asList(new Object[] { null, "TEPHRA", "OMID" });
+   @Parameters(name = "transactionProvider = {0}")
+   public static Collection data() {
+return TestUtil.filterTxParamData(Arrays.asList(new Object[][] { 
+{ "TEPHRA" },
+{ "OMID" }, 
+{ null }}),0);
}

@BeforeClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c28ea28/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
index feec3fb..21258e0 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
@@ -635,7 +635,7 @@ public abstract class StatsCollectorIT extends 
BaseUniqueNamesOwnClusterIT {
 // an exact byte count based on the number or rows is not 
possible because
 // it is variable on a row-by-row basis.
 long sumOfGuidePostsWidth = rs.getLong(3);
-assertTrue(hasShadowCells ? sumOfGuidePostsWidth > 2 * c2Bytes 
&& sumOfGuidePostsWidth <= 3 * c2Bytes: rs.getLong(3) == c2Bytes);
+assertTrue(hasShadowCells ? sumOfGuidePostsWidth > c2Bytes : 
sumOfGuidePostsWidth == c2Bytes);
 count++;
 }
 }



phoenix git commit: PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-23 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.4 73951ac8c -> 305a8dba4


PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells 
and no local indexes


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

Branch: refs/heads/4.x-HBase-1.4
Commit: 305a8dba482a3befe4271aac6b16764038f0053b
Parents: 73951ac
Author: James Taylor 
Authored: Tue Oct 16 23:49:23 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 23 09:18:05 2018 -0700

--
 .../phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java   | 9 ++---
 .../org/apache/phoenix/schema/stats/StatsCollectorIT.java   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/305a8dba/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 0a0dd21..9665fb6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -74,9 +74,12 @@ public class StatsEnabledSplitSystemCatalogIT extends 
BaseUniqueNamesOwnClusterI
this.tableDDLOptions = optionBuilder.toString();
}
 
-   @Parameters(name = "transactional = {0}")
-   public static Collection data() {
-   return Arrays.asList(new Object[] { null, "TEPHRA", "OMID" });
+   @Parameters(name = "transactionProvider = {0}")
+   public static Collection data() {
+return TestUtil.filterTxParamData(Arrays.asList(new Object[][] { 
+{ "TEPHRA" },
+{ "OMID" }, 
+{ null }}),0);
}

@BeforeClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/305a8dba/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
index 0caf61a..f1c4e45 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
@@ -635,7 +635,7 @@ public abstract class StatsCollectorIT extends 
BaseUniqueNamesOwnClusterIT {
 // an exact byte count based on the number or rows is not 
possible because
 // it is variable on a row-by-row basis.
 long sumOfGuidePostsWidth = rs.getLong(3);
-assertTrue(hasShadowCells ? sumOfGuidePostsWidth > 2 * c2Bytes 
&& sumOfGuidePostsWidth <= 3 * c2Bytes: rs.getLong(3) == c2Bytes);
+assertTrue(hasShadowCells ? sumOfGuidePostsWidth > c2Bytes : 
sumOfGuidePostsWidth == c2Bytes);
 count++;
 }
 }



phoenix git commit: PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-23 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 79ca07134 -> 2ff316a80


PHOENIX-4975 Addendum to fix failing unit tests for Omid due to shadow cells 
and no local indexes


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 2ff316a8094fee089057e49d080cc8d0d0790531
Parents: 79ca071
Author: James Taylor 
Authored: Tue Oct 16 23:49:23 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 23 08:19:02 2018 -0700

--
 .../phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java   | 9 ++---
 .../org/apache/phoenix/schema/stats/StatsCollectorIT.java   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ff316a8/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 0a0dd21..9665fb6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -74,9 +74,12 @@ public class StatsEnabledSplitSystemCatalogIT extends 
BaseUniqueNamesOwnClusterI
this.tableDDLOptions = optionBuilder.toString();
}
 
-   @Parameters(name = "transactional = {0}")
-   public static Collection data() {
-   return Arrays.asList(new Object[] { null, "TEPHRA", "OMID" });
+   @Parameters(name = "transactionProvider = {0}")
+   public static Collection data() {
+return TestUtil.filterTxParamData(Arrays.asList(new Object[][] { 
+{ "TEPHRA" },
+{ "OMID" }, 
+{ null }}),0);
}

@BeforeClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ff316a8/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
index 0caf61a..f1c4e45 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
@@ -635,7 +635,7 @@ public abstract class StatsCollectorIT extends 
BaseUniqueNamesOwnClusterIT {
 // an exact byte count based on the number or rows is not 
possible because
 // it is variable on a row-by-row basis.
 long sumOfGuidePostsWidth = rs.getLong(3);
-assertTrue(hasShadowCells ? sumOfGuidePostsWidth > 2 * c2Bytes 
&& sumOfGuidePostsWidth <= 3 * c2Bytes: rs.getLong(3) == c2Bytes);
+assertTrue(hasShadowCells ? sumOfGuidePostsWidth > c2Bytes : 
sumOfGuidePostsWidth == c2Bytes);
 count++;
 }
 }



phoenix git commit: PHOENIX-4987 Update Omid version to latest on master

2018-10-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 f7e578467 -> 8e4590ed6


PHOENIX-4987 Update Omid version to latest on master


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

Branch: refs/heads/omid2
Commit: 8e4590ed6f6b36e6ead7d547d2761c4951522841
Parents: f7e5784
Author: James Taylor 
Authored: Fri Oct 19 09:06:56 2018 -0700
Committer: James Taylor 
Committed: Fri Oct 19 09:06:56 2018 -0700

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8e4590ed/pom.xml
--
diff --git a/pom.xml b/pom.xml
index f6a8a6a..6facc35 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,7 +101,7 @@
 1.12.0
 8.1.7.v20120910
 0.15.0-incubating
-0.8.2.11-SNAPSHOT
+0.9.1.0-SNAPSHOT
 2.0.2
 2.11.8
 2.11



phoenix git commit: PHOENIX-4986 Support low latency version of Omid (Yonatan Gottesman) [Forced Update!]

2018-10-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 0e54b313e -> f7e578467 (forced update)


PHOENIX-4986 Support low latency version of Omid (Yonatan Gottesman)


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

Branch: refs/heads/omid2
Commit: f7e5784676f4dd618b52d985db8cd0b7de1a
Parents: 8a52aa4
Author: James Taylor 
Authored: Fri Oct 19 08:09:34 2018 -0700
Committer: James Taylor 
Committed: Fri Oct 19 08:22:02 2018 -0700

--
 .../apache/phoenix/transaction/OmidTransactionContext.java| 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f7e57846/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
index f36ef6e..6093f88 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
@@ -70,7 +70,8 @@ public class OmidTransactionContext implements 
PhoenixTransactionContext {
 this();
 if (txnBytes != null && txnBytes.length > 0) {
 TSOProto.Transaction transaction = 
TSOProto.Transaction.parseFrom(txnBytes);
-tx = new HBaseTransaction(transaction.getTimestamp(), 
transaction.getEpoch(), new HashSet(), new HashSet(), 
null);
+tx = new HBaseTransaction(transaction.getTimestamp(), 
transaction.getEpoch(), new HashSet(),
+new HashSet(), null, tm.isLowLatency());
 } else {
 tx = null;
 }
@@ -85,7 +86,9 @@ public class OmidTransactionContext implements 
PhoenixTransactionContext {
 if (subTask) {
 if (omidTransactionContext.isTransactionRunning()) {
 Transaction transaction = 
omidTransactionContext.getTransaction();
-this.tx = new HBaseTransaction(transaction.getTransactionId(), 
transaction.getEpoch(), new HashSet(), new HashSet(), 
this.tm, transaction.getReadTimestamp(), transaction.getWriteTimestamp());
+this.tx = new HBaseTransaction(transaction.getTransactionId(), 
transaction.getEpoch(),
+new HashSet(), new 
HashSet(), this.tm,
+transaction.getReadTimestamp(), 
transaction.getWriteTimestamp(), tm.isLowLatency());
 } else {
 this.tx = null;
 }



phoenix git commit: PHOENIX-4986 Support low latency version of Omid

2018-10-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 8a52aa40b -> 0e54b313e


PHOENIX-4986 Support low latency version of Omid


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

Branch: refs/heads/omid2
Commit: 0e54b313e7fca2e7a4142cf0aaef4c6750fa7548
Parents: 8a52aa4
Author: James Taylor 
Authored: Fri Oct 19 08:09:34 2018 -0700
Committer: James Taylor 
Committed: Fri Oct 19 08:09:34 2018 -0700

--
 .../apache/phoenix/transaction/OmidTransactionContext.java| 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0e54b313/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
index f36ef6e..6093f88 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
@@ -70,7 +70,8 @@ public class OmidTransactionContext implements 
PhoenixTransactionContext {
 this();
 if (txnBytes != null && txnBytes.length > 0) {
 TSOProto.Transaction transaction = 
TSOProto.Transaction.parseFrom(txnBytes);
-tx = new HBaseTransaction(transaction.getTimestamp(), 
transaction.getEpoch(), new HashSet(), new HashSet(), 
null);
+tx = new HBaseTransaction(transaction.getTimestamp(), 
transaction.getEpoch(), new HashSet(),
+new HashSet(), null, tm.isLowLatency());
 } else {
 tx = null;
 }
@@ -85,7 +86,9 @@ public class OmidTransactionContext implements 
PhoenixTransactionContext {
 if (subTask) {
 if (omidTransactionContext.isTransactionRunning()) {
 Transaction transaction = 
omidTransactionContext.getTransaction();
-this.tx = new HBaseTransaction(transaction.getTransactionId(), 
transaction.getEpoch(), new HashSet(), new HashSet(), 
this.tm, transaction.getReadTimestamp(), transaction.getWriteTimestamp());
+this.tx = new HBaseTransaction(transaction.getTransactionId(), 
transaction.getEpoch(),
+new HashSet(), new 
HashSet(), this.tm,
+transaction.getReadTimestamp(), 
transaction.getWriteTimestamp(), tm.isLowLatency());
 } else {
 this.tx = null;
 }



phoenix git commit: PHOENIX-4975 Addendum to fix unit tests

2018-10-17 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 98f33e323 -> 8a52aa40b


PHOENIX-4975 Addendum to fix unit tests


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

Branch: refs/heads/omid2
Commit: 8a52aa40b75013afedc6bdbc2908c118d49d4304
Parents: 98f33e3
Author: James Taylor 
Authored: Tue Oct 16 23:49:23 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 23:49:23 2018 -0700

--
 .../it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8a52aa40/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
index 0caf61a..f1c4e45 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/schema/stats/StatsCollectorIT.java
@@ -635,7 +635,7 @@ public abstract class StatsCollectorIT extends 
BaseUniqueNamesOwnClusterIT {
 // an exact byte count based on the number or rows is not 
possible because
 // it is variable on a row-by-row basis.
 long sumOfGuidePostsWidth = rs.getLong(3);
-assertTrue(hasShadowCells ? sumOfGuidePostsWidth > 2 * c2Bytes 
&& sumOfGuidePostsWidth <= 3 * c2Bytes: rs.getLong(3) == c2Bytes);
+assertTrue(hasShadowCells ? sumOfGuidePostsWidth > c2Bytes : 
sumOfGuidePostsWidth == c2Bytes);
 count++;
 }
 }



phoenix git commit: PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master c3c51180b -> 43e1ade90


PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local 
indexes


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

Branch: refs/heads/master
Commit: 43e1ade90b62ff7e112e48a79f882ce8f31b397f
Parents: c3c5118
Author: James Taylor 
Authored: Tue Oct 16 09:16:43 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:48:50 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 16 --
 .../StatsEnabledSplitSystemCatalogIT.java   | 30 +++
 .../java/org/apache/phoenix/end2end/ViewIT.java | 18 +--
 .../phoenix/schema/stats/StatsCollectorIT.java  | 54 
 4 files changed, 80 insertions(+), 38 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/43e1ade9/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index 98076e5..eec88a0 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -48,6 +48,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.index.IndexTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -110,12 +112,18 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 public static Collection data() {
 List list = Lists.newArrayListWithExpectedSize(48);
 boolean[] Booleans = new boolean[] { false, true };
-for (Object transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
+for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-for (boolean directApi : Booleans) {
-for (boolean useSnapshot : Booleans) {
-list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+if (!localIndex 
+|| transactionProvider == null 
+|| !TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+for (boolean directApi : Booleans) {
+for (boolean useSnapshot : Booleans) {
+list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/43e1ade9/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index d6101bf..0a0dd21 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -45,6 +45,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ReadOnlyTableException;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.SchemaUtil;
@@ -61,20 +63,20 @@ import com.google.common.collect.Maps;
 public class StatsEnabledSplitSystemCatalogIT extends 
BaseUniqueNamesOwnClusterIT {

private String tableDDLOptions;
-   private boolean transactional;
+   private 

[1/5] phoenix git commit: PHOENIX-4942 Move MetaDataEndpointImplTest to integration test

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 77a7c2c30 -> 98f33e323


PHOENIX-4942 Move MetaDataEndpointImplTest to integration test


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

Branch: refs/heads/omid2
Commit: 3763709e8a57534d1a1a81892a62ad363c36bcdf
Parents: db02372
Author: Thomas D'Silva 
Authored: Mon Oct 15 22:17:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Oct 15 22:18:49 2018 -0700

--
 .../phoenix/end2end/MetaDataEndpointImplIT.java | 301 +++
 .../coprocessor/MetaDataEndpointImplTest.java   | 299 --
 2 files changed, 301 insertions(+), 299 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3763709e/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetaDataEndpointImplIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetaDataEndpointImplIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetaDataEndpointImplIT.java
new file mode 100644
index 000..f14af9e
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetaDataEndpointImplIT.java
@@ -0,0 +1,301 @@
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.phoenix.coprocessor.TableViewFinderResult;
+import org.apache.phoenix.coprocessor.ViewFinder;
+import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.schema.PColumn;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.TableNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.junit.Test;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * 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.
+ */
+public class MetaDataEndpointImplIT extends ParallelStatsDisabledIT {
+private final TableName catalogTable = 
TableName.valueOf(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES);
+private final TableName linkTable = 
TableName.valueOf(PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME_BYTES);
+
+/*
+  The tree structure is as follows: Where ParentTable is the Base Table
+  and all children are views and child views respectively.
+
+ParentTable
+  / \
+leftChild   rightChild
+  /
+   leftGrandChild
+ */
+
+@Test
+public void testGettingChildrenAndParentViews() throws Exception {
+String baseTable = generateUniqueName();
+String leftChild = generateUniqueName();
+String rightChild = generateUniqueName();
+String leftGrandChild = generateUniqueName();
+Connection conn = DriverManager.getConnection(getUrl());
+String ddlFormat =
+"CREATE TABLE IF NOT EXISTS " + baseTable + "  (" + " PK2 VARCHAR 
NOT NULL, V1 VARCHAR, V2 VARCHAR "
++ " CONSTRAINT NAME_PK PRIMARY KEY (PK2)" + " )";
+conn.createStatement().execute(ddlFormat);
+
+conn.createStatement().execute("CREATE VIEW " + rightChild + " AS 
SELECT * FROM " + baseTable);
+conn.createStatement().execute("CREATE VIEW " + leftChild + " (carrier 
VARCHAR) AS SELECT * FROM " + baseTable);
+

[4/5] phoenix git commit: Revert "Revert "PHOENIX-4874 psql doesn't support date/time with values smaller than milliseconds(Rajeshbabu)""

2018-10-16 Thread jamestaylor
Revert "Revert "PHOENIX-4874 psql doesn't support date/time with values smaller 
than milliseconds(Rajeshbabu)""

This reverts commit 0ce663c53089efa9821a4423fb973b274ef67638.


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

Branch: refs/heads/omid2
Commit: 4c63e129277757929c4cf847b66fcd55b2c8e801
Parents: 77a7c2c
Author: James Taylor 
Authored: Tue Oct 16 14:45:05 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:45:05 2018 -0700

--
 .../phoenix/util/csv/CsvUpsertExecutor.java | 20 +---
 .../phoenix/util/json/JsonUpsertExecutor.java   |  3 ++
 .../util/AbstractUpsertExecutorTest.java| 51 +++-
 3 files changed, 54 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c63e129/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
index cd40b44..d2529f7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.util.csv;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.List;
 import java.util.Properties;
@@ -30,6 +31,7 @@ import org.apache.commons.csv.CSVRecord;
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.expression.function.EncodeFormat;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.IllegalDataException;
@@ -41,6 +43,7 @@ import org.apache.phoenix.schema.types.PTimestamp;
 import org.apache.phoenix.schema.types.PVarbinary;
 import org.apache.phoenix.util.ColumnInfo;
 import org.apache.phoenix.util.DateUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
 import org.apache.phoenix.util.UpsertExecutor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -125,9 +128,9 @@ public class CsvUpsertExecutor extends 
UpsertExecutor {
 private final String binaryEncoding;
 
 SimpleDatatypeConversionFunction(PDataType dataType, Connection conn) {
-Properties props;
+ReadOnlyProps props;
 try {
-props = conn.getClientInfo();
+props = 
conn.unwrap(PhoenixConnection.class).getQueryServices().getProps();
 } catch (SQLException e) {
 throw new RuntimeException(e);
 }
@@ -139,23 +142,23 @@ public class CsvUpsertExecutor extends 
UpsertExecutor {
 String dateFormat;
 int dateSqlType = dataType.getResultSetSqlType();
 if (dateSqlType == Types.DATE) {
-dateFormat = 
props.getProperty(QueryServices.DATE_FORMAT_ATTRIB,
+dateFormat = props.get(QueryServices.DATE_FORMAT_ATTRIB,
 DateUtil.DEFAULT_DATE_FORMAT);
 } else if (dateSqlType == Types.TIME) {
-dateFormat = 
props.getProperty(QueryServices.TIME_FORMAT_ATTRIB,
+dateFormat = props.get(QueryServices.TIME_FORMAT_ATTRIB,
 DateUtil.DEFAULT_TIME_FORMAT);
 } else {
-dateFormat = 
props.getProperty(QueryServices.TIMESTAMP_FORMAT_ATTRIB,
+dateFormat = 
props.get(QueryServices.TIMESTAMP_FORMAT_ATTRIB,
 DateUtil.DEFAULT_TIMESTAMP_FORMAT);

 }
-String timeZoneId = 
props.getProperty(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB,
+String timeZoneId = 
props.get(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB,
 QueryServicesOptions.DEFAULT_DATE_FORMAT_TIMEZONE);
 this.dateTimeParser = DateUtil.getDateTimeParser(dateFormat, 
dataType, timeZoneId);
 } else {
 this.dateTimeParser = null;
 }
 this.codec = codec;
-this.binaryEncoding = 
props.getProperty(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING,
+this.binaryEncoding = 
props.get(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING,
 

[5/5] phoenix git commit: Merge branch '4.x-HBase-1.3' into omid2

2018-10-16 Thread jamestaylor
Merge branch '4.x-HBase-1.3' into omid2


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

Branch: refs/heads/omid2
Commit: 98f33e3233406bcbf8ed734843d63fff663be59f
Parents: 4c63e12 6b345db
Author: James Taylor 
Authored: Tue Oct 16 14:46:09 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:46:09 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java |   3 +-
 .../phoenix/end2end/MetaDataEndpointImplIT.java | 301 +++
 .../coprocessor/MetaDataEndpointImplTest.java   | 299 --
 .../util/AbstractUpsertExecutorTest.java|   7 -
 4 files changed, 303 insertions(+), 307 deletions(-)
--




[3/5] phoenix git commit: PHOENIX-4874 psql doesn't support date/time with values smaller than milliseconds-addendum(Rajeshbabu)

2018-10-16 Thread jamestaylor
PHOENIX-4874 psql doesn't support date/time with values smaller than 
milliseconds-addendum(Rajeshbabu)


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

Branch: refs/heads/omid2
Commit: 6b345dba337c4e27e34ee9387bd2e5db2926ca95
Parents: ae27c79
Author: Rajeshbabu Chintaguntla 
Authored: Tue Oct 16 21:23:21 2018 +0530
Committer: James Taylor 
Committed: Tue Oct 16 14:36:04 2018 -0700

--
 .../org/apache/phoenix/util/AbstractUpsertExecutorTest.java   | 7 ---
 1 file changed, 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b345dba/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
index 3ea997b..3b3ebff 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
@@ -25,20 +25,14 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import java.io.IOException;
 import java.sql.Connection;
-import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatterBuilder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
-import java.util.TimeZone;
 
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -48,7 +42,6 @@ import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PBinary;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PIntegerArray;
-import org.apache.phoenix.schema.types.PTimestamp;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;



[2/5] phoenix git commit: PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-16 Thread jamestaylor
PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local 
indexes


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

Branch: refs/heads/omid2
Commit: ae27c792e327ce50cfbf5ebae62e34f545b6eb9c
Parents: 3763709
Author: James Taylor 
Authored: Tue Oct 16 09:16:43 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:30:35 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 16 --
 .../StatsEnabledSplitSystemCatalogIT.java   | 34 +++-
 .../java/org/apache/phoenix/end2end/ViewIT.java | 18 +--
 .../phoenix/schema/stats/StatsCollectorIT.java  | 54 
 4 files changed, 82 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae27c792/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index b8372c4..c99f145 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -49,6 +49,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.index.IndexTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -111,12 +113,18 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 public static Collection data() {
 List list = Lists.newArrayListWithExpectedSize(48);
 boolean[] Booleans = new boolean[] { false, true };
-for (Object transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
+for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-for (boolean directApi : Booleans) {
-for (boolean useSnapshot : Booleans) {
-list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+if (!localIndex 
+|| transactionProvider == null 
+|| !TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+for (boolean directApi : Booleans) {
+for (boolean useSnapshot : Booleans) {
+list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae27c792/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 197263f..0a0dd21 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -34,10 +34,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -45,6 +45,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ReadOnlyTableException;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import 

[2/2] phoenix git commit: PHOENIX-4874 psql doesn't support date/time with values smaller than milliseconds-addendum(Rajeshbabu)

2018-10-16 Thread jamestaylor
PHOENIX-4874 psql doesn't support date/time with values smaller than 
milliseconds-addendum(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.4
Commit: 931aebcd8d896e526ed03a828d9020754ade1697
Parents: c96260d
Author: Rajeshbabu Chintaguntla 
Authored: Tue Oct 16 21:23:21 2018 +0530
Committer: James Taylor 
Committed: Tue Oct 16 14:42:10 2018 -0700

--
 .../org/apache/phoenix/util/AbstractUpsertExecutorTest.java   | 7 ---
 1 file changed, 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/931aebcd/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
index 3ea997b..3b3ebff 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
@@ -25,20 +25,14 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import java.io.IOException;
 import java.sql.Connection;
-import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatterBuilder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
-import java.util.TimeZone;
 
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -48,7 +42,6 @@ import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PBinary;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PIntegerArray;
-import org.apache.phoenix.schema.types.PTimestamp;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;



[1/2] phoenix git commit: PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.4 1b561ce85 -> 931aebcd8


PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local 
indexes


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

Branch: refs/heads/4.x-HBase-1.4
Commit: c96260d75bb4cffa1acdf8f9e0ca27e8a05e2b02
Parents: 1b561ce
Author: James Taylor 
Authored: Tue Oct 16 09:16:43 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:42:06 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 16 --
 .../StatsEnabledSplitSystemCatalogIT.java   | 34 +++-
 .../java/org/apache/phoenix/end2end/ViewIT.java | 18 +--
 .../phoenix/schema/stats/StatsCollectorIT.java  | 54 
 4 files changed, 82 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c96260d7/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index b8372c4..c99f145 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -49,6 +49,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.index.IndexTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -111,12 +113,18 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 public static Collection data() {
 List list = Lists.newArrayListWithExpectedSize(48);
 boolean[] Booleans = new boolean[] { false, true };
-for (Object transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
+for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-for (boolean directApi : Booleans) {
-for (boolean useSnapshot : Booleans) {
-list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+if (!localIndex 
+|| transactionProvider == null 
+|| !TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+for (boolean directApi : Booleans) {
+for (boolean useSnapshot : Booleans) {
+list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c96260d7/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 197263f..0a0dd21 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -34,10 +34,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -45,6 +45,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ReadOnlyTableException;

[2/2] phoenix git commit: PHOENIX-4874 psql doesn't support date/time with values smaller than milliseconds-addendum(Rajeshbabu)

2018-10-16 Thread jamestaylor
PHOENIX-4874 psql doesn't support date/time with values smaller than 
milliseconds-addendum(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.2
Commit: ce16fcaef0547e250f85cbfc9c6d92db0cf7a0fb
Parents: 9ec91f27
Author: Rajeshbabu Chintaguntla 
Authored: Tue Oct 16 21:23:21 2018 +0530
Committer: James Taylor 
Committed: Tue Oct 16 14:39:19 2018 -0700

--
 .../org/apache/phoenix/util/AbstractUpsertExecutorTest.java   | 7 ---
 1 file changed, 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ce16fcae/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
index 3ea997b..3b3ebff 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
@@ -25,20 +25,14 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import java.io.IOException;
 import java.sql.Connection;
-import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatterBuilder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
-import java.util.TimeZone;
 
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -48,7 +42,6 @@ import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PBinary;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PIntegerArray;
-import org.apache.phoenix.schema.types.PTimestamp;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;



[1/2] phoenix git commit: PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 280412183 -> ce16fcaef


PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local 
indexes


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 9ec91f274e019066d312d60ac6f80f5abacf71c5
Parents: 2804121
Author: James Taylor 
Authored: Tue Oct 16 09:16:43 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:38:57 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 16 --
 .../StatsEnabledSplitSystemCatalogIT.java   | 34 +++-
 .../java/org/apache/phoenix/end2end/ViewIT.java | 18 +--
 .../phoenix/schema/stats/StatsCollectorIT.java  | 54 
 4 files changed, 82 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ec91f27/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index b8372c4..c99f145 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -49,6 +49,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.index.IndexTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -111,12 +113,18 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 public static Collection data() {
 List list = Lists.newArrayListWithExpectedSize(48);
 boolean[] Booleans = new boolean[] { false, true };
-for (Object transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
+for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-for (boolean directApi : Booleans) {
-for (boolean useSnapshot : Booleans) {
-list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+if (!localIndex 
+|| transactionProvider == null 
+|| !TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+for (boolean directApi : Booleans) {
+for (boolean useSnapshot : Booleans) {
+list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ec91f27/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 197263f..0a0dd21 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -34,10 +34,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -45,6 +45,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ReadOnlyTableException;

phoenix git commit: PHOENIX-4874 psql doesn't support date/time with values smaller than milliseconds-addendum(Rajeshbabu)

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 ae27c792e -> 6b345dba3


PHOENIX-4874 psql doesn't support date/time with values smaller than 
milliseconds-addendum(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 6b345dba337c4e27e34ee9387bd2e5db2926ca95
Parents: ae27c79
Author: Rajeshbabu Chintaguntla 
Authored: Tue Oct 16 21:23:21 2018 +0530
Committer: James Taylor 
Committed: Tue Oct 16 14:36:04 2018 -0700

--
 .../org/apache/phoenix/util/AbstractUpsertExecutorTest.java   | 7 ---
 1 file changed, 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b345dba/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
index 3ea997b..3b3ebff 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/util/AbstractUpsertExecutorTest.java
@@ -25,20 +25,14 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import java.io.IOException;
 import java.sql.Connection;
-import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatterBuilder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
-import java.util.TimeZone;
 
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -48,7 +42,6 @@ import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PBinary;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PIntegerArray;
-import org.apache.phoenix.schema.types.PTimestamp;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;



phoenix git commit: PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 3763709e8 -> ae27c792e


PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local 
indexes


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

Branch: refs/heads/4.x-HBase-1.3
Commit: ae27c792e327ce50cfbf5ebae62e34f545b6eb9c
Parents: 3763709
Author: James Taylor 
Authored: Tue Oct 16 09:16:43 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:30:35 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 16 --
 .../StatsEnabledSplitSystemCatalogIT.java   | 34 +++-
 .../java/org/apache/phoenix/end2end/ViewIT.java | 18 +--
 .../phoenix/schema/stats/StatsCollectorIT.java  | 54 
 4 files changed, 82 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae27c792/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index b8372c4..c99f145 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -49,6 +49,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.index.IndexTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -111,12 +113,18 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 public static Collection data() {
 List list = Lists.newArrayListWithExpectedSize(48);
 boolean[] Booleans = new boolean[] { false, true };
-for (Object transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
+for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-for (boolean directApi : Booleans) {
-for (boolean useSnapshot : Booleans) {
-list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+if (!localIndex 
+|| transactionProvider == null 
+|| !TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+for (boolean directApi : Booleans) {
+for (boolean useSnapshot : Booleans) {
+list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae27c792/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 197263f..0a0dd21 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -34,10 +34,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -45,6 +45,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ReadOnlyTableException;

phoenix git commit: PHOENIX-4975 Addendum to fix NPE

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 e9cd0a420 -> 77a7c2c30


PHOENIX-4975 Addendum to fix NPE


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

Branch: refs/heads/omid2
Commit: 77a7c2c306682ae13499a5797a82ebc94cfa453b
Parents: e9cd0a4
Author: James Taylor 
Authored: Tue Oct 16 14:00:54 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 14:00:54 2018 -0700

--
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java   | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/77a7c2c3/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index c53cd7c..b0c151d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -116,9 +116,10 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-if (!TransactionFactory.getTransactionProvider(
-
TransactionFactory.Provider.valueOf(transactionProvider))
-.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+if (transactionProvider == null 
+|| !TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
 for (boolean directApi : Booleans) {
 for (boolean useSnapshot : Booleans) {
 list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });



phoenix git commit: PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local indexes

2018-10-16 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 0ce663c53 -> e9cd0a420


PHOENIX-4975 Fix failing unit tests for Omid due to shadow cells and no local 
indexes


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

Branch: refs/heads/omid2
Commit: e9cd0a420615599d234f577fce49f10d9ae1c11a
Parents: 0ce663c
Author: James Taylor 
Authored: Tue Oct 16 09:16:43 2018 -0700
Committer: James Taylor 
Committed: Tue Oct 16 09:16:43 2018 -0700

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 14 +++--
 .../StatsEnabledSplitSystemCatalogIT.java   | 34 +++-
 .../java/org/apache/phoenix/end2end/ViewIT.java | 18 +--
 .../phoenix/schema/stats/StatsCollectorIT.java  | 54 
 4 files changed, 80 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e9cd0a42/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index b8372c4..c53cd7c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -49,6 +49,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.mapreduce.index.IndexTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -111,12 +113,16 @@ public class IndexToolIT extends ParallelStatsEnabledIT {
 public static Collection data() {
 List list = Lists.newArrayListWithExpectedSize(48);
 boolean[] Booleans = new boolean[] { false, true };
-for (Object transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
+for (String transactionProvider : new String[] {"TEPHRA", "OMID", 
null}) {
 for (boolean mutable : Booleans) {
 for (boolean localIndex : Booleans) {
-for (boolean directApi : Booleans) {
-for (boolean useSnapshot : Booleans) {
-list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+if (!TransactionFactory.getTransactionProvider(
+
TransactionFactory.Provider.valueOf(transactionProvider))
+.isUnsupported(Feature.ALLOW_LOCAL_INDEX)) {
+for (boolean directApi : Booleans) {
+for (boolean useSnapshot : Booleans) {
+list.add(new Object[] { transactionProvider, 
mutable, localIndex, directApi, useSnapshot });
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e9cd0a42/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
index 197263f..0a0dd21 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsEnabledSplitSystemCatalogIT.java
@@ -34,10 +34,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -45,6 +45,8 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ReadOnlyTableException;
+import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
+import org.apache.phoenix.transaction.TransactionFactory;
 

phoenix git commit: Revert "PHOENIX-4874 psql doesn't support date/time with values smaller than milliseconds(Rajeshbabu)"

2018-10-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 24ffcf5c8 -> 0ce663c53


Revert "PHOENIX-4874 psql doesn't support date/time with values smaller than 
milliseconds(Rajeshbabu)"

This reverts commit 34b8fe86b40f6cc2a05395640044e9dd7e1a1a8f.


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

Branch: refs/heads/omid2
Commit: 0ce663c53089efa9821a4423fb973b274ef67638
Parents: 24ffcf5
Author: James Taylor 
Authored: Mon Oct 15 15:56:20 2018 -0700
Committer: James Taylor 
Committed: Mon Oct 15 15:56:20 2018 -0700

--
 .../phoenix/util/csv/CsvUpsertExecutor.java | 20 +++-
 .../phoenix/util/json/JsonUpsertExecutor.java   |  3 --
 .../util/AbstractUpsertExecutorTest.java| 51 +---
 3 files changed, 20 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ce663c5/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
index d2529f7..cd40b44 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
@@ -20,7 +20,6 @@ package org.apache.phoenix.util.csv;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
-import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.List;
 import java.util.Properties;
@@ -31,7 +30,6 @@ import org.apache.commons.csv.CSVRecord;
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.expression.function.EncodeFormat;
-import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.IllegalDataException;
@@ -43,7 +41,6 @@ import org.apache.phoenix.schema.types.PTimestamp;
 import org.apache.phoenix.schema.types.PVarbinary;
 import org.apache.phoenix.util.ColumnInfo;
 import org.apache.phoenix.util.DateUtil;
-import org.apache.phoenix.util.ReadOnlyProps;
 import org.apache.phoenix.util.UpsertExecutor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -128,9 +125,9 @@ public class CsvUpsertExecutor extends 
UpsertExecutor {
 private final String binaryEncoding;
 
 SimpleDatatypeConversionFunction(PDataType dataType, Connection conn) {
-ReadOnlyProps props;
+Properties props;
 try {
-props = 
conn.unwrap(PhoenixConnection.class).getQueryServices().getProps();
+props = conn.getClientInfo();
 } catch (SQLException e) {
 throw new RuntimeException(e);
 }
@@ -142,23 +139,23 @@ public class CsvUpsertExecutor extends 
UpsertExecutor {
 String dateFormat;
 int dateSqlType = dataType.getResultSetSqlType();
 if (dateSqlType == Types.DATE) {
-dateFormat = props.get(QueryServices.DATE_FORMAT_ATTRIB,
+dateFormat = 
props.getProperty(QueryServices.DATE_FORMAT_ATTRIB,
 DateUtil.DEFAULT_DATE_FORMAT);
 } else if (dateSqlType == Types.TIME) {
-dateFormat = props.get(QueryServices.TIME_FORMAT_ATTRIB,
+dateFormat = 
props.getProperty(QueryServices.TIME_FORMAT_ATTRIB,
 DateUtil.DEFAULT_TIME_FORMAT);
 } else {
-dateFormat = 
props.get(QueryServices.TIMESTAMP_FORMAT_ATTRIB,
+dateFormat = 
props.getProperty(QueryServices.TIMESTAMP_FORMAT_ATTRIB,
 DateUtil.DEFAULT_TIMESTAMP_FORMAT);

 }
-String timeZoneId = 
props.get(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB,
+String timeZoneId = 
props.getProperty(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB,
 QueryServicesOptions.DEFAULT_DATE_FORMAT_TIMEZONE);
 this.dateTimeParser = DateUtil.getDateTimeParser(dateFormat, 
dataType, timeZoneId);
 } else {
 this.dateTimeParser = null;
 }
 this.codec = codec;
-this.binaryEncoding = 
props.get(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING,
+this.binaryEncoding = 

[12/22] phoenix git commit: Revert "PHOENIX-4825 Replace usage of HBase Base64 implementation with java.util.Base64"

2018-10-15 Thread jamestaylor
Revert "PHOENIX-4825 Replace usage of HBase Base64 implementation with 
java.util.Base64"

This reverts commit 22934e5af7af79580bf54feeb7667eccafaafc71 in order to 
support JDK 1.7 for 4.x releases.


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

Branch: refs/heads/omid2
Commit: 8c76e7c9775f8695a513168ac3ba3db467d54482
Parents: e62be9c
Author: Ankit Singhal 
Authored: Fri Oct 5 16:51:37 2018 -0700
Committer: Ankit Singhal 
Committed: Fri Oct 5 16:51:37 2018 -0700

--
 .../org/apache/phoenix/end2end/QueryMoreIT.java |  7 ++---
 .../phoenix/mapreduce/CsvBulkImportUtil.java|  8 ++
 .../util/PhoenixConfigurationUtil.java  |  7 ++---
 .../apache/phoenix/schema/types/PVarbinary.java |  4 +--
 .../phoenix/util/csv/CsvUpsertExecutor.java |  4 +--
 .../phoenix/util/json/JsonUpsertExecutor.java   |  4 +--
 .../util/AbstractUpsertExecutorTest.java| 12 
 .../util/TenantIdByteConversionTest.java| 30 
 8 files changed, 26 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8c76e7c9/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index 528fe7f..04272fa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -31,13 +31,12 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
-import java.util.Base64;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
@@ -279,7 +278,7 @@ public class QueryMoreIT extends ParallelStatsDisabledIT {
 values[i] = rs.getObject(i + 1);
 }
 conn = getTenantSpecificConnection(tenantId);
-
pkIds.add(Bytes.toString(Base64.getEncoder().encode(PhoenixRuntime.encodeColumnValues(conn,
 tableOrViewName.toUpperCase(), values, columns;
+
pkIds.add(Base64.encodeBytes(PhoenixRuntime.encodeColumnValues(conn, 
tableOrViewName.toUpperCase(), values, columns)));
 }
 return pkIds.toArray(new String[pkIds.size()]);
 }
@@ -297,7 +296,7 @@ public class QueryMoreIT extends ParallelStatsDisabledIT {
 PreparedStatement stmt = conn.prepareStatement(query);
 int bindCounter = 1;
 for (int i = 0; i < cursorIds.length; i++) {
-Object[] pkParts = PhoenixRuntime.decodeColumnValues(conn, 
tableName.toUpperCase(), Base64.getDecoder().decode(cursorIds[i]), columns);
+Object[] pkParts = PhoenixRuntime.decodeColumnValues(conn, 
tableName.toUpperCase(), Base64.decode(cursorIds[i]), columns);
 for (int j = 0; j < pkParts.length; j++) {
 stmt.setObject(bindCounter++, pkParts[j]);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8c76e7c9/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkImportUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkImportUtil.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkImportUtil.java
index bf5a538..ff9ff72 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkImportUtil.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkImportUtil.java
@@ -17,11 +17,9 @@
  */
 package org.apache.phoenix.mapreduce;
 
-import java.util.Base64;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Base64;
 import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
@@ -70,7 +68,7 @@ public class CsvBulkImportUtil {
 
 @VisibleForTesting
 static void setChar(Configuration conf, String confKey, char charValue) {
-conf.set(confKey, 
Bytes.toString(Base64.getEncoder().encode(Character.toString(charValue).getBytes(;
+conf.set(confKey, 

[10/22] phoenix git commit: PHOENIX-4688 Support SPNEGO for python driver via requests-kerberos

2018-10-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e62be9c8/python/phoenixdb/avatica/__init__.py
--
diff --git a/python/phoenixdb/avatica/__init__.py 
b/python/phoenixdb/avatica/__init__.py
deleted file mode 100644
index 53776d7..000
--- a/python/phoenixdb/avatica/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-
-from .client import AvaticaClient  # noqa: F401

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e62be9c8/python/phoenixdb/avatica/client.py
--
diff --git a/python/phoenixdb/avatica/client.py 
b/python/phoenixdb/avatica/client.py
deleted file mode 100644
index ea00631..000
--- a/python/phoenixdb/avatica/client.py
+++ /dev/null
@@ -1,510 +0,0 @@
-# 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.
-
-"""Implementation of the JSON-over-HTTP RPC protocol used by Avatica."""
-
-import re
-import socket
-import pprint
-import math
-import logging
-import time
-from phoenixdb import errors
-from phoenixdb.avatica.proto import requests_pb2, common_pb2, responses_pb2
-
-try:
-import httplib
-except ImportError:
-import http.client as httplib
-
-try:
-import urlparse
-except ImportError:
-import urllib.parse as urlparse
-
-try:
-from HTMLParser import HTMLParser
-except ImportError:
-from html.parser import HTMLParser
-
-__all__ = ['AvaticaClient']
-
-logger = logging.getLogger(__name__)
-
-
-class JettyErrorPageParser(HTMLParser):
-
-def __init__(self):
-HTMLParser.__init__(self)
-self.path = []
-self.title = []
-self.message = []
-
-def handle_starttag(self, tag, attrs):
-self.path.append(tag)
-
-def handle_endtag(self, tag):
-self.path.pop()
-
-def handle_data(self, data):
-if len(self.path) > 2 and self.path[0] == 'html' and self.path[1] == 
'body':
-if len(self.path) == 3 and self.path[2] == 'h2':
-self.title.append(data.strip())
-elif len(self.path) == 4 and self.path[2] == 'p' and self.path[3] 
== 'pre':
-self.message.append(data.strip())
-
-
-def parse_url(url):
-url = urlparse.urlparse(url)
-if not url.scheme and not url.netloc and url.path:
-netloc = url.path
-if ':' not in netloc:
-netloc = '{}:8765'.format(netloc)
-return urlparse.ParseResult('http', netloc, '/', '', '', '')
-return url
-
-
-# Defined in 
phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
-SQLSTATE_ERROR_CLASSES = [
-('08', errors.OperationalError),  # Connection Exception
-('22018', errors.IntegrityError),  # Constraint violatioin.
-('22', errors.DataError),  # Data Exception
-('23', errors.IntegrityError),  # Constraint Violation
-('24', errors.InternalError),  # Invalid Cursor State
-('25', errors.InternalError),  # Invalid Transaction State
-('42', errors.ProgrammingError),  # Syntax Error or Access Rule Violation
-('XLC', errors.OperationalError),  # Execution exceptions
-('INT', errors.InternalError),  # Phoenix internal error
-]
-
-# Relevant properties as defined by 
https://calcite.apache.org/avatica/docs/client_reference.html
-OPEN_CONNECTION_PROPERTIES = (
-'user',  # User for the database connection
-'password',  # Password for the user
-)
-
-
-def raise_sql_error(code, sqlstate, message):
-for 

[06/22] phoenix git commit: PHOENIX-4688 Support SPNEGO for python driver via requests-kerberos

2018-10-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e62be9c8/python/phoenixdb/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  

[19/22] phoenix git commit: PHOENIX-4358 Case Sensitive String match on SqlType in PDataType (Dave Angulo)

2018-10-15 Thread jamestaylor
PHOENIX-4358 Case Sensitive String match on SqlType in PDataType (Dave Angulo)


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

Branch: refs/heads/omid2
Commit: 9556b8e10361286b3a7ef9402620be29d2422355
Parents: 7580b7e
Author: Thomas D'Silva 
Authored: Fri Oct 12 13:46:15 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Oct 12 13:47:42 2018 -0700

--
 .../main/java/org/apache/phoenix/schema/types/PDataType.java   | 2 +-
 .../java/org/apache/phoenix/schema/types/PDataTypeTest.java| 6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9556b8e1/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
index 1e29d6f..eba6079 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
@@ -1041,7 +1041,7 @@ public abstract class PDataType implements 
DataType, Comparablehttp://git-wip-us.apache.org/repos/asf/phoenix/blob/9556b8e1/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
index 4b02cea..e868f4e 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
@@ -1949,4 +1949,10 @@ public class PDataTypeTest {
 }
 }
 }
+
+@Test
+public void testFromSqlTypeName() {
+assertEquals(PVarchar.INSTANCE, PDataType.fromSqlTypeName("varchar"));
+}
+
 }



[15/22] phoenix git commit: PHOENIX-3955: Ensure KEEP_DELETED_CELLS, REPLICATION_SCOPE, and TTL properties stay in sync between the physical data table and index tables

2018-10-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd3e55f1/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index ab4678a..b68637a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -18,6 +18,8 @@
 package org.apache.phoenix.query;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static org.apache.hadoop.hbase.HColumnDescriptor.TTL;
+import static org.apache.hadoop.hbase.HColumnDescriptor.REPLICATION_SCOPE;
+import static org.apache.hadoop.hbase.HColumnDescriptor.KEEP_DELETED_CELLS;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_MAJOR_VERSION;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_MINOR_VERSION;
@@ -62,6 +64,7 @@ import static 
org.apache.phoenix.util.UpgradeUtil.addViewIndexToParentLinks;
 import static org.apache.phoenix.util.UpgradeUtil.getSysCatalogSnapshotName;
 import static org.apache.phoenix.util.UpgradeUtil.moveChildLinks;
 import static org.apache.phoenix.util.UpgradeUtil.upgradeTo4_5_0;
+import static org.apache.phoenix.util.UpgradeUtil.syncTableAndIndexProperties;
 
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
@@ -101,11 +104,13 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.annotation.concurrent.GuardedBy;
 
+import com.google.common.base.Strings;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.KeepDeletedCells;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
 import org.apache.hadoop.hbase.NamespaceNotFoundException;
 import org.apache.hadoop.hbase.TableExistsException;
@@ -775,62 +780,94 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 PTableType tableType, Map tableProps, 
List>> families,
 byte[][] splits, boolean isNamespaceMapped) throws SQLException {
 String defaultFamilyName = 
(String)tableProps.remove(PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME);
-HTableDescriptor tableDescriptor = (existingDesc != null) ? new 
HTableDescriptor(existingDesc)
-: new HTableDescriptor(physicalTableName);
+HTableDescriptor newTableDescriptor = (existingDesc != null) ? new 
HTableDescriptor(existingDesc)
+: new HTableDescriptor(TableName.valueOf(physicalTableName));
+
+HColumnDescriptor dataTableColDescForIndexTablePropSyncing = null;
+if (tableType == PTableType.INDEX || 
MetaDataUtil.isViewIndex(Bytes.toString(physicalTableName))) {
+byte[] defaultFamilyBytes =
+defaultFamilyName == null ? 
QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES : Bytes.toBytes(defaultFamilyName);
+
+final HTableDescriptor baseTableDesc;
+if (MetaDataUtil.isViewIndex(Bytes.toString(physicalTableName))) {
+// Handles indexes created on views for single-tenant tables 
and
+// global indexes created on views of multi-tenant tables
+baseTableDesc = 
this.getTableDescriptor(Bytes.toBytes(MetaDataUtil.getViewIndexUserTableName(Bytes.toString(physicalTableName;
+} else if (existingDesc == null) {
+// Global/local index creation on top of a physical base table
+baseTableDesc = 
this.getTableDescriptor(SchemaUtil.getPhysicalTableName(
+Bytes.toBytes((String) 
tableProps.get(PhoenixDatabaseMetaData.DATA_TABLE_NAME)), isNamespaceMapped)
+.getName());
+} else {
+// In case this a local index created on a view of a 
multi-tenant table, the
+// DATA_TABLE_NAME points to the name of the view instead of 
the physical base table
+baseTableDesc = existingDesc;
+}
+dataTableColDescForIndexTablePropSyncing = 
baseTableDesc.getFamily(defaultFamilyBytes);
+// It's possible that the table has specific column families and 
none of them are declared
+// to be the DEFAULT_COLUMN_FAMILY, so we choose the first column 
family for syncing properties
+if (dataTableColDescForIndexTablePropSyncing == null) {
+dataTableColDescForIndexTablePropSyncing = 
baseTableDesc.getColumnFamilies()[0];
+}
+}
 // By 

[13/22] phoenix git commit: PHOENIX-4855 Continue to write base table column metadata when creating a view in order to support rollback (addendum)

2018-10-15 Thread jamestaylor
PHOENIX-4855 Continue to write base table column metadata when creating a view 
in order to support rollback (addendum)


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

Branch: refs/heads/omid2
Commit: c90d090a1fba7c2937a5b91e4ac0f1fe379ec539
Parents: 8c76e7c
Author: Thomas D'Silva 
Authored: Sat Oct 6 12:40:54 2018 -0700
Committer: Thomas D'Silva 
Committed: Sat Oct 6 12:42:01 2018 -0700

--
 .../java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c90d090a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 18c9000..52dfe99 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -737,9 +737,10 @@ public class PhoenixDatabaseMetaData implements 
DatabaseMetaData {
 boolean isSalted = table.getBucketNum()!=null;
 boolean tenantColSkipped = false;
 List columns = table.getColumns();
-columns = Lists.newArrayList(columns.subList(isSalted ? 1 : 0, 
columns.size()));
+int startOffset = isSalted ? 1 : 0;
+   columns = 
Lists.newArrayList(columns.subList(startOffset, columns.size()));
 for (PColumn column : columns) {
-if (isTenantSpecificConnection && 
column.equals(table.getPKColumns().get(0))) {
+if (isTenantSpecificConnection && 
column.equals(table.getPKColumns().get(startOffset))) {
 // skip the tenant column
 tenantColSkipped = true;
 continue;
@@ -874,7 +875,7 @@ public class PhoenixDatabaseMetaData implements 
DatabaseMetaData {
 byte[] keySeqBytes = ByteUtil.EMPTY_BYTE_ARRAY;
 int pkPos = table.getPKColumns().indexOf(column);
 if (pkPos!=-1) {
-short keySeq = (short) (pkPos + 1 - (isSalted ? 1 : 0) - 
(tenantColSkipped ? 1 : 0));
+short keySeq = (short) (pkPos + 1 - startOffset - 
(tenantColSkipped ? 1 : 0));
 keySeqBytes = PSmallint.INSTANCE.toBytes(keySeq);
 }
 cells.add(KeyValueUtil.newKeyValue(rowKey, TABLE_FAMILY_BYTES, 
KEY_SEQ_BYTES,



[11/22] phoenix git commit: PHOENIX-4688 Support SPNEGO for python driver via requests-kerberos

2018-10-15 Thread jamestaylor
PHOENIX-4688 Support SPNEGO for python driver via requests-kerberos

Includes updated L for requests-kerberos. Tries to detect when the
host system doesn't have necessary dependencies to run the test

Closes #344

Signed-off-by: Josh Elser 


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

Branch: refs/heads/omid2
Commit: e62be9c820aaf05266500cc509d4a89658cb6918
Parents: e4d170c
Author: Lev Bronshtein 
Authored: Wed Aug 29 17:19:51 2018 -0400
Committer: Josh Elser 
Committed: Fri Oct 5 18:41:18 2018 -0400

--
 LICENSE |   18 +
 NOTICE  |2 +
 dev/release_files/LICENSE   |   18 +
 dev/release_files/NOTICE|4 +
 .../src/it/bin/test_phoenixdb.py|   39 +
 .../src/it/bin/test_phoenixdb.sh|   79 +
 .../end2end/SecureQueryServerPhoenixDBIT.java   |  424 +
 pom.xml |   14 +-
 python/NEWS.rst |   44 -
 python/README.md|   93 +
 python/README.rst   |  136 --
 python/RELEASING.rst|   12 -
 python/ci/build-env/Dockerfile  |7 -
 python/ci/phoenix/Dockerfile|   33 -
 python/ci/phoenix/docker-entrypoint.sh  |   24 -
 python/ci/phoenix/hbase-site.xml|   12 -
 python/doc/Makefile |  192 --
 python/doc/api.rst  |   30 -
 python/doc/conf.py  |  287 ---
 python/doc/index.rst|   27 -
 python/doc/versions.rst |3 -
 python/docker-compose.yml   |   21 -
 python/examples/basic.py|   27 -
 python/examples/shell.py|   33 -
 python/gen-protobuf.sh  |   38 -
 python/phoenixdb/NEWS.rst   |   44 +
 python/phoenixdb/README.rst |  136 ++
 python/phoenixdb/RELEASING.rst  |   12 +
 python/phoenixdb/__init__.py|   68 -
 python/phoenixdb/avatica/__init__.py|   16 -
 python/phoenixdb/avatica/client.py  |  510 --
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 --
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 -
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 --
 python/phoenixdb/ci/build-env/Dockerfile|7 +
 python/phoenixdb/ci/phoenix/Dockerfile  |   33 +
 .../phoenixdb/ci/phoenix/docker-entrypoint.sh   |   24 +
 python/phoenixdb/ci/phoenix/hbase-site.xml  |   12 +
 python/phoenixdb/connection.py  |  187 --
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/doc/Makefile   |  192 ++
 python/phoenixdb/doc/api.rst|   30 +
 python/phoenixdb/doc/conf.py|  287 +++
 python/phoenixdb/doc/index.rst  |   27 +
 python/phoenixdb/doc/versions.rst   |3 +
 python/phoenixdb/docker-compose.yml |   21 +
 python/phoenixdb/errors.py  |   93 -
 python/phoenixdb/examples/basic.py  |   27 +
 python/phoenixdb/examples/shell.py  |   33 +
 python/phoenixdb/gen-protobuf.sh|   39 +
 python/phoenixdb/phoenixdb/__init__.py  |   72 +
 python/phoenixdb/phoenixdb/avatica/__init__.py  |   16 +
 python/phoenixdb/phoenixdb/avatica/client.py|  502 ++
 .../phoenixdb/avatica/proto/__init__.py |0
 .../phoenixdb/avatica/proto/common_pb2.py   | 1667 ++
 .../phoenixdb/avatica/proto/requests_pb2.py | 1206 +
 .../phoenixdb/avatica/proto/responses_pb2.py|  917 ++
 python/phoenixdb/phoenixdb/connection.py|  187 ++
 python/phoenixdb/phoenixdb/cursor.py|  347 
 python/phoenixdb/phoenixdb/errors.py|   93 +
 python/phoenixdb/phoenixdb/tests/__init__.py|   44 +
 python/phoenixdb/phoenixdb/tests/dbapi20.py |  857 +
 .../phoenixdb/phoenixdb/tests/test_avatica.py   |   25 +
 .../phoenixdb/tests/test_connection.py  |   42 +
 python/phoenixdb/phoenixdb/tests/test_db.py |   99 ++
 .../phoenixdb/phoenixdb/tests/test_dbapi20.py   |  122 ++
 python/phoenixdb/phoenixdb/tests/test_errors.py |   60 +
 python/phoenixdb/phoenixdb/tests/test_types.py  |  327 
 python/phoenixdb/phoenixdb/types.py |  202 +++
 

[05/22] phoenix git commit: PHOENIX-4688 Support SPNEGO for python driver via requests-kerberos

2018-10-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e62be9c8/python/phoenixdb/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/phoenixdb/cursor.py 
b/python/phoenixdb/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# 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.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is 

[04/22] phoenix git commit: PHOENIX-4688 Support SPNEGO for python driver via requests-kerberos

2018-10-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e62be9c8/python/phoenixdb/phoenixdb/types.py
--
diff --git a/python/phoenixdb/phoenixdb/types.py 
b/python/phoenixdb/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# 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.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Type object that can be used to describe boolean columns. This is a 
phoenixdb-specific extension."""
+
+
+# XXX ARRAY
+
+if sys.version_info[0] < 3:
+_long = long  # noqa: F821
+else:
+_long = int
+
+JAVA_CLASSES = {
+'bool_value': [
+('java.lang.Boolean', 

  1   2   3   4   5   6   7   8   9   10   >