[27/50] [abbrv] phoenix git commit: PHOENIX-4613 Thread clientVersion through to IndexCommitter implementors

2018-05-02 Thread tdsilva
PHOENIX-4613 Thread clientVersion through to IndexCommitter implementors


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

Branch: refs/heads/system-catalog
Commit: ccd41de7bfd5047511db3eb6c17121e92eebf1e6
Parents: b768900
Author: James Taylor 
Authored: Fri Apr 20 11:44:13 2018 -0700
Committer: Vincent Poon 
Committed: Fri Apr 20 11:45:06 2018 -0700

--
 .../org/apache/phoenix/hbase/index/Indexer.java | 14 +
 .../hbase/index/builder/IndexBuildManager.java  |  4 
 .../hbase/index/covered/IndexMetaData.java  | 12 ++-
 .../hbase/index/write/IndexCommitter.java   |  2 +-
 .../phoenix/hbase/index/write/IndexWriter.java  | 21 ++--
 .../write/ParallelWriterIndexCommitter.java |  2 +-
 .../hbase/index/write/RecoveryIndexWriter.java  |  4 ++--
 .../TrackingParallelWriterIndexCommitter.java   |  2 +-
 .../index/PhoenixTransactionalIndexer.java  |  9 +++--
 .../index/covered/LocalTableStateTest.java  | 18 -
 .../hbase/index/write/TestIndexWriter.java  |  7 +++
 .../index/write/TestParalleIndexWriter.java |  4 +++-
 .../write/TestParalleWriterIndexCommitter.java  |  3 ++-
 13 files changed, 73 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ccd41de7/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
index 7b9bc1f..7325cd8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
@@ -92,6 +92,7 @@ import org.apache.phoenix.trace.TracingUtils;
 import org.apache.phoenix.trace.util.NullSpan;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.ServerUtil;
 
 import com.google.common.collect.Lists;
@@ -132,8 +133,13 @@ public class Indexer extends BaseRegionObserver {
   // Hack to get around not being able to save any state between
   // coprocessor calls. TODO: remove after HBASE-18127 when available
   private static class BatchMutateContext {
+  public final int clientVersion;
   public Collection> indexUpdates = 
Collections.emptyList();
   public List rowLocks = 
Lists.newArrayListWithExpectedSize(QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE);
+
+  public BatchMutateContext(int clientVersion) {
+  this.clientVersion = clientVersion;
+  }
   }
   
   private ThreadLocal batchMutateContext =
@@ -396,7 +402,7 @@ public class Indexer extends BaseRegionObserver {
* Exclusively lock all rows so we get a consistent read
* while determining the index updates
*/
-  BatchMutateContext context = new BatchMutateContext();
+  BatchMutateContext context = new 
BatchMutateContext(this.builder.getIndexMetaData(miniBatchOp).getClientVersion());
   setBatchMutateContext(c, context);
   Durability durability = Durability.SKIP_WAL;
   boolean copyMutations = false;
@@ -624,7 +630,7 @@ public class Indexer extends BaseRegionObserver {
   long start = EnvironmentEdgeManager.currentTimeMillis();
   
   current.addTimelineAnnotation("Actually doing index update for first 
time");
-  writer.writeAndKillYourselfOnFailure(context.indexUpdates, false);
+  writer.writeAndKillYourselfOnFailure(context.indexUpdates, false, 
context.clientVersion);
 
   long duration = EnvironmentEdgeManager.currentTimeMillis() - start;
   if (duration >= slowIndexWriteThreshold) {
@@ -693,7 +699,7 @@ public class Indexer extends BaseRegionObserver {
 // do the usual writer stuff, killing the server again, if we can't 
manage to make the index
 // writes succeed again
 try {
-writer.writeAndKillYourselfOnFailure(updates, true);
+writer.writeAndKillYourselfOnFailure(updates, true, 
ScanUtil.UNKNOWN_CLIENT_VERSION);
 } catch (IOException e) {
 LOG.error("During WAL replay of outstanding index updates, "
 + "Exception is thrown instead of killing server 
during index writing", e);
@@ -731,7 +737,7 @@ public class Indexer extends BaseRegionObserver {
* hopes they come up before the primary table finishes.

[44/50] [abbrv] phoenix git commit: PHOENIX-4705 Use XMLInputFactory.newInstance() instead of XMLInputFactory.newFactory()

2018-05-02 Thread tdsilva
PHOENIX-4705 Use XMLInputFactory.newInstance() instead of 
XMLInputFactory.newFactory()


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

Branch: refs/heads/system-catalog
Commit: 6c1a624f351926c6b122c722cf4f9c3418a222ae
Parents: 4b84199
Author: James Taylor 
Authored: Thu Apr 26 12:37:26 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 27 11:41:56 2018 -0700

--
 .../pherf/configuration/XMLConfigParser.java  |  2 +-
 .../pherf/result/impl/XMLResultHandler.java   | 18 ++
 2 files changed, 11 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c1a624f/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java
--
diff --git 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java
 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java
index f3ec12f..a0ee471 100644
--- 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java
+++ 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java
@@ -115,7 +115,7 @@ public class XMLConfigParser {
  */
 // TODO Remove static calls
 public static DataModel readDataModel(Path file) throws JAXBException, 
XMLStreamException {
-XMLInputFactory xif = XMLInputFactory.newFactory();
+XMLInputFactory xif = XMLInputFactory.newInstance();
 xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, 
false);
 xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
 JAXBContext jaxbContext = JAXBContext.newInstance(DataModel.class);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c1a624f/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/XMLResultHandler.java
--
diff --git 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/XMLResultHandler.java
 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/XMLResultHandler.java
index 05b5a2b..87d6806 100644
--- 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/XMLResultHandler.java
+++ 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/XMLResultHandler.java
@@ -18,8 +18,11 @@
 
 package org.apache.phoenix.pherf.result.impl;
 
-import org.apache.phoenix.pherf.result.*;
-import org.apache.phoenix.pherf.result.file.ResultFileDetails;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Marshaller;
@@ -28,11 +31,10 @@ import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.stream.StreamSource;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import org.apache.phoenix.pherf.result.DataModelResult;
+import org.apache.phoenix.pherf.result.Result;
+import org.apache.phoenix.pherf.result.ResultValue;
+import org.apache.phoenix.pherf.result.file.ResultFileDetails;
 
 public class XMLResultHandler extends DefaultResultHandler{
 
@@ -74,7 +76,7 @@ public class XMLResultHandler extends DefaultResultHandler{
 }
 
 List readFromResultFile(File resultsFile) throws Exception {
-XMLInputFactory xif = XMLInputFactory.newFactory();
+XMLInputFactory xif = XMLInputFactory.newInstance();
 xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, 
false);
 xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
 JAXBContext jaxbContext = 
JAXBContext.newInstance(DataModelResult.class);



[48/50] [abbrv] phoenix git commit: PHOENIX-4716 ParameterizedTransactionIT is failing in 0.98 branch

2018-05-02 Thread tdsilva
PHOENIX-4716 ParameterizedTransactionIT is failing in 0.98 branch


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

Branch: refs/heads/system-catalog
Commit: d10151e33615cacd01e634fef896e8644fced890
Parents: fc194c5
Author: James Taylor 
Authored: Fri Apr 27 18:25:56 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 27 18:37:16 2018 -0700

--
 .../phoenix/tx/ParameterizedTransactionIT.java  | 37 +++-
 1 file changed, 20 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d10151e3/phoenix-core/src/it/java/org/apache/phoenix/tx/ParameterizedTransactionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/tx/ParameterizedTransactionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/tx/ParameterizedTransactionIT.java
index ce01e2b..580f055 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/tx/ParameterizedTransactionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/tx/ParameterizedTransactionIT.java
@@ -71,12 +71,15 @@ public class ParameterizedTransactionIT extends 
ParallelStatsDisabledIT {
 private final String tableDDLOptions;
 
 public ParameterizedTransactionIT(boolean mutable, boolean columnEncoded) {
-StringBuilder optionBuilder = new StringBuilder("TRANSACTIONAL=true");
+StringBuilder optionBuilder = new StringBuilder();
 if (!columnEncoded) {
-optionBuilder.append(",COLUMN_ENCODED_BYTES=0");
+optionBuilder.append("COLUMN_ENCODED_BYTES=0");
 }
 if (!mutable) {
-optionBuilder.append(",IMMUTABLE_ROWS=true");
+if (optionBuilder.length() > 0) {
+optionBuilder.append(",");
+}
+optionBuilder.append("IMMUTABLE_ROWS=true");
 if (!columnEncoded) {
 
optionBuilder.append(",IMMUTABLE_STORAGE_SCHEME="+PTableImpl.ImmutableStorageScheme.ONE_CELL_PER_COLUMN);
 }
@@ -97,7 +100,7 @@ public class ParameterizedTransactionIT extends 
ParallelStatsDisabledIT {
 String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
 String selectSql = "SELECT * FROM "+ fullTableName;
 try (Connection conn = DriverManager.getConnection(getUrl())) {
-conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions);
+conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions + (tableDDLOptions.length() > 0 ? 
"," : "") + "TRANSACTIONAL=true");
 conn.setAutoCommit(false);
 ResultSet rs = conn.createStatement().executeQuery(selectSql);
 assertFalse(rs.next());
@@ -132,7 +135,7 @@ public class ParameterizedTransactionIT extends 
ParallelStatsDisabledIT {
 String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
 String selectSql = "SELECT * FROM "+fullTableName;
 try (Connection conn = DriverManager.getConnection(getUrl())) {
-conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions);
+conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions + (tableDDLOptions.length() > 0 ? 
"," : "") + "TRANSACTIONAL=true");
 conn.setAutoCommit(false);
 ResultSet rs = conn.createStatement().executeQuery(selectSql);
 assertFalse(rs.next());
@@ -165,7 +168,7 @@ public class ParameterizedTransactionIT extends 
ParallelStatsDisabledIT {
 String transTableName = generateUniqueName();
 String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
 try (Connection conn = DriverManager.getConnection(getUrl())) {
-conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions);
+conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions + (tableDDLOptions.length() > 0 ? 
"," : "") + "TRANSACTIONAL=true");
 conn.setAutoCommit(true);
 // verify no rows returned
 ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM 
" + fullTableName);
@@ -178,7 +181,7 @@ public class ParameterizedTransactionIT extends 
ParallelStatsDisabledIT {
 String transTableName = generateUniqueName();
 

[04/50] [abbrv] phoenix git commit: PHOENIX-2715 Query Log (addendum)

2018-05-02 Thread tdsilva
PHOENIX-2715 Query Log (addendum)


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

Branch: refs/heads/system-catalog
Commit: ed636616138cbb8db4b71c9cf8a1b2fa7b503aa0
Parents: 0bc0368
Author: Ankit Singhal 
Authored: Tue Apr 10 15:41:51 2018 +0530
Committer: Ankit Singhal 
Committed: Tue Apr 10 15:41:51 2018 +0530

--
 .../MigrateSystemTablesToSystemNamespaceIT.java | 40 +++-
 1 file changed, 22 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ed636616/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 c36cdd3..7cb5857 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
@@ -16,6 +16,26 @@
  */
 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.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+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.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
@@ -38,31 +58,15 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
-import java.security.PrivilegedExceptionAction;
-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.Arrays;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-
 @Category(NeedsOwnMiniClusterTest.class)
 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.MUTEX","SYSTEM.LOG"));
 private static final Set PHOENIX_NAMESPACE_MAPPED_SYSTEM_TABLES = 
new HashSet<>(
 Arrays.asList("SYSTEM:CATALOG", "SYSTEM:SEQUENCE", "SYSTEM:STATS", 
"SYSTEM:FUNCTION",
-"SYSTEM:MUTEX"));
+"SYSTEM:MUTEX","SYSTEM:LOG"));
 private static final String SCHEMA_NAME = "MIGRATETEST";
 private static final String TABLE_NAME =
 SCHEMA_NAME + "." + 
MigrateSystemTablesToSystemNamespaceIT.class.getSimpleName().toUpperCase();



[24/50] [abbrv] phoenix git commit: PHOENIX-4690 GroupBy expressions should follow the order of PK Columns if GroupBy is orderPreserving

2018-05-02 Thread tdsilva
PHOENIX-4690 GroupBy expressions should follow the order of PK Columns if 
GroupBy is orderPreserving


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

Branch: refs/heads/system-catalog
Commit: 153b357d5b9b8663c13e22b42227dffe12d176f3
Parents: 34f93d7
Author: chenglei 
Authored: Wed Apr 18 16:42:31 2018 +0800
Committer: chenglei 
Committed: Wed Apr 18 16:42:31 2018 +0800

--
 .../org/apache/phoenix/end2end/AggregateIT.java | 107 +++---
 .../org/apache/phoenix/end2end/OrderByIT.java   |  18 +--
 .../apache/phoenix/end2end/join/SubqueryIT.java |   8 +-
 .../join/SubqueryUsingSortMergeJoinIT.java  |  12 +-
 .../apache/phoenix/compile/GroupByCompiler.java |  19 +++-
 .../phoenix/compile/OrderPreservingTracker.java |  13 +++
 .../phoenix/compile/QueryCompilerTest.java  | 110 +++
 .../java/org/apache/phoenix/util/TestUtil.java  |  20 
 8 files changed, 267 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/153b357d/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 b6c5a06..2059311 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
@@ -22,6 +22,7 @@ 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;
@@ -1016,20 +1017,100 @@ public class AggregateIT extends 
ParallelStatsDisabledIT {
 }
 }
 
-private void assertResultSet(ResultSet rs,Object[][] rows) throws 
Exception {
-for(int rowIndex=0;rowIndex

[40/50] [abbrv] phoenix git commit: PHOENIX-4708 Do not propagate GUIDE_POSTS_WIDTH to children

2018-05-02 Thread tdsilva
PHOENIX-4708 Do not propagate GUIDE_POSTS_WIDTH to children


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

Branch: refs/heads/system-catalog
Commit: ff3273480165c2832cf1dc1bd114a74b93cf9e72
Parents: bebe66c
Author: James Taylor 
Authored: Thu Apr 26 09:40:35 2018 -0700
Committer: James Taylor 
Committed: Thu Apr 26 09:55:28 2018 -0700

--
 .../phoenix/end2end/AlterTableWithViewsIT.java  |  22 ++
 .../coprocessor/MetaDataEndpointImpl.java   | 115 +---
 .../apache/phoenix/schema/TableProperty.java| 270 ++-
 3 files changed, 248 insertions(+), 159 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff327348/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
index 237a8d2..e1b1372 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.sql.Connection;
+import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -39,12 +40,14 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.coprocessor.TephraTransactionalProcessor;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PNameFactory;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.PTableType;
+import org.apache.phoenix.util.StringUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -166,6 +169,25 @@ public class AlterTableWithViewsIT extends 
ParallelStatsDisabledIT {
 assertTrue(viewTable2.isImmutableRows());
 // update cache frequency is not propagated to the view since it 
was altered on the view
 assertEquals(1, viewTable2.getUpdateCacheFrequency());
+
+long gpw = 100;
+conn.createStatement().execute("ALTER TABLE " + tableName + " SET 
GUIDE_POSTS_WIDTH=" + gpw);
+
+ResultSet rs;
+DatabaseMetaData md = conn.getMetaData();
+rs = md.getTables("", "", StringUtil.escapeLike(tableName), null);
+assertTrue(rs.next());
+assertEquals(gpw, 
rs.getLong(PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH));
+
+rs = md.getTables(null, "", StringUtil.escapeLike(viewOfTable1), 
null);
+assertTrue(rs.next());
+rs.getLong(PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH);
+assertTrue(rs.wasNull());
+
+rs = md.getTables(null, "", StringUtil.escapeLike(viewOfTable2), 
null);
+assertTrue(rs.next());
+rs.getLong(PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH);
+assertTrue(rs.wasNull());
 } 
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff327348/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 29eee7e..b77f113 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
@@ -91,6 +91,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -3163,7 +3164,56 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 byte[] tableNameBytes = index.getTableName().getBytes();
 return ByteUtil.concat(tenantIdBytes, SEPARATOR_BYTE_ARRAY, 
schemaNameBytes, SEPARATOR_BYTE_ARRAY, tableNameBytes);
 }
+  
 

[14/50] [abbrv] phoenix git commit: PHOENIX-4605 Support running multiple transaction providers

2018-05-02 Thread tdsilva
PHOENIX-4605 Support running multiple transaction providers


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

Branch: refs/heads/system-catalog
Commit: de83b8d5d042098faa294e742525ab84175bb271
Parents: ca58fae
Author: James Taylor 
Authored: Wed Apr 11 20:06:35 2018 -0700
Committer: James Taylor 
Committed: Thu Apr 12 17:19:42 2018 -0700

--
 .../phoenix/end2end/AlterTableWithViewsIT.java  |   6 +-
 .../ConnectionQueryServicesTestImpl.java|  34 +-
 .../phoenix/tx/FlappingTransactionIT.java   |  11 +-
 .../phoenix/tx/ParameterizedTransactionIT.java  |  14 +-
 .../org/apache/phoenix/tx/TransactionIT.java|  12 +
 .../org/apache/phoenix/tx/TxCheckpointIT.java   |   5 +-
 .../phoenix/cache/IndexMetaDataCache.java   |   5 +-
 .../apache/phoenix/compile/DeleteCompiler.java  |   3 +-
 .../apache/phoenix/compile/FromCompiler.java|   2 +-
 .../apache/phoenix/compile/JoinCompiler.java|   2 +-
 .../compile/TupleProjectionCompiler.java|   4 +-
 .../apache/phoenix/compile/UnionCompiler.java   |   6 +-
 .../apache/phoenix/compile/UpsertCompiler.java  |   2 +-
 .../coprocessor/BaseScannerRegionObserver.java  |   4 +-
 .../coprocessor/MetaDataEndpointImpl.java   |  26 +-
 .../phoenix/coprocessor/MetaDataProtocol.java   |   2 +-
 .../coprocessor/MetaDataRegionObserver.java |   4 +-
 .../PhoenixTransactionalProcessor.java  |  28 --
 .../coprocessor/ServerCachingEndpointImpl.java  |   4 +-
 .../TephraTransactionalProcessor.java   |  29 ++
 .../UngroupedAggregateRegionObserver.java   |  10 +-
 .../coprocessor/generated/PTableProtos.java | 110 +-
 .../phoenix/exception/SQLExceptionCode.java |   4 +
 .../apache/phoenix/execute/BaseQueryPlan.java   |   3 +
 .../apache/phoenix/execute/MutationState.java   |  74 ++--
 .../PhoenixTxIndexMutationGenerator.java|  10 +-
 .../phoenix/expression/ExpressionType.java  | 119 +-
 .../TransactionProviderNameFunction.java|  81 
 .../apache/phoenix/index/IndexMaintainer.java   |   4 +-
 .../index/IndexMetaDataCacheFactory.java|   2 +-
 .../apache/phoenix/index/PhoenixIndexCodec.java |   1 -
 .../index/PhoenixIndexMetaDataBuilder.java  |   7 +-
 .../NonAggregateRegionScannerFactory.java   |   5 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  12 +-
 .../apache/phoenix/jdbc/PhoenixStatement.java   |   2 +-
 .../index/PhoenixIndexPartialBuildMapper.java   |   4 +-
 .../phoenix/query/ConnectionQueryServices.java  |   4 +
 .../query/ConnectionQueryServicesImpl.java  |  69 ++--
 .../query/ConnectionlessQueryServicesImpl.java  |   9 +-
 .../query/DelegateConnectionQueryServices.java  |   7 +-
 .../apache/phoenix/query/QueryConstants.java|   2 +
 .../org/apache/phoenix/query/QueryServices.java |   1 +
 .../phoenix/query/QueryServicesOptions.java |  10 +-
 .../apache/phoenix/schema/DelegateTable.java|   8 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 129 --
 .../java/org/apache/phoenix/schema/PTable.java  |   2 +
 .../org/apache/phoenix/schema/PTableImpl.java   |  68 ++--
 .../apache/phoenix/schema/TableProperty.java|  18 +
 .../transaction/OmidTransactionContext.java |  57 +--
 .../transaction/OmidTransactionProvider.java|  54 +--
 .../transaction/OmidTransactionTable.java   | 388 ---
 .../transaction/PhoenixTransactionClient.java   |  23 ++
 .../transaction/PhoenixTransactionContext.java  | 169 
 .../transaction/PhoenixTransactionProvider.java |  51 +++
 .../transaction/PhoenixTransactionService.java  |  24 ++
 .../transaction/PhoenixTransactionalTable.java  | 149 ---
 .../transaction/TephraTransactionContext.java   | 205 +++---
 .../transaction/TephraTransactionProvider.java  | 161 +++-
 .../transaction/TephraTransactionTable.java | 366 -
 .../phoenix/transaction/TransactionFactory.java |  57 ++-
 .../transaction/TransactionProvider.java|  36 --
 .../org/apache/phoenix/util/PhoenixRuntime.java |   3 +-
 .../java/org/apache/phoenix/util/ScanUtil.java  |  15 +
 .../apache/phoenix/util/TransactionUtil.java|  49 ++-
 .../phoenix/execute/CorrelatePlanTest.java  |   5 +-
 .../execute/LiteralResultIteratorPlanTest.java  |   5 +-
 .../java/org/apache/phoenix/query/BaseTest.java |  26 +-
 .../phoenix/query/QueryServicesTestImpl.java|  15 +-
 .../java/org/apache/phoenix/util/TestUtil.java  |   2 +-
 phoenix-protocol/src/main/PTable.proto  |   1 +
 70 files changed, 1176 insertions(+), 1663 deletions(-)
--



[02/50] [abbrv] phoenix git commit: PHOENIX-2715 Query Log (Ankit Singhal)

2018-05-02 Thread tdsilva
http://git-wip-us.apache.org/repos/asf/phoenix/blob/0bc03684/phoenix-core/src/main/java/org/apache/phoenix/log/TableLogWriter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/log/TableLogWriter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/log/TableLogWriter.java
new file mode 100644
index 000..c102855
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/log/TableLogWriter.java
@@ -0,0 +1,125 @@
+/*
+ * 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.log;
+
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_LOG_TABLE;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Map.Entry;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.expression.Determinism;
+import org.apache.phoenix.expression.LiteralExpression;
+import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.util.ByteUtil;
+import org.apache.phoenix.util.SchemaUtil;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Writes RingBuffer log event into table 
+ * 
+ */
+public class TableLogWriter implements LogWriter {
+private static final Log LOG = LogFactory.getLog(LogWriter.class);
+private Connection connection;
+private boolean isClosed;
+private Table table;
+private Configuration config;
+
+public TableLogWriter(Configuration configuration) {
+this.config = configuration;
+try {
+this.connection = 
ConnectionFactory.createConnection(configuration);
+table = this.connection.getTable(SchemaUtil.getPhysicalTableName(
+SchemaUtil.getTableNameAsBytes(SYSTEM_CATALOG_SCHEMA, 
SYSTEM_LOG_TABLE), config));
+} catch (Exception e) {
+LOG.warn("Unable to initiate LogWriter for writing query logs to 
table");
+}
+}
+
+@Override
+public void write(RingBufferEvent event) throws SQLException, IOException {
+if(isClosed()){
+LOG.warn("Unable to commit query log as Log committer is already 
closed");
+return;
+}
+if (table == null || connection == null) {
+LOG.warn("Unable to commit query log as connection was not 
initiated ");
+return;
+}
+ImmutableMap queryInfo=event.getQueryInfo();
+ImmutableBytesWritable ptr = new ImmutableBytesWritable();
+Put put =new Put(Bytes.toBytes(event.getQueryId()));
+for (Entry entry : queryInfo.entrySet()) {
+if (entry.getKey().logLevel.ordinal() <= 
event.getConnectionLogLevel().ordinal()) {
+LiteralExpression expression = 
LiteralExpression.newConstant(entry.getValue(), entry.getKey().dataType,
+Determinism.ALWAYS);
+expression.evaluate(null, ptr);
+put.addColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES, 
Bytes.toBytes(entry.getKey().columnName),
+ByteUtil.copyKeyBytesIfNecessary(ptr));
+}
+}
+
+if (QueryLogInfo.QUERY_STATUS_I.logLevel.ordinal() <= 
event.getConnectionLogLevel().ordinal()
+&& (event.getLogState() == QueryLogState.COMPLETED || 
event.getLogState() == QueryLogState.FAILED)) {
+LiteralExpression expression = 
LiteralExpression.newConstant(event.getLogState().toString(),
+QueryLogInfo.QUERY_STATUS_I.dataType, Determinism.ALWAYS);
+expression.evaluate(null, ptr);
+put.addColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES,
+

[45/50] [abbrv] phoenix git commit: PHOENIX-4710 Don't set KEEP_DELETED_CELLS or VERSIONS for SYSTEM.LOG

2018-05-02 Thread tdsilva
PHOENIX-4710 Don't set KEEP_DELETED_CELLS or VERSIONS for SYSTEM.LOG


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

Branch: refs/heads/system-catalog
Commit: 49c02328a0627939838b51b4440abe9427244820
Parents: 6c1a624
Author: James Taylor 
Authored: Thu Apr 26 12:48:14 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 27 11:41:56 2018 -0700

--
 .../org/apache/phoenix/coprocessor/MetaDataProtocol.java| 1 -
 .../apache/phoenix/query/ConnectionQueryServicesImpl.java   | 9 ++---
 .../phoenix/query/ConnectionlessQueryServicesImpl.java  | 7 +--
 3 files changed, 3 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/49c02328/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 36d6f0d..62b701d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,7 +72,6 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_LOG_VERSIONS = 10;
 public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 
 // Min system table timestamps for every release.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/49c02328/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 8866ced..d841f0b 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
@@ -170,8 +170,8 @@ import 
org.apache.phoenix.exception.RetriableUpgradeException;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.exception.UpgradeInProgressException;
-import org.apache.phoenix.exception.UpgradeRequiredException;
 import org.apache.phoenix.exception.UpgradeNotRequiredException;
+import org.apache.phoenix.exception.UpgradeRequiredException;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.hbase.index.IndexRegionSplitPolicy;
 import org.apache.phoenix.hbase.index.Indexer;
@@ -2469,7 +2469,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
 // Available for testing
 protected String getLogTableDDL() {
-return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
+return QueryConstants.CREATE_LOG_METADATA;
 }
 
 private String setSystemDDLProperties(String ddl) {
@@ -2478,11 +2478,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
   props.getBoolean(DEFAULT_SYSTEM_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_KEEP_DELETED_CELLS));
 }
 
-private String setSystemLogDDLProperties(String ddl) {
-return String.format(ddl,
-  props.getBoolean(DEFAULT_SYSTEM_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_KEEP_DELETED_CELLS));
-}
-
 @Override
 public void init(final String url, final Properties props) throws 
SQLException {
 try {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/49c02328/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index aba9600..3531a87 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@ -164,7 +164,7 @@ public class ConnectionlessQueryServicesImpl extends 
DelegateQueryServices imple
 }

[36/50] [abbrv] phoenix git commit: PHOENIX-4699 Stop scan after finding first child of table during drop

2018-05-02 Thread tdsilva
PHOENIX-4699 Stop scan after finding first child of table during drop


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

Branch: refs/heads/system-catalog
Commit: 041e7b5a05213710fc2af0644145d8247cb02191
Parents: 8f1cef8
Author: James Taylor 
Authored: Thu Apr 19 14:39:27 2018 -0700
Committer: James Taylor 
Committed: Thu Apr 26 09:55:27 2018 -0700

--
 .../coprocessor/MetaDataEndpointImpl.java   | 44 +++-
 1 file changed, 25 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/041e7b5a/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 4c72c2d..c28ad3c 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
@@ -122,8 +122,10 @@ import 
org.apache.hadoop.hbase.coprocessor.CoprocessorException;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
+import org.apache.hadoop.hbase.filter.Filter;
 import org.apache.hadoop.hbase.filter.FilterList;
 import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
+import org.apache.hadoop.hbase.filter.PageFilter;
 import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.ipc.RpcServer.Call;
@@ -275,6 +277,10 @@ public class MetaDataEndpointImpl extends MetaDataProtocol 
implements Coprocesso
 public static final String ROW_KEY_ORDER_OPTIMIZABLE = 
"ROW_KEY_ORDER_OPTIMIZABLE";
 public static final byte[] ROW_KEY_ORDER_OPTIMIZABLE_BYTES = 
Bytes.toBytes(ROW_KEY_ORDER_OPTIMIZABLE);
 
+private static final byte[] CHILD_TABLE_BYTES = new byte[] 
{PTable.LinkType.CHILD_TABLE.getSerializedValue()};
+private static final byte[] PHYSICAL_TABLE_BYTES =
+new byte[] { PTable.LinkType.PHYSICAL_TABLE.getSerializedValue() };
+
 // KeyValues for Table
 private static final KeyValue TABLE_TYPE_KV = 
createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY, TABLE_FAMILY_BYTES, 
TABLE_TYPE_BYTES);
 private static final KeyValue TABLE_SEQ_NUM_KV = 
createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY, TABLE_FAMILY_BYTES, 
TABLE_SEQ_NUM_BYTES);
@@ -1527,7 +1533,6 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 for (PTable index : parentTable.getIndexes()) {
 
indexes.add(TableName.valueOf(index.getPhysicalName().getBytes()));
 }
-
 } else {
 // Mapped View
 cParentPhysicalName = 
SchemaUtil.getTableNameAsBytes(schemaName, tableName);
@@ -1810,13 +1815,10 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 private boolean execeededIndexQuota(PTableType tableType, PTable 
parentTable) {
 return PTableType.INDEX == tableType && 
parentTable.getIndexes().size() >= maxIndexesPerTable;
 }
-
-private static final byte[] CHILD_TABLE_BYTES = new byte[] 
{PTable.LinkType.CHILD_TABLE.getSerializedValue()};
-
 
 private void findAllChildViews(Region region, byte[] tenantId, PTable 
table,
 TableViewFinder result, long clientTimeStamp, int clientVersion) 
throws IOException, SQLException {
-TableViewFinder currResult = findChildViews(region, tenantId, table, 
clientVersion);
+TableViewFinder currResult = findChildViews(region, tenantId, table, 
clientVersion, false);
 result.addResult(currResult);
 for (ViewInfo viewInfo : currResult.getViewInfoList()) {
 byte[] viewtenantId = viewInfo.getTenantId();
@@ -1829,9 +1831,9 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 }
 }
 
-// TODO remove this in 4.13 release 
-@Deprecated
-private TableViewFinder findChildViews_deprecated(Region region, byte[] 
tenantId, PTable table, byte[] linkTypeBytes) throws IOException {
+// TODO use child link instead once splittable system catalog 
(PHOENIX-3534) is implemented
+// and we have a separate table for links.
+private TableViewFinder 

[33/50] [abbrv] phoenix git commit: Merge remote-tracking branch 'upstream/master' into PHOENIX-3534

2018-05-02 Thread tdsilva
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
--
diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index 4d6075b,aba9600..21f4f74
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@@ -318,14 -359,12 +359,17 @@@ public class ConnectionlessQueryService
  }
  
  try {
-
metaConnection.createStatement().executeUpdate(QueryConstants.CREATE_FUNCTION_METADATA);
+ 
metaConnection.createStatement().executeUpdate(getFunctionTableDDL());
  } catch (NewerTableAlreadyExistsException ignore) {
  }
- 
  try {
- 
metaConnection.createStatement().executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
-  } catch (NewerTableAlreadyExistsException ignore) {
-  }
+ 
metaConnection.createStatement().executeUpdate(getLogTableDDL());
+ } catch (NewerTableAlreadyExistsException ignore) {}
++try {
++metaConnection.createStatement()
++
.executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
++} catch (NewerTableAlreadyExistsException ignore) {
++}
  } catch (SQLException e) {
  sqlE = e;
  } finally {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
--
diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index aed22cd,22fa2f4..c7fa438
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@@ -18,98 -18,112 +18,7 @@@
  package org.apache.phoenix.query;
  
  
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.APPEND_ONLY_SCHEMA;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARG_POSITION;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARRAY_SIZE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.AUTO_PARTITION_SEQ;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BASE_COLUMN_COUNT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BUFFER_LENGTH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CACHE_SIZE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CHAR_OCTET_LENGTH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CLASS_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_COUNT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_DEF;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_FAMILY;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_NAME;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_SIZE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CURRENT_VALUE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CYCLE_FLAG;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DATA_TABLE_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DATA_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DECIMAL_DIGITS;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODING_SCHEME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FUNCTION_NAME;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_ROW_COUNT;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POST_KEY;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_ROWS;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_STORAGE_SCHEME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INCREMENT_BY;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP;
--import static 

[49/50] [abbrv] phoenix git commit: Merge remote-tracking branch 'upstream/master' into PHOENIX-3534

2018-05-02 Thread tdsilva
Merge remote-tracking branch 'upstream/master' into PHOENIX-3534


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

Branch: refs/heads/system-catalog
Commit: 7420ae3aaf6c8a02c17dedb155a29bbd9d333203
Parents: 0f58bc9 d10151e
Author: Thomas D'Silva 
Authored: Mon Apr 30 10:39:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Apr 30 10:39:24 2018 -0700

--
 .../src/build/components/all-common-files.xml   |   5 +
 phoenix-assembly/src/build/src.xml  |   7 +-
 .../apache/phoenix/end2end/AlterTableIT.java|  12 +-
 .../phoenix/end2end/AlterTableWithViewsIT.java  |  22 ++
 .../end2end/ExplainPlanWithStatsEnabledIT.java  |  49 +++-
 .../phoenix/tx/ParameterizedTransactionIT.java  |  37 +--
 .../coprocessor/MetaDataEndpointImpl.java   |  28 +-
 .../phoenix/coprocessor/MetaDataProtocol.java   |   1 -
 .../org/apache/phoenix/execute/ScanPlan.java|   4 +-
 .../phoenix/iterate/BaseResultIterators.java|  50 +++-
 .../phoenix/iterate/ParallelIterators.java  |   8 +
 .../apache/phoenix/iterate/SerialIterators.java |  13 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |   1 +
 .../query/ConnectionQueryServicesImpl.java  |  24 +-
 .../query/ConnectionlessQueryServicesImpl.java  |   7 +-
 .../apache/phoenix/query/QueryConstants.java| 107 
 .../apache/phoenix/schema/MetaDataClient.java   |  22 +-
 .../SplitOnLeadingVarCharColumnsPolicy.java |  43 +++
 .../schema/SystemFunctionSplitPolicy.java   |  27 ++
 .../phoenix/schema/SystemStatsSplitPolicy.java  |  27 ++
 .../apache/phoenix/schema/TableProperty.java| 270 ++-
 .../phoenix/schema/stats/StatisticsUtil.java|   6 +
 .../phoenix/schema/SystemSplitPolicyTest.java   |  97 +++
 .../apache/phoenix/hive/HivePhoenixStoreIT.java |  27 ++
 .../PhoenixStorageHandlerConstants.java |   8 +-
 .../phoenix/hive/query/PhoenixQueryBuilder.java |   4 +-
 .../pherf/configuration/XMLConfigParser.java|   2 +-
 .../pherf/result/impl/XMLResultHandler.java |  18 +-
 28 files changed, 664 insertions(+), 262 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7420ae3a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
--

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7420ae3a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
--
diff --cc 
phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
index 1d6e786,e1b1372..0e926f0
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
@@@ -40,14 -40,14 +41,16 @@@ import org.apache.hadoop.hbase.util.Byt
  import org.apache.phoenix.coprocessor.TephraTransactionalProcessor;
  import org.apache.phoenix.exception.SQLExceptionCode;
  import org.apache.phoenix.jdbc.PhoenixConnection;
+ import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
  import org.apache.phoenix.query.QueryConstants;
 +import org.apache.phoenix.schema.PColumn;
  import org.apache.phoenix.schema.PName;
  import org.apache.phoenix.schema.PNameFactory;
  import org.apache.phoenix.schema.PTable;
  import org.apache.phoenix.schema.PTableKey;
  import org.apache.phoenix.schema.PTableType;
 +import org.apache.phoenix.util.PhoenixRuntime;
+ import org.apache.phoenix.util.StringUtil;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.junit.runners.Parameterized;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7420ae3a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7420ae3a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
--
diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 06c9aa9,b77f113..454bcda
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@@ -584,8 -591,9 +588,8 @@@ public class MetaDataEndpointImpl exten
  builder.setTable(PTableImpl.toProto(table));
  }
  done.run(builder.build());
 -return;
  } catch (Throwable t) {
-  

[05/50] [abbrv] phoenix git commit: PHOENIX-4672 Align the kerberos principal config keys

2018-05-02 Thread tdsilva
PHOENIX-4672 Align the kerberos principal config keys

Fix the configuration keys in a manner that won't break users
who are using the 'old' name.


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

Branch: refs/heads/system-catalog
Commit: 2e6dc818d74b9b0aade96ca9f85f30abe8b9e42e
Parents: ed63661
Author: Josh Elser 
Authored: Tue Apr 10 14:08:57 2018 -0400
Committer: Josh Elser 
Committed: Tue Apr 10 14:28:51 2018 -0400

--
 .../src/main/java/org/apache/phoenix/query/QueryServices.java| 3 ++-
 .../java/org/apache/phoenix/queryserver/server/QueryServer.java  | 4 
 2 files changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2e6dc818/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 43b9e5a..21f043c 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
@@ -237,7 +237,8 @@ public interface QueryServices extends SQLCloseable {
 public static final String QUERY_SERVER_KEYTAB_FILENAME_ATTRIB = 
"phoenix.queryserver.keytab.file";
 public static final String QUERY_SERVER_HTTP_KEYTAB_FILENAME_ATTRIB = 
"phoenix.queryserver.http.keytab.file";
 public static final String QUERY_SERVER_KERBEROS_PRINCIPAL_ATTRIB = 
"phoenix.queryserver.kerberos.principal";
-public static final String QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB = 
"phoenix.queryserver.kerberos.http.principal";
+public static final String 
QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB_LEGACY = 
"phoenix.queryserver.kerberos.http.principal";
+public static final String QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB = 
"phoenix.queryserver.http.kerberos.principal";
 public static final String QUERY_SERVER_DNS_NAMESERVER_ATTRIB = 
"phoenix.queryserver.dns.nameserver";
 public static final String QUERY_SERVER_DNS_INTERFACE_ATTRIB = 
"phoenix.queryserver.dns.interface";
 public static final String QUERY_SERVER_HBASE_SECURITY_CONF_ATTRIB = 
"hbase.security.authentication";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2e6dc818/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
--
diff --git 
a/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
 
b/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
index 6b1fcfe..8436086 100644
--- 
a/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
+++ 
b/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
@@ -246,6 +246,10 @@ public final class QueryServer extends Configured 
implements Tool, Runnable {
 File keytab = new File(keytabPath);
 String httpKeytabPath = 
getConf().get(QueryServices.QUERY_SERVER_HTTP_KEYTAB_FILENAME_ATTRIB, null);
 String httpPrincipal = 
getConf().get(QueryServices.QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB, null);
+// Backwards compat for a configuration key change
+if (httpPrincipal == null) {
+  httpPrincipal = 
getConf().get(QueryServices.QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB_LEGACY, 
null);
+}
 File httpKeytab = null;
 if (null != httpKeytabPath)
   httpKeytab = new File(httpKeytabPath);



[19/50] [abbrv] phoenix git commit: PHOENIX-4579 Add a config to conditionally create Phoenix meta tables on first client connection (Chinmay Kulkarni)

2018-05-02 Thread tdsilva
PHOENIX-4579 Add a config to conditionally create Phoenix meta tables on first 
client connection (Chinmay Kulkarni)


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

Branch: refs/heads/system-catalog
Commit: 87fdda8b180438e57d0e2f6082e5a9e988220245
Parents: 7b2c7e1
Author: James Taylor 
Authored: Fri Apr 13 10:30:30 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 10:30:30 2018 -0700

--
 .../phoenix/end2end/AppendOnlySchemaIT.java |   2 +-
 .../MigrateSystemTablesToSystemNamespaceIT.java |   9 +-
 .../SystemCatalogCreationOnConnectionIT.java| 626 
 .../coprocessor/MetaDataEndpointImpl.java   |  21 +
 .../phoenix/coprocessor/MetaDataProtocol.java   |   4 +
 .../coprocessor/generated/MetaDataProtos.java   | 183 +++--
 .../exception/UpgradeRequiredException.java |  13 +-
 .../phoenix/query/ConnectionQueryServices.java  |   2 +-
 .../query/ConnectionQueryServicesImpl.java  | 750 +++
 .../query/ConnectionlessQueryServicesImpl.java  |   2 +-
 .../query/DelegateConnectionQueryServices.java  |   4 +-
 .../apache/phoenix/schema/MetaDataClient.java   |   3 +-
 .../query/ConnectionQueryServicesImplTest.java  |   7 +-
 phoenix-protocol/src/main/MetaDataService.proto |   1 +
 14 files changed, 1236 insertions(+), 391 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/87fdda8b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
index 7ed64ff..d601beb 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
@@ -114,7 +114,7 @@ public class AppendOnlySchemaIT extends 
ParallelStatsDisabledIT {
 // verify no create table rpcs
 verify(connectionQueryServices, 
never()).createTable(anyListOf(Mutation.class),
 any(byte[].class), any(PTableType.class), anyMap(), anyList(), 
any(byte[][].class),
-eq(false), eq(false));
+eq(false), eq(false), eq(false));
 reset(connectionQueryServices);
 
 // execute alter table ddl that adds the same column

http://git-wip-us.apache.org/repos/asf/phoenix/blob/87fdda8b/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 7cb5857..627e453 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
@@ -376,8 +376,10 @@ public class MigrateSystemTablesToSystemNamespaceIT 
extends BaseTest {
 while(rs.next()) {
 
 if(rs.getString("IS_NAMESPACE_MAPPED") == null) {
+// Check that entry for SYSTEM namespace exists in SYSCAT
 systemSchemaExists = 
rs.getString("TABLE_SCHEM").equals(PhoenixDatabaseMetaData.SYSTEM_SCHEMA_NAME) 
? true : systemSchemaExists;
 } else if (rs.getString("COLUMN_NAME") == null) {
+// Found the intial entry for a table in SYSCAT
 String schemaName = rs.getString("TABLE_SCHEM");
 String tableName = rs.getString("TABLE_NAME");
 
@@ -395,12 +397,11 @@ public class MigrateSystemTablesToSystemNamespaceIT 
extends BaseTest {
 }
 }
 
-if(!systemSchemaExists) {
-fail(PhoenixDatabaseMetaData.SYSTEM_SCHEMA_NAME + " entry doesn't 
exist in SYSTEM.CATALOG table.");
-}
-
 // The set will contain SYSMUTEX table since that table is not exposed 
in SYSCAT
 if (systemTablesMapped) {
+if (!systemSchemaExists) {
+fail(PhoenixDatabaseMetaData.SYSTEM_SCHEMA_NAME + " entry 
doesn't exist in SYSTEM.CATALOG table.");
+}
 assertTrue(namespaceMappedSystemTablesSet.size() == 1);
 } else {
 assertTrue(systemTablesSet.size() == 1);


[11/50] [abbrv] phoenix git commit: PHOENIX-4605 Support running multiple transaction providers

2018-05-02 Thread tdsilva
http://git-wip-us.apache.org/repos/asf/phoenix/blob/de83b8d5/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionTable.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionTable.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionTable.java
deleted file mode 100644
index 55785be..000
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionTable.java
+++ /dev/null
@@ -1,366 +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.
- */
-package org.apache.phoenix.transaction;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.Append;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Durability;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.HTableInterface;
-import org.apache.hadoop.hbase.client.Increment;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.Row;
-import org.apache.hadoop.hbase.client.RowMutations;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.client.coprocessor.Batch.Call;
-import org.apache.hadoop.hbase.client.coprocessor.Batch.Callback;
-import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
-import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
-import org.apache.tephra.TxConstants;
-import org.apache.tephra.hbase.TransactionAwareHTable;
-import org.apache.phoenix.schema.PTable;
-import org.apache.phoenix.schema.PTableType;
-
-import com.google.protobuf.Descriptors.MethodDescriptor;
-import com.google.protobuf.Message;
-import com.google.protobuf.Service;
-import com.google.protobuf.ServiceException;
-
-public class TephraTransactionTable implements PhoenixTransactionalTable {
-
-private TransactionAwareHTable transactionAwareHTable;
-
-private TephraTransactionContext tephraTransactionContext;
-
-public TephraTransactionTable(PhoenixTransactionContext ctx, 
HTableInterface hTable) {
-this(ctx, hTable, null);
-}
-
-public TephraTransactionTable(PhoenixTransactionContext ctx, 
HTableInterface hTable, PTable pTable) {
-
-assert(ctx instanceof TephraTransactionContext);
-
-tephraTransactionContext = (TephraTransactionContext) ctx;
-
-transactionAwareHTable = new TransactionAwareHTable(hTable, (pTable != 
null && pTable.isImmutableRows()) ? TxConstants.ConflictDetection.NONE : 
TxConstants.ConflictDetection.ROW);
-
-tephraTransactionContext.addTransactionAware(transactionAwareHTable);
-
-if (pTable != null && pTable.getType() != PTableType.INDEX) {
-tephraTransactionContext.markDMLFence(pTable);
-}
-}
-
-@Override
-public Result get(Get get) throws IOException {
-return transactionAwareHTable.get(get);
-}
-
-@Override
-public void put(Put put) throws IOException {
-transactionAwareHTable.put(put);
-}
-
-@Override
-public void delete(Delete delete) throws IOException {
-transactionAwareHTable.delete(delete);
-}
-
-@Override
-public ResultScanner getScanner(Scan scan) throws IOException {
-return transactionAwareHTable.getScanner(scan);
-}
-
-@Override
-public byte[] getTableName() {
-return transactionAwareHTable.getTableName();
-}
-
-@Override
-public Configuration getConfiguration() {
-return transactionAwareHTable.getConfiguration();
-}
-
-@Override
-public HTableDescriptor getTableDescriptor() throws IOException {
-return transactionAwareHTable.getTableDescriptor();
-}
-
-@Override
-public boolean exists(Get get) throws IOException {
-return transactionAwareHTable.exists(get);
-}
-
-@Override
-public Result[] get(List gets) throws IOException {

[37/50] [abbrv] phoenix git commit: PHOENIX-4698 Tolerate orphaned views (Maddineni Sukumar)

2018-05-02 Thread tdsilva
PHOENIX-4698 Tolerate orphaned views (Maddineni Sukumar)


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

Branch: refs/heads/system-catalog
Commit: 8dd637dc41ae9fa1cb9c3111481e216059f95c34
Parents: 041e7b5
Author: James Taylor 
Authored: Thu Apr 19 14:42:24 2018 -0700
Committer: James Taylor 
Committed: Thu Apr 26 09:55:28 2018 -0700

--
 .../coprocessor/MetaDataEndpointImpl.java   | 50 +---
 1 file changed, 33 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8dd637dc/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 c28ad3c..ddd3ffe 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
@@ -592,7 +592,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol 
implements Coprocesso
 done.run(builder.build());
 return;
 } catch (Throwable t) {
-   logger.error("getTable failed", t);
+logger.error("getTable failed", t);
 ProtobufUtil.setControllerException(controller,
 
ServerUtil.createIOException(SchemaUtil.getTableName(schemaName, tableName), 
t));
 }
@@ -755,9 +755,9 @@ public class MetaDataEndpointImpl extends MetaDataProtocol 
implements Coprocesso

// compatibility.
 Cell sortOrderKv = colKeyValues[SORT_ORDER_INDEX];
 SortOrder sortOrder =
-   sortOrderKv == null ? SortOrder.getDefault() : 
SortOrder.fromSystemValue(PInteger.INSTANCE
+sortOrderKv == null ? SortOrder.getDefault() : 
SortOrder.fromSystemValue(PInteger.INSTANCE
 .getCodec().decodeInt(sortOrderKv.getValueArray(),
-   sortOrderKv.getValueOffset(), 
SortOrder.getDefault()));
+sortOrderKv.getValueOffset(), 
SortOrder.getDefault()));
 
 Cell arraySizeKv = colKeyValues[ARRAY_SIZE_INDEX];
 Integer arraySize = arraySizeKv == null ? null :
@@ -1313,9 +1313,9 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 return table.getName() == null;
 }
 
-   private static boolean isSchemaDeleted(PSchema schema) {
-   return schema.getSchemaName() == null;
-   }
+private static boolean isSchemaDeleted(PSchema schema) {
+return schema.getSchemaName() == null;
+}
 
 private static boolean isFunctionDeleted(PFunction function) {
 return function.getFunctionName() == null;
@@ -1827,6 +1827,13 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 byte[] tableKey = SchemaUtil.getTableKey(viewtenantId, viewSchema, 
viewTable);
 ImmutableBytesPtr cacheKey = new ImmutableBytesPtr(tableKey);
 PTable view = loadTable(env, tableKey, cacheKey, clientTimeStamp, 
clientTimeStamp, clientVersion);
+if (view == null) {
+logger.warn("Found orphan tenant view row in SYSTEM.CATALOG 
with tenantId:"
++ Bytes.toString(tenantId) + ", schema:"
++ Bytes.toString(viewSchema) + ", table:"
++ Bytes.toString(viewTable));
+continue;
+}
 findAllChildViews(region, viewtenantId, view, result, 
clientTimeStamp, clientVersion);
 }
 }
@@ -1969,8 +1976,9 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 if (systemCatalog.getTimeStamp() < MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0) {
 return findChildViews_deprecated(region, tenantId, table, 
PHYSICAL_TABLE_BYTES, stopAfterFirst);
 } else {
-return findChildViews_4_11(region, tenantId, 
table.getSchemaName().getBytes(),
-table.getTableName().getBytes(), stopAfterFirst);
+return findChildViews_4_11(region, tenantId, 
+table.getSchemaName() == null ? ByteUtil.EMPTY_BYTE_ARRAY 
: table.getSchemaName().getBytes(),
+table.getTableName().getBytes(), stopAfterFirst);
 }
 }
 

[29/50] [abbrv] phoenix git commit: Revert "PHOENIX-4601 Perform server-side retries if client version < 4.14"

2018-05-02 Thread tdsilva
Revert "PHOENIX-4601 Perform server-side retries if client version < 4.14"

This reverts commit d7afec21c500ccd7f5334e9c0958c40fcc95df14.


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

Branch: refs/heads/system-catalog
Commit: 5ff900e57c5040ea9ee42d0ca48c0cf68cf86b30
Parents: d7afec2
Author: Vincent Poon 
Authored: Fri Apr 20 14:26:27 2018 -0700
Committer: Vincent Poon 
Committed: Fri Apr 20 14:26:27 2018 -0700

--
 .../hbase/index/write/IndexWriterUtils.java | 36 
 .../write/ParallelWriterIndexCommitter.java | 12 ++-
 .../TrackingParallelWriterIndexCommitter.java   | 13 +++
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  1 -
 4 files changed, 14 insertions(+), 48 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5ff900e5/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
index 0d3004f..76d6800 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
@@ -21,7 +21,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.hbase.index.table.HTableFactory;
 import org.apache.phoenix.hbase.index.util.IndexManagementUtil;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -59,19 +58,15 @@ public class IndexWriterUtils {
public static final String INDEX_WRITES_THREAD_MAX_PER_REGIONSERVER_KEY = 
"phoenix.index.writes.threads.max";
public static final String HTABLE_KEEP_ALIVE_KEY = 
"hbase.htable.threads.keepalivetime";
 
-   @Deprecated
public static final String INDEX_WRITER_RPC_RETRIES_NUMBER = 
"phoenix.index.writes.rpc.retries.number";
-   /**
-* Based on the logic in HBase's AsyncProcess, a default of 11 retries with 
a pause of 100ms
-* approximates 48 sec total retry time (factoring in backoffs).  The total 
time should be less
-* than HBase's rpc timeout (default of 60 sec) or else the client will 
retry before receiving
-* the response
-*/
-   @Deprecated
-   public static final int DEFAULT_INDEX_WRITER_RPC_RETRIES_NUMBER = 11;
-   @Deprecated
+/**
+ * Retry server-server index write rpc only once, and let the client retry 
the data write
+ * instead to avoid typing up the handler
+ */
+   // note in HBase 2+, numTries = numRetries + 1
+   // in prior versions, numTries = numRetries
+   public static final int DEFAULT_INDEX_WRITER_RPC_RETRIES_NUMBER = 1;
public static final String INDEX_WRITER_RPC_PAUSE = 
"phoenix.index.writes.rpc.pause";
-   @Deprecated
public static final int DEFAULT_INDEX_WRITER_RPC_PAUSE = 100;
 
   private IndexWriterUtils() {
@@ -81,29 +76,12 @@ public class IndexWriterUtils {
 public static HTableFactory 
getDefaultDelegateHTableFactory(CoprocessorEnvironment env) {
 // create a simple delegate factory, setup the way we need
 Configuration conf = 
PropertiesUtil.cloneConfig(env.getConfiguration());
-setHTableThreads(conf);
-return ServerUtil.getDelegateHTableFactory(env, conf);
-}
-
-private static void setHTableThreads(Configuration conf) {
 // set the number of threads allowed per table.
 int htableThreads =
 
conf.getInt(IndexWriterUtils.INDEX_WRITER_PER_TABLE_THREADS_CONF_KEY,
 IndexWriterUtils.DEFAULT_NUM_PER_TABLE_THREADS);
 LOG.trace("Creating HTableFactory with " + htableThreads + " threads 
for each HTable.");
 IndexManagementUtil.setIfNotSet(conf, HTABLE_THREAD_KEY, 
htableThreads);
-}
-
-/**
- * Retry server-server index write rpc only once, and let the client retry 
the data write
- * instead to avoid tying up the handler
- */
-public static HTableFactory 
getNoRetriesHTableFactory(CoprocessorEnvironment env) {
-Configuration conf = 
PropertiesUtil.cloneConfig(env.getConfiguration());
-setHTableThreads(conf);
-// note in HBase 2+, numTries = numRetries + 1
-// in prior versions, numTries = numRetries
-conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  

[10/50] [abbrv] phoenix git commit: PHOENIX-4366 Rebuilding a local index fails sometimes (addendum)

2018-05-02 Thread tdsilva
PHOENIX-4366 Rebuilding a local index fails sometimes (addendum)


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

Branch: refs/heads/system-catalog
Commit: ca58fae2037b0da9331aa97d9836ca195f289bb1
Parents: 5a16bff
Author: James Taylor 
Authored: Wed Apr 11 15:20:08 2018 -0700
Committer: James Taylor 
Committed: Wed Apr 11 15:22:00 2018 -0700

--
 .../NonAggregateRegionScannerFactory.java   | 37 +++-
 1 file changed, 20 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ca58fae2/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
index da99ff5..ba6a08f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
@@ -18,8 +18,15 @@
 
 package org.apache.phoenix.iterate;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import static 
org.apache.phoenix.util.EncodedColumnsUtil.getMinMaxQualifiersFromScan;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.KeyValue;
@@ -61,16 +68,8 @@ import org.apache.phoenix.util.IndexUtil;
 import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.ServerUtil;
 
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import static 
org.apache.phoenix.util.EncodedColumnsUtil.getMinMaxQualifiersFromScan;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 public class NonAggregateRegionScannerFactory extends RegionScannerFactory {
 
@@ -103,13 +102,17 @@ public class NonAggregateRegionScannerFactory extends 
RegionScannerFactory {
 boolean useNewValueColumnQualifier = 
EncodedColumnsUtil.useNewValueColumnQualifier(scan);
 
 Set arrayKVRefs = Sets.newHashSet();
+KeyValueSchema kvSchema = null;
+ValueBitSet kvSchemaBitSet = null;
 Expression[] arrayFuncRefs = 
deserializeArrayPositionalExpressionInfoFromScan(scan, innerScanner, 
arrayKVRefs);
-KeyValueSchema.KeyValueSchemaBuilder builder = new 
KeyValueSchema.KeyValueSchemaBuilder(0);
-for (Expression expression : arrayFuncRefs) {
-builder.addField(expression);
+if (arrayFuncRefs != null) {
+KeyValueSchema.KeyValueSchemaBuilder builder = new 
KeyValueSchema.KeyValueSchemaBuilder(0);
+for (Expression expression : arrayFuncRefs) {
+builder.addField(expression);
+}
+kvSchema = builder.build();
+kvSchemaBitSet = ValueBitSet.newInstance(kvSchema);
 }
-KeyValueSchema kvSchema = builder.build();
-ValueBitSet kvSchemaBitSet = ValueBitSet.newInstance(kvSchema);
 TupleProjector tupleProjector = null;
 Region dataRegion = null;
 IndexMaintainer indexMaintainer = null;



[25/50] [abbrv] phoenix git commit: PHOENIX-4298 refactoring to avoid using deprecated API for Put/Delete(Sergey Soldatov)

2018-05-02 Thread tdsilva
PHOENIX-4298 refactoring to avoid using deprecated API for Put/Delete(Sergey 
Soldatov)


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

Branch: refs/heads/system-catalog
Commit: fc6cf43a476c2048c2ee4431311487b30517a208
Parents: 153b357
Author: Rajeshbabu Chintaguntla 
Authored: Thu Apr 19 17:19:20 2018 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Thu Apr 19 17:19:20 2018 +0530

--
 ...ReplayWithIndexWritesAndCompressedWALIT.java |  2 +-
 .../end2end/ColumnProjectionOptimizationIT.java | 14 
 .../apache/phoenix/end2end/DynamicColumnIT.java | 12 +++
 .../apache/phoenix/end2end/DynamicFamilyIT.java | 26 +++---
 .../phoenix/end2end/MappingTableDataTypeIT.java |  4 +--
 .../phoenix/end2end/NativeHBaseTypesIT.java | 30 
 .../end2end/QueryDatabaseMetaDataIT.java|  4 +--
 .../org/apache/phoenix/end2end/UpgradeIT.java   |  4 +--
 .../phoenix/tx/ParameterizedTransactionIT.java  |  4 +--
 .../coprocessor/MetaDataEndpointImpl.java   | 36 ++--
 .../UngroupedAggregateRegionObserver.java   |  2 +-
 .../apache/phoenix/index/IndexMaintainer.java   | 12 +++
 .../query/ConnectionQueryServicesImpl.java  |  2 +-
 .../org/apache/phoenix/schema/PTableImpl.java   |  4 +--
 .../phoenix/schema/stats/StatisticsWriter.java  |  9 +++--
 .../java/org/apache/phoenix/util/IndexUtil.java |  6 ++--
 .../wal/ReadWriteKeyValuesWithCodecTest.java|  6 ++--
 .../index/covered/CoveredColumnIndexCodec.java  |  2 +-
 .../index/covered/LocalTableStateTest.java  | 10 +++---
 .../covered/TestCoveredColumnIndexCodec.java|  6 ++--
 .../hbase/index/write/TestIndexWriter.java  | 10 ++
 .../index/write/TestParalleIndexWriter.java |  2 +-
 .../write/TestParalleWriterIndexCommitter.java  |  2 +-
 .../index/write/TestWALRecoveryCaching.java |  4 +--
 .../recovery/TestPerRegionIndexWriteCache.java  |  4 +--
 .../java/org/apache/phoenix/util/TestUtil.java  |  4 +--
 26 files changed, 106 insertions(+), 115 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc6cf43a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
index e2ddd4e..49933b2 100644
--- 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
@@ -210,7 +210,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
 //make an attempted write to the primary that should also be indexed
 byte[] rowkey = Bytes.toBytes("indexed_row_key");
 Put p = new Put(rowkey);
-p.add(family, Bytes.toBytes("qual"), Bytes.toBytes("value"));
+p.addColumn(family, Bytes.toBytes("qual"), Bytes.toBytes("value"));
 region.put(p);
 
 // we should then see the server go down

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc6cf43a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
index e4ff66f..43dc302 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationIT.java
@@ -242,19 +242,19 @@ public class ColumnProjectionOptimizationIT extends 
ParallelStatsDisabledIT {
 try {
 htable = conn2.getQueryServices().getTable(htableName);
 Put put = new Put(PInteger.INSTANCE.toBytes(1));
-put.add(cfB, c1, PInteger.INSTANCE.toBytes(1));
-put.add(cfC, c2, PLong.INSTANCE.toBytes(2));
+put.addColumn(cfB, c1, PInteger.INSTANCE.toBytes(1));
+put.addColumn(cfC, c2, PLong.INSTANCE.toBytes(2));
 htable.put(put);
 
 put = new Put(PInteger.INSTANCE.toBytes(2));
-put.add(cfC, c2, PLong.INSTANCE.toBytes(10));
-put.add(cfC, c3, PVarchar.INSTANCE.toBytes("abcd"));
+

[22/50] [abbrv] phoenix git commit: PHOENIX-4496 Fix RowValueConstructorIT and IndexMetadataIT

2018-05-02 Thread tdsilva
PHOENIX-4496 Fix RowValueConstructorIT and IndexMetadataIT


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

Branch: refs/heads/system-catalog
Commit: db0e1eda6025d640b55eb30ece2047761cdc8ca4
Parents: 430e802
Author: Ankit Singhal 
Authored: Sat Apr 14 09:54:11 2018 +0530
Committer: Ankit Singhal 
Committed: Sat Apr 14 09:54:11 2018 +0530

--
 .../phoenix/hbase/index/scanner/ScannerBuilder.java | 16 
 1 file changed, 16 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/db0e1eda/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
index ad09c0c..703fcd2 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.filter.BinaryComparator;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.filter.FamilyFilter;
 import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.FilterBase;
 import org.apache.hadoop.hbase.filter.FilterList;
 import org.apache.hadoop.hbase.filter.QualifierFilter;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -98,6 +99,21 @@ public class ScannerBuilder {
   }
   columnFilters.addFilter(columnFilter);
 }
+
+if(columns.isEmpty()){
+columnFilters.addFilter(new FilterBase() {
+
+@Override
+public boolean filterAllRemaining() throws IOException {
+return true;
+}
+
+@Override
+public ReturnCode filterKeyValue(Cell v) throws IOException {
+return Filter.ReturnCode.INCLUDE;
+}
+});
+}
 return columnFilters;
   }
 



[16/50] [abbrv] phoenix git commit: PHOENIX-4496 Fix RowValueConstructorIT and IndexMetadataIT

2018-05-02 Thread tdsilva
PHOENIX-4496 Fix RowValueConstructorIT and IndexMetadataIT


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

Branch: refs/heads/system-catalog
Commit: 70c9c6bb2d2073bb40640a0a794032b166c4b63b
Parents: a0b0c1e
Author: Ankit Singhal 
Authored: Fri Apr 13 12:09:30 2018 +0530
Committer: Ankit Singhal 
Committed: Fri Apr 13 12:09:30 2018 +0530

--
 .../phoenix/hbase/index/scanner/ScannerBuilder.java   | 10 ++
 1 file changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/70c9c6bb/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
index ad09c0c..4c42fe4 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.filter.BinaryComparator;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.filter.FamilyFilter;
 import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.FilterBase;
 import org.apache.hadoop.hbase.filter.FilterList;
 import org.apache.hadoop.hbase.filter.QualifierFilter;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -98,6 +99,15 @@ public class ScannerBuilder {
   }
   columnFilters.addFilter(columnFilter);
 }
+
+if(columns.isEmpty()){
+columnFilters.addFilter(new FilterBase(){
+@Override
+public boolean filterAllRemaining() throws IOException {
+return true;
+}
+});
+}
 return columnFilters;
   }
 



[32/50] [abbrv] phoenix git commit: PHOENIX-4645 PhoenixStorageHandler doesn't handle correctly data/timestamp in push down predicate when engine is tez.(Sergey Soldatov)

2018-05-02 Thread tdsilva
PHOENIX-4645 PhoenixStorageHandler doesn't handle correctly data/timestamp in 
push down predicate when engine is tez.(Sergey Soldatov)


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

Branch: refs/heads/system-catalog
Commit: 8f1cef824b086c7c697688767e0460c18fa554d6
Parents: 78636a3
Author: Rajeshbabu Chintaguntla 
Authored: Tue Apr 24 11:24:43 2018 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Tue Apr 24 11:24:43 2018 +0530

--
 .../apache/phoenix/hive/HivePhoenixStoreIT.java | 27 
 .../PhoenixStorageHandlerConstants.java |  8 +++---
 .../phoenix/hive/query/PhoenixQueryBuilder.java |  4 +--
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8f1cef82/phoenix-hive/src/it/java/org/apache/phoenix/hive/HivePhoenixStoreIT.java
--
diff --git 
a/phoenix-hive/src/it/java/org/apache/phoenix/hive/HivePhoenixStoreIT.java 
b/phoenix-hive/src/it/java/org/apache/phoenix/hive/HivePhoenixStoreIT.java
index 1828818..66f99ad 100644
--- a/phoenix-hive/src/it/java/org/apache/phoenix/hive/HivePhoenixStoreIT.java
+++ b/phoenix-hive/src/it/java/org/apache/phoenix/hive/HivePhoenixStoreIT.java
@@ -309,6 +309,33 @@ public class HivePhoenixStoreIT  extends 
BaseHivePhoenixStoreIT {
 assert (rs.getString(2).equalsIgnoreCase("part1"));
 assert (rs.getDouble(3) == 200);
 }
+}
+
+@Test
+public void testTimestampPredicate() throws Exception {
+String testName = "testTimeStampPredicate";
+hbaseTestUtil.getTestFileSystem().createNewFile(new Path(hiveLogDir, 
testName + ".out"));
+createFile("10\t2013-01-02 01:01:01.123456\n", new Path(hiveOutputDir, 
testName + ".out").toString());
+createFile(StringUtil.EMPTY_STRING, new Path(hiveLogDir, testName + 
".out").toString());
 
+StringBuilder sb = new StringBuilder();
+sb.append("CREATE TABLE timeStampTable(ID int,ts TIMESTAMP)" + 
HiveTestUtil.CRLF +
+" STORED BY  
\"org.apache.phoenix.hive.PhoenixStorageHandler\"" + HiveTestUtil
+.CRLF +
+" TBLPROPERTIES(" + HiveTestUtil.CRLF +
+"   'phoenix.hbase.table.name'='TIMESTAMPTABLE'," + 
HiveTestUtil.CRLF +
+"   'phoenix.zookeeper.znode.parent'='/hbase'," + 
HiveTestUtil.CRLF +
+"   'phoenix.zookeeper.quorum'='localhost'," + 
HiveTestUtil.CRLF +
+"   'phoenix.zookeeper.client.port'='" +
+hbaseTestUtil.getZkCluster().getClientPort() + "'," + 
HiveTestUtil.CRLF +
+"   'phoenix.column.mapping' = 'id:ID, ts:TS'," + 
HiveTestUtil.CRLF +
+"   'phoenix.rowkeys'='id');" + HiveTestUtil.CRLF);
+sb.append("INSERT INTO TABLE timeStampTable VALUES (10, \"2013-01-02 
01:01:01.123456\");" + HiveTestUtil.CRLF);
+sb.append("SELECT * from timeStampTable WHERE ts between '2013-01-02 
01:01:01.123455' and " +
+" '2013-01-02 12:01:02.123457789' AND id = 10;" + 
HiveTestUtil.CRLF);
+
+String fullPath = new Path(hbaseTestUtil.getDataTestDir(), 
testName).toString();
+createFile(sb.toString(), fullPath);
+runTest(testName, fullPath);
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8f1cef82/phoenix-hive/src/main/java/org/apache/phoenix/hive/constants/PhoenixStorageHandlerConstants.java
--
diff --git 
a/phoenix-hive/src/main/java/org/apache/phoenix/hive/constants/PhoenixStorageHandlerConstants.java
 
b/phoenix-hive/src/main/java/org/apache/phoenix/hive/constants/PhoenixStorageHandlerConstants.java
index 07c374e..e3c7d84 100644
--- 
a/phoenix-hive/src/main/java/org/apache/phoenix/hive/constants/PhoenixStorageHandlerConstants.java
+++ 
b/phoenix-hive/src/main/java/org/apache/phoenix/hive/constants/PhoenixStorageHandlerConstants.java
@@ -90,13 +90,13 @@ public class PhoenixStorageHandlerConstants {
 public static final String PATERN_MARKER = "$targetPattern$";
 public static final String DATE_PATTERN = "'?\\d{4}-\\d{2}-\\d{2}'?";
 public static final String TIMESTAMP_PATTERN = "'?\\d{4}-\\d{2}-\\d{2} 
\\d{2}:\\d{2}:\\d{2}\\" +
-".?\\d{0,3}'?";
-public static final String COMMON_OPERATOR_PATTERN = "(\\(?" + 
COLUMNE_MARKER + "\\)?\\s*" +
+".?\\d{0,9}'?";
+public static final String COMMON_OPERATOR_PATTERN = "(\\(?\"?" + 
COLUMNE_MARKER + "\"?\\)?\\s*" +
 "(=|>|<|<=|>=)\\s*(" + 

[34/50] [abbrv] phoenix git commit: Merge remote-tracking branch 'upstream/master' into PHOENIX-3534

2018-05-02 Thread tdsilva
Merge remote-tracking branch 'upstream/master' into PHOENIX-3534


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

Branch: refs/heads/system-catalog
Commit: d615dc0cb707d33f58eaeb897269ee074b33c550
Parents: f30994f 78636a3
Author: Thomas D'Silva 
Authored: Wed Apr 25 09:11:00 2018 -0700
Committer: Thomas D'Silva 
Committed: Wed Apr 25 09:11:00 2018 -0700

--
 bin/performance.py  |4 +-
 bin/phoenix_utils.py|2 +-
 dev/make_rc.sh  |   15 +-
 phoenix-assembly/pom.xml|2 +-
 phoenix-client/pom.xml  |2 +-
 phoenix-core/pom.xml|   16 +-
 ...ReplayWithIndexWritesAndCompressedWALIT.java |2 +-
 .../org/apache/phoenix/end2end/AggregateIT.java |  130 +-
 .../apache/phoenix/end2end/AlterTableIT.java|2 +-
 .../phoenix/end2end/AlterTableWithViewsIT.java  |6 +-
 .../phoenix/end2end/AppendOnlySchemaIT.java |2 +-
 .../phoenix/end2end/ArrayAppendFunctionIT.java  |   43 +-
 .../phoenix/end2end/ArrayRemoveFunctionIT.java  |  383 
 .../phoenix/end2end/BasePermissionsIT.java  |4 +
 .../phoenix/end2end/ChangePermissionsIT.java|   34 +-
 .../phoenix/end2end/CollationKeyFunctionIT.java |   37 +-
 .../end2end/ColumnProjectionOptimizationIT.java |   14 +-
 .../ConnectionQueryServicesTestImpl.java|   34 +-
 .../phoenix/end2end/CostBasedDecisionIT.java|  420 +++--
 .../apache/phoenix/end2end/CreateTableIT.java   |5 +-
 .../org/apache/phoenix/end2end/DeleteIT.java|  101 ++
 .../org/apache/phoenix/end2end/DropTableIT.java |   43 +
 .../apache/phoenix/end2end/DynamicColumnIT.java |   14 +-
 .../apache/phoenix/end2end/DynamicFamilyIT.java |   26 +-
 .../end2end/ExplainPlanWithStatsEnabledIT.java  |  334 ++--
 .../apache/phoenix/end2end/IndexExtendedIT.java |6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |6 +-
 .../phoenix/end2end/LocalIndexSplitMergeIT.java |   59 +
 .../org/apache/phoenix/end2end/MapReduceIT.java |   69 +-
 .../phoenix/end2end/MappingTableDataTypeIT.java |6 +-
 .../MigrateSystemTablesToSystemNamespaceIT.java |   49 +-
 .../phoenix/end2end/MultiCfQueryExecIT.java |   47 +
 .../end2end/NamespaceSchemaMappingIT.java   |   19 +-
 .../phoenix/end2end/NativeHBaseTypesIT.java |   30 +-
 .../org/apache/phoenix/end2end/OrderByIT.java   |  129 +-
 .../phoenix/end2end/ParallelStatsEnabledIT.java |1 +
 .../PartialScannerResultsDisabledIT.java|2 +-
 .../apache/phoenix/end2end/PhoenixDriverIT.java |   99 +-
 .../end2end/QueryDatabaseMetaDataIT.java|   39 +-
 .../apache/phoenix/end2end/QueryLoggerIT.java   |  358 
 .../apache/phoenix/end2end/ReverseScanIT.java   |   88 +-
 .../phoenix/end2end/SortMergeJoinMoreIT.java|  116 +-
 .../phoenix/end2end/SpillableGroupByIT.java |   74 +-
 .../SystemCatalogCreationOnConnectionIT.java|  626 +++
 .../end2end/SystemTablePermissionsIT.java   |2 +-
 .../end2end/TenantSpecificTablesDDLIT.java  |2 +
 .../UngroupedAggregateRegionObserverIT.java |  171 --
 .../org/apache/phoenix/end2end/UpgradeIT.java   |2 +-
 .../end2end/UpsertSelectAutoCommitIT.java   |   28 +
 .../phoenix/end2end/UserDefinedFunctionsIT.java |  165 +-
 .../phoenix/end2end/index/BaseIndexIT.java  |   22 +
 .../index/ChildViewsUseParentViewIndexIT.java   |   10 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |3 +
 .../end2end/index/MutableIndexFailureIT.java|   27 +-
 .../phoenix/end2end/index/MutableIndexIT.java   |   95 +
 .../end2end/index/MutableIndexRebuilderIT.java  |  143 ++
 .../end2end/index/PartialIndexRebuilderIT.java  |  130 +-
 .../phoenix/end2end/index/ViewIndexIT.java  |   45 +-
 .../end2end/index/txn/TxWriteFailureIT.java |6 +-
 .../apache/phoenix/end2end/join/BaseJoinIT.java |2 +
 .../phoenix/end2end/join/HashJoinMoreIT.java|4 +-
 .../apache/phoenix/end2end/join/SubqueryIT.java |   49 +-
 .../join/SubqueryUsingSortMergeJoinIT.java  |   12 +-
 .../phoenix/monitoring/PhoenixMetricsIT.java|   24 +-
 .../phoenix/tx/FlappingTransactionIT.java   |   11 +-
 .../phoenix/tx/ParameterizedTransactionIT.java  |   18 +-
 .../org/apache/phoenix/tx/TransactionIT.java|   12 +
 .../org/apache/phoenix/tx/TxCheckpointIT.java   |5 +-
 .../hadoop/hbase/ipc/PhoenixRpcScheduler.java   |   30 +
 .../controller/ClientRpcControllerFactory.java  |   18 +-
 .../ipc/controller/IndexRpcController.java  |8 +-
 ...erRegionServerIndexRpcControllerFactory.java |   18 +-
 ...egionServerMetadataRpcControllerFactory.java |   17 +-
 

[01/50] [abbrv] phoenix git commit: PHOENIX-4669 NoSuchColumnFamilyException when creating index on views that are built on tables which have named column family

2018-05-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/system-catalog 15d4dace4 -> f7d87ce2f


PHOENIX-4669 NoSuchColumnFamilyException when creating index on views that are 
built on tables which have named column family

Signed-off-by: ss77892 


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

Branch: refs/heads/system-catalog
Commit: 98a8ddda49eb38b72984ea3800c4ed37299f0254
Parents: 28c11fe
Author: Toshihiro Suzuki 
Authored: Thu Mar 29 17:17:37 2018 +0900
Committer: ss77892 
Committed: Mon Apr 9 21:39:40 2018 -0700

--
 .../phoenix/end2end/index/ViewIndexIT.java  | 45 +++-
 .../query/ConnectionQueryServicesImpl.java  | 27 ++--
 2 files changed, 57 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/98a8ddda/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
index 53bb550..8ffd798 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
@@ -31,6 +31,7 @@ import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -443,5 +444,47 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
 assertFalse(rs.next());
 assertEquals(indexName, 
stmt.getQueryPlan().getContext().getCurrentTable().getTable().getName().getString());
 }
-
+
+@Test
+public void 
testCreatingIndexOnViewBuiltOnTableWithOnlyNamedColumnFamilies() throws 
Exception {
+try (Connection c = getConnection(); Statement s = 
c.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+
+c.setAutoCommit(true);
+s.execute("CREATE TABLE " + tableName + " (COL1 VARCHAR PRIMARY 
KEY, CF.COL2 VARCHAR)");
+s.executeUpdate("UPSERT INTO " + tableName + " VALUES ('AAA', 
'BBB')");
+s.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + 
tableName);
+s.execute("CREATE INDEX " + indexName + " ON " + viewName + " 
(CF.COL2)");
+
+try (ResultSet rs = s.executeQuery("SELECT * FROM " + viewName + " 
WHERE CF.COL2 = 'BBB'")) {
+assertTrue(rs.next());
+assertEquals("AAA", rs.getString("COL1"));
+assertEquals("BBB", rs.getString("COL2"));
+}
+}
+try (Connection c = getConnection(); Statement s = 
c.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String index1Name = generateUniqueName();
+String index2Name = generateUniqueName();
+
+c.setAutoCommit(true);
+s.execute("create table " + tableName + " (i1 integer primary key, 
c2.i2 integer, c3.i3 integer, c4.i4 integer)");
+s.execute("create view " + viewName + " as select * from " + 
tableName + " where c2.i2 = 1");
+s.executeUpdate("upsert into " + viewName + "(i1, c3.i3, c4.i4) 
VALUES (1, 1, 1)");
+s.execute("create index " + index1Name + " ON " + viewName + " 
(c3.i3)");
+s.execute("create index " + index2Name + " ON " + viewName + " 
(c3.i3) include (c4.i4)");
+s.executeUpdate("upsert into " + viewName + "(i1, c3.i3, c4.i4) 
VALUES (2, 2, 2)");
+
+try (ResultSet rs = s.executeQuery("select * from " + viewName + " 
WHERE c3.i3 = 1")) {
+assertTrue(rs.next());
+assertEquals(1, rs.getInt("i1"));
+assertEquals(1, rs.getInt("i2"));
+assertEquals(1, rs.getInt("i3"));
+assertEquals(1, rs.getInt("i4"));
+}
+}
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/98a8ddda/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
 

[30/50] [abbrv] phoenix git commit: PHOENIX-4601 Perform server-side retries if client version < 4.14

2018-05-02 Thread tdsilva
PHOENIX-4601 Perform server-side retries if client version < 4.14


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

Branch: refs/heads/system-catalog
Commit: 78636a3c25a775d4da2cf52c7cdc7c51ef82bb64
Parents: 5ff900e
Author: Vincent Poon 
Authored: Fri Apr 20 14:22:10 2018 -0700
Committer: Vincent Poon 
Committed: Fri Apr 20 14:27:29 2018 -0700

--
 .../hbase/index/write/IndexWriterUtils.java | 36 
 .../write/ParallelWriterIndexCommitter.java | 12 +--
 .../TrackingParallelWriterIndexCommitter.java   | 13 ---
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  1 +
 4 files changed, 48 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/78636a3c/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
index 76d6800..0d3004f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
@@ -21,6 +21,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.hbase.index.table.HTableFactory;
 import org.apache.phoenix.hbase.index.util.IndexManagementUtil;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -58,15 +59,19 @@ public class IndexWriterUtils {
public static final String INDEX_WRITES_THREAD_MAX_PER_REGIONSERVER_KEY = 
"phoenix.index.writes.threads.max";
public static final String HTABLE_KEEP_ALIVE_KEY = 
"hbase.htable.threads.keepalivetime";
 
+   @Deprecated
public static final String INDEX_WRITER_RPC_RETRIES_NUMBER = 
"phoenix.index.writes.rpc.retries.number";
-/**
- * Retry server-server index write rpc only once, and let the client retry 
the data write
- * instead to avoid typing up the handler
- */
-   // note in HBase 2+, numTries = numRetries + 1
-   // in prior versions, numTries = numRetries
-   public static final int DEFAULT_INDEX_WRITER_RPC_RETRIES_NUMBER = 1;
+   /**
+* Based on the logic in HBase's AsyncProcess, a default of 11 retries with 
a pause of 100ms
+* approximates 48 sec total retry time (factoring in backoffs).  The total 
time should be less
+* than HBase's rpc timeout (default of 60 sec) or else the client will 
retry before receiving
+* the response
+*/
+   @Deprecated
+   public static final int DEFAULT_INDEX_WRITER_RPC_RETRIES_NUMBER = 11;
+   @Deprecated
public static final String INDEX_WRITER_RPC_PAUSE = 
"phoenix.index.writes.rpc.pause";
+   @Deprecated
public static final int DEFAULT_INDEX_WRITER_RPC_PAUSE = 100;
 
   private IndexWriterUtils() {
@@ -76,12 +81,29 @@ public class IndexWriterUtils {
 public static HTableFactory 
getDefaultDelegateHTableFactory(CoprocessorEnvironment env) {
 // create a simple delegate factory, setup the way we need
 Configuration conf = 
PropertiesUtil.cloneConfig(env.getConfiguration());
+setHTableThreads(conf);
+return ServerUtil.getDelegateHTableFactory(env, conf);
+}
+
+private static void setHTableThreads(Configuration conf) {
 // set the number of threads allowed per table.
 int htableThreads =
 
conf.getInt(IndexWriterUtils.INDEX_WRITER_PER_TABLE_THREADS_CONF_KEY,
 IndexWriterUtils.DEFAULT_NUM_PER_TABLE_THREADS);
 LOG.trace("Creating HTableFactory with " + htableThreads + " threads 
for each HTable.");
 IndexManagementUtil.setIfNotSet(conf, HTABLE_THREAD_KEY, 
htableThreads);
+}
+
+/**
+ * Retry server-server index write rpc only once, and let the client retry 
the data write
+ * instead to avoid tying up the handler
+ */
+public static HTableFactory 
getNoRetriesHTableFactory(CoprocessorEnvironment env) {
+Configuration conf = 
PropertiesUtil.cloneConfig(env.getConfiguration());
+setHTableThreads(conf);
+// note in HBase 2+, numTries = numRetries + 1
+// in prior versions, numTries = numRetries
+conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
 return ServerUtil.getDelegateHTableFactory(env, conf);
 }
 


[26/50] [abbrv] phoenix git commit: PHOENIX-4600 Add retry logic for partial index rebuilder writes

2018-05-02 Thread tdsilva
PHOENIX-4600 Add retry logic for partial index rebuilder writes


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

Branch: refs/heads/system-catalog
Commit: b768900d9f9699fad612acc643866e3e420e7ce0
Parents: fc6cf43
Author: Vincent Poon 
Authored: Thu Apr 19 10:30:14 2018 -0700
Committer: Vincent Poon 
Committed: Thu Apr 19 12:03:34 2018 -0700

--
 .../end2end/index/MutableIndexRebuilderIT.java  | 143 +++
 .../UngroupedAggregateRegionObserver.java   |  32 +++--
 2 files changed, 160 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b768900d/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexRebuilderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexRebuilderIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexRebuilderIT.java
new file mode 100644
index 000..8420f16
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexRebuilderIT.java
@@ -0,0 +1,143 @@
+package org.apache.phoenix.end2end.index;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+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.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.client.HTableInterface;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver;
+import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
+import org.apache.phoenix.coprocessor.MetaDataRegionObserver;
+import 
org.apache.phoenix.coprocessor.MetaDataRegionObserver.BuildIndexScheduleTask;
+import org.apache.phoenix.end2end.BaseUniqueNamesOwnClusterIT;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.PIndexState;
+import org.apache.phoenix.util.EnvironmentEdgeManager;
+import org.apache.phoenix.util.IndexUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.RunUntilFailure;
+import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.google.common.collect.Maps;
+
+@RunWith(RunUntilFailure.class)
+public class MutableIndexRebuilderIT extends BaseUniqueNamesOwnClusterIT {
+private static final int WAIT_AFTER_DISABLED = 0;
+private static final long REBUILD_PERIOD = 5;
+private static final long REBUILD_INTERVAL = 2000;
+private static RegionCoprocessorEnvironment 
indexRebuildTaskRegionEnvironment;
+
+/**
+ * Tests that the index rebuilder retries for exactly the configured # of 
retries
+ * @throws Exception
+ */
+@Test
+public void testRebuildRetriesSuccessful() throws Throwable {
+int numberOfRetries = 5;
+Map serverProps = Maps.newHashMapWithExpectedSize(10);
+serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_ATTRIB, 
Boolean.TRUE.toString());
+
serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_INTERVAL_ATTRIB, 
Long.toString(REBUILD_INTERVAL));
+
serverProps.put(QueryServices.INDEX_REBUILD_DISABLE_TIMESTAMP_THRESHOLD, 
"5000");
+serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_PERIOD, 
Long.toString(REBUILD_PERIOD)); // batch at 50 seconds
+
serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_FORWARD_TIME_ATTRIB,
 Long.toString(WAIT_AFTER_DISABLED));
+serverProps.put(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
numberOfRetries + "");
+Map clientProps = Maps.newHashMapWithExpectedSize(1);
+setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new 

[20/50] [abbrv] phoenix git commit: PHOENIX-4668 Remove unnecessary table descriptor modification for SPLIT_POLICY column (Chinmay Kulkarni)

2018-05-02 Thread tdsilva
PHOENIX-4668 Remove unnecessary table descriptor modification for SPLIT_POLICY 
column (Chinmay Kulkarni)


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

Branch: refs/heads/system-catalog
Commit: a5770a5a4d41bf786d3d8dd7ca9088a00418b666
Parents: 87fdda8
Author: James Taylor 
Authored: Fri Apr 13 14:19:15 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 14:19:15 2018 -0700

--
 .../phoenix/query/ConnectionQueryServicesImpl.java   | 11 ---
 1 file changed, 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a5770a5a/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 8b328d3..4c1902d 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
@@ -1130,10 +1130,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
PBoolean.INSTANCE.toObject(newDesc.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES
 {
 newDesc.setValue(HTableDescriptor.SPLIT_POLICY, 
IndexRegionSplitPolicy.class.getName());
 }
-// Remove the splitPolicy attribute to prevent HBASE-12570
-if (isMetaTable) {
-newDesc.remove(HTableDescriptor.SPLIT_POLICY);
-}
 try {
 if (splits == null) {
 admin.createTable(newDesc);
@@ -1150,13 +1146,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 if (isMetaTable && !isUpgradeRequired()) {
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 this.getProps()).getName());
-/*
- * Now we modify the table to add the split policy, since 
we know that the client and
- * server and compatible. This works around HBASE-12570 
which causes the cluster to be
- * brought down.
- */
-newDesc.setValue(HTableDescriptor.SPLIT_POLICY, 
MetaDataSplitPolicy.class.getName());
-modifyTable(physicalTableName, newDesc, true);
 }
 return null;
 } else {



[12/50] [abbrv] phoenix git commit: PHOENIX-4605 Support running multiple transaction providers

2018-05-02 Thread tdsilva
http://git-wip-us.apache.org/repos/asf/phoenix/blob/de83b8d5/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 a7b31e8..1a11427 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
@@ -69,6 +69,7 @@ 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.PVarchar;
+import org.apache.phoenix.transaction.TransactionFactory;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.EncodedColumnsUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
@@ -134,7 +135,7 @@ public class PTableImpl implements PTable {
 private boolean disableWAL;
 private boolean multiTenant;
 private boolean storeNulls;
-private boolean isTransactional;
+private TransactionFactory.Provider transactionProvider;
 private ViewType viewType;
 private Short viewIndexId;
 private int estimatedSize;
@@ -227,7 +228,7 @@ public class PTableImpl implements PTable {
 init(tenantId, this.schemaName, this.tableName, PTableType.INDEX, 
state, timeStamp, sequenceNumber, pkName, bucketNum, columns,
 this.schemaName, parentTableName, indexes, isImmutableRows, 
physicalNames, defaultFamilyName,
 null, disableWAL, multiTenant, storeNulls, viewType, viewIndexId, 
indexType, baseColumnCount, rowKeyOrderOptimizable,
-isTransactional, updateCacheFrequency, indexDisableTimestamp, 
isNamespaceMpped, null, false, storageScheme, qualifierEncodingScheme, 
encodedCQCounter, useStatsForParallelization);
+transactionProvider, updateCacheFrequency, indexDisableTimestamp, 
isNamespaceMpped, null, false, storageScheme, qualifierEncodingScheme, 
encodedCQCounter, useStatsForParallelization);
 }
 
 public PTableImpl(long timeStamp) { // For delete marker
@@ -270,7 +271,7 @@ public class PTableImpl implements PTable {
 table.getSequenceNumber(), table.getPKName(), 
table.getBucketNum(), getColumnsToClone(table), table.getParentSchemaName(), 
table.getParentTableName(),
 indexes, table.isImmutableRows(), physicalNames, 
table.getDefaultFamilyName(), viewStatement,
 table.isWALDisabled(), table.isMultiTenant(), 
table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), 
table.getIndexType(),
-table.getBaseColumnCount(), 
table.rowKeyOrderOptimizable(), table.isTransactional(), updateCacheFrequency,
+table.getBaseColumnCount(), 
table.rowKeyOrderOptimizable(), table.getTransactionProvider(), 
updateCacheFrequency,
 table.getIndexDisableTimestamp(), 
table.isNamespaceMapped(), table.getAutoPartitionSeqName(), 
table.isAppendOnlySchema(), table.getImmutableStorageScheme(), 
table.getEncodingScheme(), table.getEncodedCQCounter(), 
table.useStatsForParallelization());
 }
 
@@ -280,7 +281,7 @@ public class PTableImpl implements PTable {
 table.getSequenceNumber(), table.getPKName(), 
table.getBucketNum(), getColumnsToClone(table), parentSchemaName, 
table.getParentTableName(),
 indexes, table.isImmutableRows(), table.getPhysicalNames(), 
table.getDefaultFamilyName(), viewStatement,
 table.isWALDisabled(), table.isMultiTenant(), 
table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), 
table.getIndexType(),
-table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), 
table.isTransactional(), table.getUpdateCacheFrequency(),
+table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), 
table.getTransactionProvider(), table.getUpdateCacheFrequency(),
 table.getIndexDisableTimestamp(), table.isNamespaceMapped(), 
table.getAutoPartitionSeqName(), table.isAppendOnlySchema(), 
table.getImmutableStorageScheme(), table.getEncodingScheme(), 
table.getEncodedCQCounter(), table.useStatsForParallelization());
 }
 
@@ -290,7 +291,7 @@ public class PTableImpl implements PTable {
 table.getSequenceNumber(), table.getPKName(), 
table.getBucketNum(), columns, table.getParentSchemaName(), 
table.getParentTableName(),
 table.getIndexes(), table.isImmutableRows(), 
table.getPhysicalNames(), table.getDefaultFamilyName(), 
table.getViewStatement(),
 table.isWALDisabled(), table.isMultiTenant(), 
table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), 
table.getIndexType(),
-table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), 
table.isTransactional(), table.getUpdateCacheFrequency(),

[13/50] [abbrv] phoenix git commit: PHOENIX-4605 Support running multiple transaction providers

2018-05-02 Thread tdsilva
http://git-wip-us.apache.org/repos/asf/phoenix/blob/de83b8d5/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
index c5065e0..59c10ad 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
@@ -19,120 +19,7 @@ package org.apache.phoenix.expression;
 
 import java.util.Map;
 
-import org.apache.phoenix.expression.function.AbsFunction;
-import org.apache.phoenix.expression.function.ArrayAllComparisonExpression;
-import org.apache.phoenix.expression.function.ArrayAnyComparisonExpression;
-import org.apache.phoenix.expression.function.ArrayAppendFunction;
-import org.apache.phoenix.expression.function.ArrayConcatFunction;
-import org.apache.phoenix.expression.function.ArrayElemRefExpression;
-import org.apache.phoenix.expression.function.ArrayFillFunction;
-import org.apache.phoenix.expression.function.ArrayIndexFunction;
-import org.apache.phoenix.expression.function.ArrayLengthFunction;
-import org.apache.phoenix.expression.function.ArrayPrependFunction;
-import org.apache.phoenix.expression.function.ArrayRemoveFunction;
-import org.apache.phoenix.expression.function.ArrayToStringFunction;
-import org.apache.phoenix.expression.function.ByteBasedRegexpReplaceFunction;
-import org.apache.phoenix.expression.function.ByteBasedRegexpSplitFunction;
-import org.apache.phoenix.expression.function.ByteBasedRegexpSubstrFunction;
-import org.apache.phoenix.expression.function.CbrtFunction;
-import org.apache.phoenix.expression.function.CeilDateExpression;
-import org.apache.phoenix.expression.function.CeilDecimalExpression;
-import org.apache.phoenix.expression.function.CeilFunction;
-import org.apache.phoenix.expression.function.CeilMonthExpression;
-import org.apache.phoenix.expression.function.CeilTimestampExpression;
-import org.apache.phoenix.expression.function.CeilWeekExpression;
-import org.apache.phoenix.expression.function.CeilYearExpression;
-import org.apache.phoenix.expression.function.CoalesceFunction;
-import org.apache.phoenix.expression.function.CollationKeyFunction;
-import org.apache.phoenix.expression.function.ConvertTimezoneFunction;
-import org.apache.phoenix.expression.function.CountAggregateFunction;
-import org.apache.phoenix.expression.function.DayOfMonthFunction;
-import org.apache.phoenix.expression.function.DayOfWeekFunction;
-import org.apache.phoenix.expression.function.DayOfYearFunction;
-import org.apache.phoenix.expression.function.DecodeFunction;
-import org.apache.phoenix.expression.function.DefaultValueExpression;
-import org.apache.phoenix.expression.function.DistinctCountAggregateFunction;
-import 
org.apache.phoenix.expression.function.DistinctCountHyperLogLogAggregateFunction;
-import org.apache.phoenix.expression.function.DistinctValueAggregateFunction;
-import org.apache.phoenix.expression.function.EncodeFunction;
-import org.apache.phoenix.expression.function.ExpFunction;
-import org.apache.phoenix.expression.function.ExternalSqlTypeIdFunction;
-import org.apache.phoenix.expression.function.FirstValueFunction;
-import org.apache.phoenix.expression.function.FirstValuesFunction;
-import org.apache.phoenix.expression.function.FloorDateExpression;
-import org.apache.phoenix.expression.function.FloorDecimalExpression;
-import org.apache.phoenix.expression.function.FloorFunction;
-import org.apache.phoenix.expression.function.FloorMonthExpression;
-import org.apache.phoenix.expression.function.FloorWeekExpression;
-import org.apache.phoenix.expression.function.FloorYearExpression;
-import org.apache.phoenix.expression.function.GetBitFunction;
-import org.apache.phoenix.expression.function.GetByteFunction;
-import org.apache.phoenix.expression.function.HourFunction;
-import org.apache.phoenix.expression.function.IndexStateNameFunction;
-import org.apache.phoenix.expression.function.InstrFunction;
-import org.apache.phoenix.expression.function.InvertFunction;
-import org.apache.phoenix.expression.function.LTrimFunction;
-import org.apache.phoenix.expression.function.LastValueFunction;
-import org.apache.phoenix.expression.function.LastValuesFunction;
-import org.apache.phoenix.expression.function.LengthFunction;
-import org.apache.phoenix.expression.function.LnFunction;
-import org.apache.phoenix.expression.function.LogFunction;
-import org.apache.phoenix.expression.function.LowerFunction;
-import org.apache.phoenix.expression.function.LpadFunction;
-import org.apache.phoenix.expression.function.MD5Function;
-import org.apache.phoenix.expression.function.MaxAggregateFunction;
-import org.apache.phoenix.expression.function.MinAggregateFunction;
-import 

[03/50] [abbrv] phoenix git commit: PHOENIX-2715 Query Log (Ankit Singhal)

2018-05-02 Thread tdsilva
PHOENIX-2715 Query Log (Ankit Singhal)


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

Branch: refs/heads/system-catalog
Commit: 0bc0368455ae03de2f3f2cabd72de06e5cb90cbb
Parents: 98a8ddd
Author: Ankit Singhal 
Authored: Tue Apr 10 12:21:00 2018 +0530
Committer: Ankit Singhal 
Committed: Tue Apr 10 12:21:00 2018 +0530

--
 phoenix-core/pom.xml|   5 +
 .../end2end/QueryDatabaseMetaDataIT.java|   4 +
 .../apache/phoenix/end2end/QueryLoggerIT.java   | 358 +++
 .../end2end/TenantSpecificTablesDDLIT.java  |   2 +
 .../phoenix/compile/StatementContext.java   |  10 +
 .../phoenix/coprocessor/MetaDataProtocol.java   |   5 +-
 .../phoenix/iterate/ScanningResultIterator.java |  18 +-
 .../apache/phoenix/jdbc/PhoenixConnection.java  |  17 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  18 +
 .../phoenix/jdbc/PhoenixPreparedStatement.java  |  11 +-
 .../apache/phoenix/jdbc/PhoenixResultSet.java   |  38 ++
 .../apache/phoenix/jdbc/PhoenixStatement.java   |  67 +++-
 .../java/org/apache/phoenix/log/LogLevel.java   |  22 ++
 .../java/org/apache/phoenix/log/LogWriter.java  |  51 +++
 .../log/QueryLogDetailsEventHandler.java|  63 
 .../org/apache/phoenix/log/QueryLogInfo.java|  87 +
 .../org/apache/phoenix/log/QueryLogState.java   |  22 ++
 .../org/apache/phoenix/log/QueryLogger.java | 145 
 .../log/QueryLoggerDefaultExceptionHandler.java |  51 +++
 .../phoenix/log/QueryLoggerDisruptor.java   | 117 ++
 .../org/apache/phoenix/log/QueryLoggerUtil.java |  62 
 .../org/apache/phoenix/log/RingBufferEvent.java |  93 +
 .../phoenix/log/RingBufferEventTranslator.java  |  53 +++
 .../org/apache/phoenix/log/TableLogWriter.java  | 125 +++
 .../phoenix/monitoring/ReadMetricQueue.java |  44 ++-
 .../phoenix/monitoring/ScanMetricsHolder.java   |  48 ++-
 .../phoenix/query/ConnectionQueryServices.java  |   6 +
 .../query/ConnectionQueryServicesImpl.java  |  35 +-
 .../query/ConnectionlessQueryServicesImpl.java  |  18 +
 .../query/DelegateConnectionQueryServices.java  |  14 +
 .../apache/phoenix/query/QueryConstants.java|  45 +++
 .../org/apache/phoenix/query/QueryServices.java |   4 +
 .../phoenix/query/QueryServicesOptions.java |   9 +-
 pom.xml |   6 +
 34 files changed, 1612 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0bc03684/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index a64d4c3..76ca9c9 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -480,5 +480,10 @@
   i18n-util
   ${i18n-util.version}
 
+   
+com.lmax
+disruptor
+${disruptor.version}
+  
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0bc03684/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
index 7a2d3e1..c7c8ebf 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
@@ -166,6 +166,10 @@ public class QueryDatabaseMetaDataIT extends 
ParallelStatsDisabledIT {
 assertEquals(PTableType.SYSTEM.toString(), 
rs.getString("TABLE_TYPE"));
 assertTrue(rs.next());
 assertEquals(SYSTEM_CATALOG_SCHEMA, rs.getString("TABLE_SCHEM"));
+assertEquals(PhoenixDatabaseMetaData.SYSTEM_LOG_TABLE, 
rs.getString("TABLE_NAME"));
+assertEquals(PTableType.SYSTEM.toString(), 
rs.getString("TABLE_TYPE"));
+assertTrue(rs.next());
+assertEquals(SYSTEM_CATALOG_SCHEMA, rs.getString("TABLE_SCHEM"));
 assertEquals(TYPE_SEQUENCE, rs.getString("TABLE_NAME"));
 assertEquals(PTableType.SYSTEM.toString(), 
rs.getString("TABLE_TYPE"));
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0bc03684/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java 

[31/50] [abbrv] phoenix git commit: Add test UpgradeIT.testMoveParentChildLinks()

2018-05-02 Thread tdsilva
Add test UpgradeIT.testMoveParentChildLinks()


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

Branch: refs/heads/system-catalog
Commit: f30994f60f61c00135136b3aabaabc1193ea2cdf
Parents: 41f8142
Author: Thomas D'Silva 
Authored: Mon Apr 23 16:31:41 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Apr 23 16:31:41 2018 -0700

--
 .../java/org/apache/phoenix/end2end/UpgradeIT.java  | 12 ++--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 
 .../java/org/apache/phoenix/util/UpgradeUtil.java   |  4 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f30994f6/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
index ac0cbd3..eb362fb 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
@@ -20,7 +20,6 @@ package org.apache.phoenix.end2end;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static 
org.apache.phoenix.query.ConnectionQueryServicesImpl.UPGRADE_MUTEX;
 import static 
org.apache.phoenix.query.ConnectionQueryServicesImpl.UPGRADE_MUTEX_UNLOCKED;
-import static 
org.apache.phoenix.util.UpgradeUtil.SELECT_BASE_COLUMN_COUNT_FROM_HEADER_ROW;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -42,11 +41,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.curator.shaded.com.google.common.collect.Sets;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.RowMutations;
 import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
@@ -549,7 +546,7 @@ public class UpgradeIT extends ParallelStatsDisabledIT {
 }
 
 @Test
-public void testAddParentChildLinks() throws Exception {
+public void testMoveParentChildLinks() throws Exception {
 String schema = "S_" + generateUniqueName();
 String table1 = "T_" + generateUniqueName();
 String table2 = "T_" + generateUniqueName();
@@ -589,13 +586,16 @@ public class UpgradeIT extends ParallelStatsDisabledIT {
 Set expectedChildLinkSet = getChildLinks(conn);
 
 // delete all the child links
-conn.createStatement().execute("DELETE FROM SYSTEM.CATALOG WHERE 
LINK_TYPE = "
+conn.createStatement().execute("DELETE FROM SYSTEM.CHILD_LINK 
WHERE LINK_TYPE = "
 + LinkType.CHILD_TABLE.getSerializedValue());
 
 // re-create them by running the upgrade code
 PhoenixConnection phxMetaConn = 
metaConn.unwrap(PhoenixConnection.class);
 phxMetaConn.setRunningUpgrade(true);
+// create the parent-> child links in SYSTEM.CATALOG
 UpgradeUtil.addParentToChildLinks(phxMetaConn);
+// move the parent->child links to SYSTEM.CHILD_LINK
+UpgradeUtil.moveChildLinks(phxMetaConn);
 Set actualChildLinkSet = getChildLinks(conn);
 
 assertEquals("Unexpected child links", expectedChildLinkSet, 
actualChildLinkSet);
@@ -605,7 +605,7 @@ public class UpgradeIT extends ParallelStatsDisabledIT {
 private Set getChildLinks(Connection conn) throws SQLException {
 ResultSet rs =
 conn.createStatement().executeQuery(
-"SELECT TENANT_ID, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, 
COLUMN_FAMILY FROM SYSTEM.CATALOG WHERE LINK_TYPE = "
+"SELECT TENANT_ID, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, 
COLUMN_FAMILY FROM SYSTEM.CHILD_LINK WHERE LINK_TYPE = "
 + LinkType.CHILD_TABLE.getSerializedValue());
 Set childLinkSet = Sets.newHashSet();
 while (rs.next()) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f30994f6/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 

[43/50] [abbrv] phoenix git commit: fix test failures

2018-05-02 Thread tdsilva
fix test failures


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

Branch: refs/heads/system-catalog
Commit: 0f58bc92db3c6101361b6a9b6cffaf340865a856
Parents: f8ce60c
Author: Thomas D'Silva 
Authored: Fri Apr 27 10:16:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Apr 27 10:16:28 2018 -0700

--
 .../MigrateSystemTablesToSystemNamespaceIT.java |  2 +-
 .../SystemCatalogCreationOnConnectionIT.java| 34 +---
 .../org/apache/phoenix/schema/PTableImpl.java   |  2 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  3 ++
 4 files changed, 28 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0f58bc92/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 7960543..a4350ef 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
@@ -63,7 +63,7 @@ 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.MUTEX","SYSTEM.LOG", "SYSTEM.CHILD_LINK"));
 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"));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0f58bc92/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 689eb20..aa2d971 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
@@ -17,6 +17,22 @@
  */
 package org.apache.phoenix.end2end;
 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeoutException;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
@@ -28,7 +44,11 @@ import org.apache.phoenix.exception.UpgradeRequiredException;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver;
 import org.apache.phoenix.jdbc.PhoenixTestDriver;
-import org.apache.phoenix.query.*;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.query.ConnectionQueryServicesImpl;
+import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesTestImpl;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.apache.phoenix.util.UpgradeUtil;
 import org.junit.After;
@@ -36,14 +56,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.*;
-import java.util.concurrent.TimeoutException;
-
-import static org.junit.Assert.*;
-
 @Category(NeedsOwnMiniClusterTest.class)
 public class SystemCatalogCreationOnConnectionIT {
 private HBaseTestingUtility testUtil = null;
@@ -60,11 +72,11 @@ public class SystemCatalogCreationOnConnectionIT {
 
 private static final Set PHOENIX_SYSTEM_TABLES = new 
HashSet<>(Arrays.asList(
   "SYSTEM.CATALOG", "SYSTEM.SEQUENCE", "SYSTEM.STATS", 

[50/50] [abbrv] phoenix git commit: Merge branch 'PHOENIX-3534' into system-catalog

2018-05-02 Thread tdsilva
Merge branch 'PHOENIX-3534' into system-catalog


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

Branch: refs/heads/system-catalog
Commit: f7d87ce2fec91bf5eb7d4d06f8f1d35579669440
Parents: 15d4dac 7420ae3
Author: Thomas D'Silva 
Authored: Wed May 2 20:32:53 2018 -0700
Committer: Thomas D'Silva 
Committed: Wed May 2 20:32:53 2018 -0700

--
 bin/performance.py  |4 +-
 bin/phoenix_utils.py|2 +-
 dev/make_rc.sh  |   15 +-
 phoenix-assembly/pom.xml|2 +-
 .../src/build/components/all-common-files.xml   |5 +
 phoenix-assembly/src/build/src.xml  |7 +-
 phoenix-client/pom.xml  |2 +-
 phoenix-core/pom.xml|   16 +-
 ...ReplayWithIndexWritesAndCompressedWALIT.java |2 +-
 .../org/apache/phoenix/end2end/AggregateIT.java |  130 +-
 .../apache/phoenix/end2end/AlterTableIT.java|   14 +-
 .../phoenix/end2end/AlterTableWithViewsIT.java  |   28 +-
 .../phoenix/end2end/AppendOnlySchemaIT.java |2 +-
 .../phoenix/end2end/ArrayAppendFunctionIT.java  |   43 +-
 .../phoenix/end2end/ArrayRemoveFunctionIT.java  |  383 
 .../phoenix/end2end/BasePermissionsIT.java  |4 +
 .../phoenix/end2end/ChangePermissionsIT.java|   34 +-
 .../phoenix/end2end/CollationKeyFunctionIT.java |   37 +-
 .../end2end/ColumnProjectionOptimizationIT.java |   14 +-
 .../ConnectionQueryServicesTestImpl.java|   34 +-
 .../phoenix/end2end/CostBasedDecisionIT.java|  420 +++--
 .../apache/phoenix/end2end/CreateTableIT.java   |5 +-
 .../org/apache/phoenix/end2end/DeleteIT.java|  101 ++
 .../org/apache/phoenix/end2end/DropTableIT.java |   43 +
 .../apache/phoenix/end2end/DynamicColumnIT.java |   14 +-
 .../apache/phoenix/end2end/DynamicFamilyIT.java |   26 +-
 .../end2end/ExplainPlanWithStatsEnabledIT.java  |  383 ++--
 .../apache/phoenix/end2end/IndexExtendedIT.java |6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |6 +-
 .../phoenix/end2end/LocalIndexSplitMergeIT.java |   59 +
 .../org/apache/phoenix/end2end/MapReduceIT.java |   69 +-
 .../phoenix/end2end/MappingTableDataTypeIT.java |6 +-
 .../MigrateSystemTablesToSystemNamespaceIT.java |   49 +-
 .../phoenix/end2end/MultiCfQueryExecIT.java |   47 +
 .../end2end/NamespaceSchemaMappingIT.java   |   19 +-
 .../phoenix/end2end/NativeHBaseTypesIT.java |   30 +-
 .../org/apache/phoenix/end2end/OrderByIT.java   |  129 +-
 .../phoenix/end2end/ParallelStatsEnabledIT.java |1 +
 .../PartialScannerResultsDisabledIT.java|2 +-
 .../apache/phoenix/end2end/PhoenixDriverIT.java |   99 +-
 .../end2end/QueryDatabaseMetaDataIT.java|   39 +-
 .../apache/phoenix/end2end/QueryLoggerIT.java   |  358 
 .../apache/phoenix/end2end/ReverseScanIT.java   |   88 +-
 .../phoenix/end2end/SortMergeJoinMoreIT.java|  116 +-
 .../phoenix/end2end/SpillableGroupByIT.java |   74 +-
 .../SystemCatalogCreationOnConnectionIT.java|  638 +++
 .../end2end/SystemTablePermissionsIT.java   |2 +-
 .../end2end/TenantSpecificTablesDDLIT.java  |2 +
 .../UngroupedAggregateRegionObserverIT.java |  171 --
 .../org/apache/phoenix/end2end/UpgradeIT.java   |   14 +-
 .../end2end/UpsertSelectAutoCommitIT.java   |   28 +
 .../phoenix/end2end/UserDefinedFunctionsIT.java |  165 +-
 .../phoenix/end2end/index/BaseIndexIT.java  |   22 +
 .../index/ChildViewsUseParentViewIndexIT.java   |   10 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |3 +
 .../end2end/index/MutableIndexFailureIT.java|   27 +-
 .../phoenix/end2end/index/MutableIndexIT.java   |   95 +
 .../end2end/index/MutableIndexRebuilderIT.java  |  143 ++
 .../end2end/index/PartialIndexRebuilderIT.java  |  130 +-
 .../phoenix/end2end/index/ViewIndexIT.java  |   45 +-
 .../end2end/index/txn/TxWriteFailureIT.java |6 +-
 .../apache/phoenix/end2end/join/BaseJoinIT.java |2 +
 .../phoenix/end2end/join/HashJoinMoreIT.java|4 +-
 .../apache/phoenix/end2end/join/SubqueryIT.java |   49 +-
 .../join/SubqueryUsingSortMergeJoinIT.java  |   12 +-
 .../phoenix/monitoring/PhoenixMetricsIT.java|   24 +-
 .../phoenix/tx/FlappingTransactionIT.java   |   11 +-
 .../phoenix/tx/ParameterizedTransactionIT.java  |   55 +-
 .../org/apache/phoenix/tx/TransactionIT.java|   12 +
 .../org/apache/phoenix/tx/TxCheckpointIT.java   |5 +-
 .../hadoop/hbase/ipc/PhoenixRpcScheduler.java   |   30 +
 .../controller/ClientRpcControllerFactory.java  |   18 +-
 .../ipc/controller/IndexRpcController.java  |8 +-
 

[18/50] [abbrv] phoenix git commit: PHOENIX-4579 Add a config to conditionally create Phoenix meta tables on first client connection (Chinmay Kulkarni)

2018-05-02 Thread tdsilva
http://git-wip-us.apache.org/repos/asf/phoenix/blob/87fdda8b/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 914f62a..8b328d3 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
@@ -170,6 +170,7 @@ import 
org.apache.phoenix.exception.RetriableUpgradeException;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.exception.UpgradeInProgressException;
+import org.apache.phoenix.exception.UpgradeRequiredException;
 import org.apache.phoenix.exception.UpgradeNotRequiredException;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.hbase.index.IndexRegionSplitPolicy;
@@ -1041,23 +1042,69 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
 /**
  *
- * @param tableName
+ * @param physicalTableName
+ * @param tableType
+ * @param props
+ * @param families
  * @param splits
- * @param modifyExistingMetaData TODO
+ * @param modifyExistingMetaData
+ * @param isNamespaceMapped
+ * @param isDoNotUpgradePropSet
  * @return true if table was created and false if it already exists
  * @throws SQLException
  */
 private HTableDescriptor ensureTableCreated(byte[] physicalTableName, 
PTableType tableType, Map props,
 List>> families, byte[][] splits, 
boolean modifyExistingMetaData,
-boolean isNamespaceMapped) throws SQLException {
+boolean isNamespaceMapped, boolean isDoNotUpgradePropSet) throws 
SQLException {
 SQLException sqlE = null;
 HTableDescriptor existingDesc = null;
 boolean isMetaTable = SchemaUtil.isMetaTable(physicalTableName);
 boolean tableExist = true;
 try (HBaseAdmin admin = getAdmin()) {
 final String quorum = ZKConfig.getZKQuorumServersString(config);
-final String znode = 
this.props.get(HConstants.ZOOKEEPER_ZNODE_PARENT);
+final String znode = 
this.getProps().get(HConstants.ZOOKEEPER_ZNODE_PARENT);
 logger.debug("Found quorum: " + quorum + ":" + znode);
+
+if (isMetaTable) {
+if(SchemaUtil.isNamespaceMappingEnabled(PTableType.SYSTEM, 
this.getProps())) {
+try {
+// SYSTEM namespace needs to be created via HBase APIs 
because "CREATE SCHEMA" statement tries to write
+// its metadata in SYSTEM:CATALOG table. Without 
SYSTEM namespace, SYSTEM:CATALOG table cannot be created
+
ensureNamespaceCreated(QueryConstants.SYSTEM_SCHEMA_NAME);
+} catch (PhoenixIOException e) {
+// We could either:
+// 1) Not access the NS descriptor. The NS may or may 
not exist at this point
+// 2) We could not create the NS
+// Regardless of the case 1 or 2, if we eventually try 
to migrate SYSTEM tables to the SYSTEM
+// namespace using the {@link 
ensureSystemTablesMigratedToSystemNamespace(ReadOnlyProps)} method,
+// if the NS does not exist, we will error as 
expected, or
+// if the NS does exist and tables are already mapped, 
the check will exit gracefully
+}
+if 
(admin.tableExists(SchemaUtil.getPhysicalTableName(SYSTEM_CATALOG_NAME_BYTES, 
false))) {
+// SYSTEM.CATALOG exists, so at this point, we have 3 
cases:
+// 1) If server-side namespace mapping is disabled, 
throw Inconsistent namespace mapping exception
+// 2) If server-side namespace mapping is enabled and 
SYSCAT needs to be upgraded, upgrade SYSCAT
+//and also migrate SYSTEM tables to the SYSTEM 
namespace
+// 3. If server-side namespace mapping is enabled and 
SYSCAT doesn't need to be upgraded, we still
+//need to migrate SYSTEM tables to the SYSTEM 
namespace using the
+//{@link 
ensureSystemTablesMigratedToSystemNamespace(ReadOnlyProps)} method (as part of
+//{@link upgradeSystemTables(String, Properties)})
+
checkClientServerCompatibility(SYSTEM_CATALOG_NAME_BYTES);
+// Thrown so we can force an upgrade which will just 
migrate SYSTEM tables to the 

[28/50] [abbrv] phoenix git commit: PHOENIX-4601 Perform server-side retries if client version < 4.14

2018-05-02 Thread tdsilva
PHOENIX-4601 Perform server-side retries if client version < 4.14


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

Branch: refs/heads/system-catalog
Commit: d7afec21c500ccd7f5334e9c0958c40fcc95df14
Parents: ccd41de
Author: Vincent Poon 
Authored: Thu Apr 19 17:07:56 2018 -0700
Committer: Vincent Poon 
Committed: Fri Apr 20 14:22:43 2018 -0700

--
 .../hbase/index/write/IndexWriterUtils.java | 36 
 .../write/ParallelWriterIndexCommitter.java | 12 +--
 .../TrackingParallelWriterIndexCommitter.java   | 13 ---
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  1 +
 4 files changed, 48 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d7afec21/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
index 76d6800..0d3004f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
@@ -21,6 +21,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.hbase.index.table.HTableFactory;
 import org.apache.phoenix.hbase.index.util.IndexManagementUtil;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -58,15 +59,19 @@ public class IndexWriterUtils {
public static final String INDEX_WRITES_THREAD_MAX_PER_REGIONSERVER_KEY = 
"phoenix.index.writes.threads.max";
public static final String HTABLE_KEEP_ALIVE_KEY = 
"hbase.htable.threads.keepalivetime";
 
+   @Deprecated
public static final String INDEX_WRITER_RPC_RETRIES_NUMBER = 
"phoenix.index.writes.rpc.retries.number";
-/**
- * Retry server-server index write rpc only once, and let the client retry 
the data write
- * instead to avoid typing up the handler
- */
-   // note in HBase 2+, numTries = numRetries + 1
-   // in prior versions, numTries = numRetries
-   public static final int DEFAULT_INDEX_WRITER_RPC_RETRIES_NUMBER = 1;
+   /**
+* Based on the logic in HBase's AsyncProcess, a default of 11 retries with 
a pause of 100ms
+* approximates 48 sec total retry time (factoring in backoffs).  The total 
time should be less
+* than HBase's rpc timeout (default of 60 sec) or else the client will 
retry before receiving
+* the response
+*/
+   @Deprecated
+   public static final int DEFAULT_INDEX_WRITER_RPC_RETRIES_NUMBER = 11;
+   @Deprecated
public static final String INDEX_WRITER_RPC_PAUSE = 
"phoenix.index.writes.rpc.pause";
+   @Deprecated
public static final int DEFAULT_INDEX_WRITER_RPC_PAUSE = 100;
 
   private IndexWriterUtils() {
@@ -76,12 +81,29 @@ public class IndexWriterUtils {
 public static HTableFactory 
getDefaultDelegateHTableFactory(CoprocessorEnvironment env) {
 // create a simple delegate factory, setup the way we need
 Configuration conf = 
PropertiesUtil.cloneConfig(env.getConfiguration());
+setHTableThreads(conf);
+return ServerUtil.getDelegateHTableFactory(env, conf);
+}
+
+private static void setHTableThreads(Configuration conf) {
 // set the number of threads allowed per table.
 int htableThreads =
 
conf.getInt(IndexWriterUtils.INDEX_WRITER_PER_TABLE_THREADS_CONF_KEY,
 IndexWriterUtils.DEFAULT_NUM_PER_TABLE_THREADS);
 LOG.trace("Creating HTableFactory with " + htableThreads + " threads 
for each HTable.");
 IndexManagementUtil.setIfNotSet(conf, HTABLE_THREAD_KEY, 
htableThreads);
+}
+
+/**
+ * Retry server-server index write rpc only once, and let the client retry 
the data write
+ * instead to avoid tying up the handler
+ */
+public static HTableFactory 
getNoRetriesHTableFactory(CoprocessorEnvironment env) {
+Configuration conf = 
PropertiesUtil.cloneConfig(env.getConfiguration());
+setHTableThreads(conf);
+// note in HBase 2+, numTries = numRetries + 1
+// in prior versions, numTries = numRetries
+conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
 return ServerUtil.getDelegateHTableFactory(env, conf);
 }
 


[35/50] [abbrv] phoenix git commit: fix test failures

2018-05-02 Thread tdsilva
fix test failures


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

Branch: refs/heads/system-catalog
Commit: f8ce60c0655f012d01db4a863c0734475b2b2973
Parents: d615dc0
Author: Thomas D'Silva 
Authored: Wed Apr 25 14:45:33 2018 -0700
Committer: Thomas D'Silva 
Committed: Wed Apr 25 14:45:33 2018 -0700

--
 .../query/ConnectionQueryServicesImpl.java  |   9 +-
 .../query/ConnectionlessQueryServicesImpl.java  |   6 +-
 .../apache/phoenix/query/QueryConstants.java| 406 ---
 .../org/apache/phoenix/schema/PTableImpl.java   |   2 +-
 4 files changed, 191 insertions(+), 232 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f8ce60c0/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 c453e13..45016c6 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
@@ -2473,6 +2473,11 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 protected String getLogTableDDL() {
 return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
 }
+
+// Available for testing
+protected String getChildLinkDDL() {
+return 
setSystemDDLProperties(QueryConstants.CREATE_CHILD_LINK_METADATA);
+}
 
 private String setSystemDDLProperties(String ddl) {
 return String.format(ddl,
@@ -2693,7 +2698,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 metaConnection.createStatement().execute(getLogTableDDL());
 } catch (TableAlreadyExistsException ignore) {}
 try {
-
metaConnection.createStatement().executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
+metaConnection.createStatement().executeUpdate(getChildLinkDDL());
 } catch (TableAlreadyExistsException e) {}
 // Catch the IOException to log the error message and then bubble it 
up for the client to retry.
 try {
@@ -3129,7 +3134,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
metaConnection.createStatement().executeUpdate(getLogTableDDL());
 } catch (NewerTableAlreadyExistsException e) {} catch 
(TableAlreadyExistsException e) {}
 try {
-
metaConnection.createStatement().executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
+
metaConnection.createStatement().executeUpdate(getChildLinkDDL());
 } catch (NewerTableAlreadyExistsException e) {} catch 
(TableAlreadyExistsException e) {}
 
 // In case namespace mapping is enabled and system table to system 
namespace mapping is also enabled,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f8ce60c0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index 21f4f74..0fdf5e6 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@ -166,6 +166,10 @@ public class ConnectionlessQueryServicesImpl extends 
DelegateQueryServices imple
 protected String getLogTableDDL() {
 return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
 }
+
+protected String getChildLinkDDL() {
+return 
setSystemDDLProperties(QueryConstants.CREATE_CHILD_LINK_METADATA);
+}
 
 private String setSystemDDLProperties(String ddl) {
 return String.format(ddl,
@@ -367,7 +371,7 @@ public class ConnectionlessQueryServicesImpl extends 
DelegateQueryServices imple
 } catch (NewerTableAlreadyExistsException ignore) {}
 try {
 metaConnection.createStatement()
-
.executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
+.executeUpdate(getChildLinkDDL());
 } catch 

[07/50] [abbrv] phoenix git commit: PHOENIX-4653 Upgrading from namespace enabled cluster to latest version failing with UpgradeInProgressException(Rajeshbabu)

2018-05-02 Thread tdsilva
PHOENIX-4653 Upgrading from namespace enabled cluster to latest version failing 
with UpgradeInProgressException(Rajeshbabu)


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

Branch: refs/heads/system-catalog
Commit: e40d920160ce95e2cbb75642100aa01a1af6fdd9
Parents: d48518b
Author: Rajeshbabu Chintaguntla 
Authored: Wed Apr 11 18:16:45 2018 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Wed Apr 11 18:16:45 2018 +0530

--
 .../apache/phoenix/query/ConnectionQueryServicesImpl.java| 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e40d9201/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 8c7441a..6627a84 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
@@ -2678,13 +2678,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 long currentServerSideTableTimeStamp = 
e.getTable().getTimeStamp();
 sysCatalogTableName = 
e.getTable().getPhysicalName().getString();
 if (currentServerSideTableTimeStamp < 
MIN_SYSTEM_TABLE_TIMESTAMP) {
-// Ensure that the SYSTEM.MUTEX table has been created 
prior
-// to attempting to acquire the upgrade mutex. If namespace
-// mapping is enabled, we've already done this earlier in 
the
-// upgrade, so no need for a bunch of wasted RPCs.
-if (currentServerSideTableTimeStamp <= 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_10_0 &&
-
!SchemaUtil.isNamespaceMappingEnabled(PTableType.SYSTEM,
-
ConnectionQueryServicesImpl.this.getProps())) {
+if (currentServerSideTableTimeStamp <= 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_10_0) {
 try (HBaseAdmin admin = getAdmin()) {
 createSysMutexTableIfNotExists(admin, 
this.getProps());
 }



[39/50] [abbrv] phoenix git commit: PHOENIX-4700 Fix split policy on system tables other than SYSTEM.CATALOG

2018-05-02 Thread tdsilva
PHOENIX-4700 Fix split policy on system tables other than SYSTEM.CATALOG


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

Branch: refs/heads/system-catalog
Commit: 5c637e6dd4aabb9d8afe0e07a81533a96e111bfb
Parents: 8dd637d
Author: James Taylor 
Authored: Mon Apr 23 10:14:36 2018 -0700
Committer: James Taylor 
Committed: Thu Apr 26 09:55:28 2018 -0700

--
 .../apache/phoenix/query/QueryConstants.java| 117 +--
 .../SplitOnLeadingVarCharColumnsPolicy.java |  43 +++
 .../schema/SystemFunctionSplitPolicy.java   |  27 +
 .../phoenix/schema/SystemStatsSplitPolicy.java  |  27 +
 .../phoenix/schema/SystemSplitPolicyTest.java   |  97 +++
 5 files changed, 200 insertions(+), 111 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c637e6d/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index 22fa2f4..4285334 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -18,112 +18,7 @@
 package org.apache.phoenix.query;
 
 
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.APPEND_ONLY_SCHEMA;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARG_POSITION;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARRAY_SIZE;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.AUTO_PARTITION_SEQ;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BASE_COLUMN_COUNT;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BUFFER_LENGTH;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CACHE_SIZE;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CHAR_OCTET_LENGTH;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CLASS_NAME;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_COUNT;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_DEF;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_FAMILY;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_NAME;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_SIZE;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CURRENT_VALUE;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CYCLE_FLAG;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DATA_TABLE_NAME;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DATA_TYPE;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DECIMAL_DIGITS;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODING_SCHEME;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FUNCTION_NAME;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_ROW_COUNT;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POST_KEY;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_ROWS;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_STORAGE_SCHEME;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INCREMENT_BY;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_STATE;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_TYPE;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_ARRAY;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_AUTOINCREMENT;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_CONSTANT;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_NAMESPACE_MAPPED;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_NULLABLE;
-import static 

[46/50] [abbrv] phoenix git commit: PHOENIX-4711 Unable to set property on table with VARBINARY as last column

2018-05-02 Thread tdsilva
PHOENIX-4711 Unable to set property on table with VARBINARY as last column


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

Branch: refs/heads/system-catalog
Commit: a18fd1e133f5a2785e0ade236d72028b3d6854da
Parents: 49c0232
Author: James Taylor 
Authored: Thu Apr 26 17:13:48 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 27 11:41:56 2018 -0700

--
 .../apache/phoenix/end2end/AlterTableIT.java| 12 ++-
 .../apache/phoenix/schema/MetaDataClient.java   | 22 +++-
 2 files changed, 19 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a18fd1e1/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
index dd895dc..b1949ed 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
@@ -116,12 +116,14 @@ public class AlterTableIT extends ParallelStatsDisabledIT 
{
 Connection conn = DriverManager.getConnection(getUrl(), props);
 conn.setAutoCommit(false);
 
-try {
-String ddl = "CREATE TABLE  " + dataTableFullName +
-"  (a_string varchar not null, a_binary varbinary not 
null, col1 integer" +
-"  CONSTRAINT pk PRIMARY KEY (a_string, a_binary)) " + 
tableDDLOptions;
-createTestTable(getUrl(), ddl);
+String ddl = "CREATE TABLE  " + dataTableFullName +
+"  (a_string varchar not null, a_binary varbinary not null, 
col1 integer" +
+"  CONSTRAINT pk PRIMARY KEY (a_string, a_binary)) " + 
tableDDLOptions;
+createTestTable(getUrl(), ddl);
+
+conn.createStatement().execute("ALTER TABLE " + dataTableFullName + " 
SET DISABLE_WAL = true");
 
+try {
 ddl = "ALTER TABLE " + dataTableFullName + " ADD b_string VARCHAR 
NULL PRIMARY KEY";
 PreparedStatement stmt = conn.prepareStatement(ddl);
 stmt.execute();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a18fd1e1/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index b15072a..a3d2baf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -3259,16 +3259,18 @@ public class MetaDataClient {
 int position = table.getColumns().size();
 
 List currentPKs = table.getPKColumns();
-PColumn lastPK = currentPKs.get(currentPKs.size()-1);
-// Disallow adding columns if the last column is VARBIANRY.
-if (lastPK.getDataType() == PVarbinary.INSTANCE || 
lastPK.getDataType().isArrayType()) {
-throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.VARBINARY_LAST_PK)
-
.setColumnName(lastPK.getName().getString()).build().buildException();
-}
-// Disallow adding columns if last column is fixed width and 
nullable.
-if (lastPK.isNullable() && 
lastPK.getDataType().isFixedWidth()) {
-throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.NULLABLE_FIXED_WIDTH_LAST_PK)
-
.setColumnName(lastPK.getName().getString()).build().buildException();
+if (numCols > 0) {
+PColumn lastPK = currentPKs.get(currentPKs.size()-1);
+// Disallow adding columns if the last column is VARBIANRY.
+if (lastPK.getDataType() == PVarbinary.INSTANCE || 
lastPK.getDataType().isArrayType()) {
+throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.VARBINARY_LAST_PK)
+
.setColumnName(lastPK.getName().getString()).build().buildException();
+}
+// Disallow adding columns if last column is fixed width 
and nullable.
+if (lastPK.isNullable() && 
lastPK.getDataType().isFixedWidth()) {
+throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.NULLABLE_FIXED_WIDTH_LAST_PK)
+ 

[42/50] [abbrv] phoenix git commit: PHOENIX-4707 Include python driver in assembly

2018-05-02 Thread tdsilva
PHOENIX-4707 Include python driver in assembly


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

Branch: refs/heads/system-catalog
Commit: 4b84199681f241843855ce652e582e06bb99c1cf
Parents: ff32734
Author: Josh Elser 
Authored: Thu Apr 26 10:00:16 2018 -0400
Committer: Josh Elser 
Committed: Thu Apr 26 15:25:47 2018 -0400

--
 phoenix-assembly/src/build/components/all-common-files.xml | 5 +
 phoenix-assembly/src/build/src.xml | 7 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4b841996/phoenix-assembly/src/build/components/all-common-files.xml
--
diff --git a/phoenix-assembly/src/build/components/all-common-files.xml 
b/phoenix-assembly/src/build/components/all-common-files.xml
index af7888d..a17a138 100644
--- a/phoenix-assembly/src/build/components/all-common-files.xml
+++ b/phoenix-assembly/src/build/components/all-common-files.xml
@@ -86,5 +86,10 @@
   0644
   0755
   
+
+  ${project.basedir}/../python
+  0644
+  0755
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4b841996/phoenix-assembly/src/build/src.xml
--
diff --git a/phoenix-assembly/src/build/src.xml 
b/phoenix-assembly/src/build/src.xml
index 5dc92a8..cfa73d6 100644
--- a/phoenix-assembly/src/build/src.xml
+++ b/phoenix-assembly/src/build/src.xml
@@ -112,11 +112,16 @@
   0644
   0755
 
-  
+
   ${project.basedir}/../examples
   0644
   0755
 
+
+  ${project.basedir}/../python
+  0644
+  0755
+
   
 
 



[47/50] [abbrv] phoenix git commit: PHOENIX-4709 Alter split policy in upgrade path for system tables

2018-05-02 Thread tdsilva
PHOENIX-4709 Alter split policy in upgrade path for system tables


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

Branch: refs/heads/system-catalog
Commit: fc194c568ee5a4a7ba0e92b64ae24f7cf4b224e5
Parents: a18fd1e
Author: James Taylor 
Authored: Thu Apr 26 13:38:05 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 27 11:41:56 2018 -0700

--
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |   1 +
 .../query/ConnectionQueryServicesImpl.java  |  17 +++
 .../apache/phoenix/query/QueryConstants.java| 109 ++-
 3 files changed, 124 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc194c56/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 d56628a..320c6e7 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
@@ -217,6 +217,7 @@ public class PhoenixDatabaseMetaData implements 
DatabaseMetaData {
 
 public static final String TYPE_SEQUENCE = "SEQUENCE";
 public static final String SYSTEM_FUNCTION_TABLE = "FUNCTION";
+public static final String SYSTEM_FUNCTION = SYSTEM_CATALOG_SCHEMA + 
QueryConstants.NAME_SEPARATOR + "\"FUNCTION\"";
 public static final String SYSTEM_FUNCTION_NAME = 
SchemaUtil.getTableName(SYSTEM_CATALOG_SCHEMA, SYSTEM_FUNCTION_TABLE);
 public static final byte[] SYSTEM_FUNCTION_NAME_BYTES = 
Bytes.toBytes(SYSTEM_FUNCTION_NAME);
 public static final TableName SYSTEM_FUNCTION_HBASE_TABLE_NAME = 
TableName.valueOf(SYSTEM_FUNCTION_NAME);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fc194c56/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 d841f0b..1d3feed 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
@@ -214,6 +214,8 @@ import org.apache.phoenix.schema.Sequence;
 import org.apache.phoenix.schema.SequenceAllocation;
 import org.apache.phoenix.schema.SequenceKey;
 import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.schema.SystemFunctionSplitPolicy;
+import org.apache.phoenix.schema.SystemStatsSplitPolicy;
 import org.apache.phoenix.schema.TableAlreadyExistsException;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.schema.TableProperty;
@@ -2949,6 +2951,21 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
   MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_14_0,
   PhoenixDatabaseMetaData.TRANSACTION_PROVIDER + " "
 + PTinyint.INSTANCE.getSqlTypeName());
+metaConnection.createStatement().executeUpdate("ALTER TABLE " + 
+PhoenixDatabaseMetaData.SYSTEM_CATALOG + " SET " + 
+HConstants.VERSIONS + "= " + 
props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS) + ",\n" +
+HColumnDescriptor.KEEP_DELETED_CELLS + "=" + 
props.getBoolean(DEFAULT_SYSTEM_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_KEEP_DELETED_CELLS)
+);
+metaConnection.createStatement().executeUpdate("ALTER TABLE " + 
+PhoenixDatabaseMetaData.SYSTEM_FUNCTION + " SET " + 
+HTableDescriptor.SPLIT_POLICY + "='" + 
SystemFunctionSplitPolicy.class.getName() + "',\n" +
+HConstants.VERSIONS + "= " + 
props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS) + ",\n" +
+HColumnDescriptor.KEEP_DELETED_CELLS + "=" + 
props.getBoolean(DEFAULT_SYSTEM_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_KEEP_DELETED_CELLS)
+);
+metaConnection.createStatement().executeUpdate("ALTER TABLE " + 
+PhoenixDatabaseMetaData.SYSTEM_STATS_NAME + " SET " + 
+ 

[06/50] [abbrv] phoenix git commit: PHOENIX-2715 Query Log (addendum) Fix old com.lmax.disruptor dependency

2018-05-02 Thread tdsilva
PHOENIX-2715 Query Log (addendum)
Fix old com.lmax.disruptor dependency


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

Branch: refs/heads/system-catalog
Commit: d48518bc2ddea3f4c6cd9ef5a6c2504b65255da2
Parents: 2e6dc81
Author: Ankit Singhal 
Authored: Wed Apr 11 17:36:03 2018 +0530
Committer: Ankit Singhal 
Committed: Wed Apr 11 17:36:03 2018 +0530

--
 phoenix-core/pom.xml  | 7 ---
 phoenix-flume/pom.xml | 6 --
 phoenix-kafka/pom.xml | 6 --
 3 files changed, 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d48518bc/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 76ca9c9..9e9a15b 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -345,12 +345,6 @@
   test
 
 
-  com.lmax
-  disruptor
-  3.2.0
-  test
-
-
   org.apache.htrace
   htrace-core
 
@@ -483,7 +477,6 @@

 com.lmax
 disruptor
-${disruptor.version}
   
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d48518bc/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index 357bc2d..3780d8d 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -69,12 +69,6 @@
   test
 
 
-  com.lmax
-  disruptor
-  3.2.0
-  test
-
-
   org.apache.htrace
   htrace-core
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d48518bc/phoenix-kafka/pom.xml
--
diff --git a/phoenix-kafka/pom.xml b/phoenix-kafka/pom.xml
index bdcaef4..09547c5 100644
--- a/phoenix-kafka/pom.xml
+++ b/phoenix-kafka/pom.xml
@@ -143,12 +143,6 @@
test


-   com.lmax
-   disruptor
-   3.2.0
-   test
-   
-   
org.apache.htrace
htrace-core




[09/50] [abbrv] phoenix git commit: PHOENIX-4366 Rebuilding a local index fails sometimes

2018-05-02 Thread tdsilva
PHOENIX-4366 Rebuilding a local index fails sometimes


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

Branch: refs/heads/system-catalog
Commit: 5a16bff9f9eb9b97da5a3336cbf009b61d4deb2f
Parents: 1a312a9
Author: James Taylor 
Authored: Wed Apr 11 13:37:45 2018 -0700
Committer: James Taylor 
Committed: Wed Apr 11 13:40:37 2018 -0700

--
 .../coprocessor/BaseScannerRegionObserver.java  |  7 +
 .../GroupedAggregateRegionObserver.java |  4 +++
 .../phoenix/coprocessor/ScanRegionObserver.java |  4 ++-
 .../UngroupedAggregateRegionObserver.java   |  7 -
 .../NonAggregateRegionScannerFactory.java   | 29 +---
 .../phoenix/iterate/RegionScannerFactory.java   |  4 +--
 .../apache/phoenix/iterate/SnapshotScanner.java |  6 +---
 7 files changed, 30 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5a16bff9/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
index 4a2c465..110a4ed 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
@@ -140,8 +140,6 @@ abstract public class BaseScannerRegionObserver extends 
BaseRegionObserver {
 
 /** Exposed for testing */
 public static final String SCANNER_OPENED_TRACE_INFO = "Scanner opened on 
server";
-protected QualifierEncodingScheme encodingScheme;
-protected boolean useNewValueColumnQualifier;
 
 @Override
 public void start(CoprocessorEnvironment e) throws IOException {
@@ -212,8 +210,6 @@ abstract public class BaseScannerRegionObserver extends 
BaseRegionObserver {
 // start exclusive and the stop inclusive.
 ScanUtil.setupReverseScan(scan);
 }
-this.encodingScheme = 
EncodedColumnsUtil.getQualifierEncodingScheme(scan);
-this.useNewValueColumnQualifier = 
EncodedColumnsUtil.useNewValueColumnQualifier(scan);
 return s;
 }
 
@@ -351,8 +347,7 @@ abstract public class BaseScannerRegionObserver extends 
BaseRegionObserver {
 final byte[][] viewConstants, final TupleProjector projector,
 final ImmutableBytesWritable ptr, final boolean 
useQualiferAsListIndex) {
 
-RegionScannerFactory regionScannerFactory = new 
NonAggregateRegionScannerFactory(c.getEnvironment(),
-useNewValueColumnQualifier, encodingScheme);
+RegionScannerFactory regionScannerFactory = new 
NonAggregateRegionScannerFactory(c.getEnvironment());
 
 return regionScannerFactory.getWrappedScanner(c.getEnvironment(), s, 
null, null, offset, scan, dataColumns, tupleProjector,
 dataRegion, indexMaintainer, null, viewConstants, null, null, 
projector, ptr, useQualiferAsListIndex);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5a16bff9/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
index 67cc114..201bcec 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
@@ -62,6 +62,7 @@ import org.apache.phoenix.index.IndexMaintainer;
 import org.apache.phoenix.join.HashJoinInfo;
 import org.apache.phoenix.memory.MemoryManager.MemoryChunk;
 import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList;
 import org.apache.phoenix.schema.tuple.MultiKeyValueTuple;
@@ -110,6 +111,7 @@ public class GroupedAggregateRegionObserver extends 
BaseScannerRegionObserver {
 keyOrdered = true;
 }
 int offset = 0;
+boolean useNewValueColumnQualifier = 
EncodedColumnsUtil.useNewValueColumnQualifier(scan);
 if (ScanUtil.isLocalIndex(scan)) {
 /*
  * For local indexes, we need to set an offset 

[17/50] [abbrv] phoenix git commit: Revert "PHOENIX-4496 Fix RowValueConstructorIT and IndexMetadataIT"

2018-05-02 Thread tdsilva
Revert "PHOENIX-4496 Fix RowValueConstructorIT and IndexMetadataIT"

This reverts commit 70c9c6bb2d2073bb40640a0a794032b166c4b63b.


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

Branch: refs/heads/system-catalog
Commit: 7b2c7e135916d5a6087ec3e6c4b6c261779795ac
Parents: 70c9c6b
Author: James Taylor 
Authored: Fri Apr 13 10:10:07 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 10:10:07 2018 -0700

--
 .../phoenix/hbase/index/scanner/ScannerBuilder.java   | 10 --
 1 file changed, 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b2c7e13/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
index 4c42fe4..ad09c0c 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/scanner/ScannerBuilder.java
@@ -31,7 +31,6 @@ import org.apache.hadoop.hbase.filter.BinaryComparator;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.filter.FamilyFilter;
 import org.apache.hadoop.hbase.filter.Filter;
-import org.apache.hadoop.hbase.filter.FilterBase;
 import org.apache.hadoop.hbase.filter.FilterList;
 import org.apache.hadoop.hbase.filter.QualifierFilter;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -99,15 +98,6 @@ public class ScannerBuilder {
   }
   columnFilters.addFilter(columnFilter);
 }
-
-if(columns.isEmpty()){
-columnFilters.addFilter(new FilterBase(){
-@Override
-public boolean filterAllRemaining() throws IOException {
-return true;
-}
-});
-}
 return columnFilters;
   }
 



phoenix git commit: PHOENIX-4712 When creating an index on a table, meta data cache of views related to the table isn't updated

2018-05-01 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master de87cf50a -> 40ff0b95e


PHOENIX-4712 When creating an index on a table, meta data cache of views 
related to the table isn't updated


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

Branch: refs/heads/master
Commit: 40ff0b95e6d994e8dcf7a49a98bdc5a1bad2ef82
Parents: de87cf5
Author: Thomas D'Silva 
Authored: Tue May 1 13:32:45 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue May 1 21:20:59 2018 -0700

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 46 
 .../apache/phoenix/schema/MetaDataClient.java   | 11 +++--
 2 files changed, 53 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/40ff0b95/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 5c0d100..279bbd7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -33,6 +33,7 @@ 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;
 
@@ -894,6 +895,51 @@ public class ViewIT extends BaseViewIT {
 }
 }
 
+@Test
+public void testQueryWithSeparateConnectionForViewOnTableThatHasIndex() 
throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection conn2 = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement();
+Statement s2 = conn2.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s2, tableName, 
viewName, indexName);
+}
+}
+
+@Test
+public void testQueryForViewOnTableThatHasIndex() throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s, tableName, viewName, 
indexName);
+}
+}
+
+private void helpTestQueryForViewOnTableThatHasIndex(Statement s1, 
Statement s2, String tableName, String viewName, String indexName)
+throws SQLException {
+// Create a table
+s1.execute("create table " + tableName + " (col1 varchar primary key, 
col2 varchar)");
+
+// Create a view on the table
+s1.execute("create view " + viewName + " (col3 varchar) as select * 
from " + tableName);
+s1.executeQuery("select * from " + viewName);
+// Create a index on the table
+s1.execute("create index " + indexName + " ON " + tableName + " 
(col2)");
+
+try (ResultSet rs =
+s2.executeQuery("explain select /*+ INDEX(" + viewName + " " + 
indexName
++ ") */ * from " + viewName + " where col2 = 'aaa'")) {
+String explainPlan = QueryUtil.getExplainPlan(rs);
+
+// check if the query uses the index
+assertTrue(explainPlan.contains(indexName));
+}
+}
+
 private void validate(String viewName, Connection tenantConn, String[] 
whereClauseArray,
 long[] expectedArray) throws SQLException {
 for (int i = 0; i < whereClauseArray.length; ++i) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/40ff0b95/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 69d8a56..009289b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -682,7 +682,7 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in indexes to add to 

phoenix git commit: PHOENIX-4712 When creating an index on a table, meta data cache of views related to the table isn't updated

2018-05-01 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 87564a864 -> 6db0cb04d


PHOENIX-4712 When creating an index on a table, meta data cache of views 
related to the table isn't updated


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 6db0cb04df9633812365a6280a07a0a7a3caba6d
Parents: 87564a8
Author: Thomas D'Silva 
Authored: Tue May 1 13:32:45 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue May 1 21:20:49 2018 -0700

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 46 
 .../apache/phoenix/schema/MetaDataClient.java   | 11 +++--
 2 files changed, 53 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6db0cb04/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 4b64a09..e277c18 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -33,6 +33,7 @@ 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;
 
@@ -894,6 +895,51 @@ public class ViewIT extends BaseViewIT {
 }
 }
 
+@Test
+public void testQueryWithSeparateConnectionForViewOnTableThatHasIndex() 
throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection conn2 = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement();
+Statement s2 = conn2.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s2, tableName, 
viewName, indexName);
+}
+}
+
+@Test
+public void testQueryForViewOnTableThatHasIndex() throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s, tableName, viewName, 
indexName);
+}
+}
+
+private void helpTestQueryForViewOnTableThatHasIndex(Statement s1, 
Statement s2, String tableName, String viewName, String indexName)
+throws SQLException {
+// Create a table
+s1.execute("create table " + tableName + " (col1 varchar primary key, 
col2 varchar)");
+
+// Create a view on the table
+s1.execute("create view " + viewName + " (col3 varchar) as select * 
from " + tableName);
+s1.executeQuery("select * from " + viewName);
+// Create a index on the table
+s1.execute("create index " + indexName + " ON " + tableName + " 
(col2)");
+
+try (ResultSet rs =
+s2.executeQuery("explain select /*+ INDEX(" + viewName + " " + 
indexName
++ ") */ * from " + viewName + " where col2 = 'aaa'")) {
+String explainPlan = QueryUtil.getExplainPlan(rs);
+
+// check if the query uses the index
+assertTrue(explainPlan.contains(indexName));
+}
+}
+
 private void validate(String viewName, Connection tenantConn, String[] 
whereClauseArray,
 long[] expectedArray) throws SQLException {
 for (int i = 0; i < whereClauseArray.length; ++i) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6db0cb04/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 2333acc..4997af9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -684,7 +684,7 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in 

phoenix git commit: PHOENIX-4712 When creating an index on a table, meta data cache of views related to the table isn't updated

2018-05-01 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 882c059eb -> 5b7b104ed


PHOENIX-4712 When creating an index on a table, meta data cache of views 
related to the table isn't updated


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 5b7b104ed74ae7f4ef39cafc883e1da00e431503
Parents: 882c059
Author: Thomas D'Silva 
Authored: Tue May 1 13:32:45 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue May 1 21:19:28 2018 -0700

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 46 
 .../apache/phoenix/schema/MetaDataClient.java   | 11 +++--
 2 files changed, 53 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5b7b104e/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 5c0d100..279bbd7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -33,6 +33,7 @@ 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;
 
@@ -894,6 +895,51 @@ public class ViewIT extends BaseViewIT {
 }
 }
 
+@Test
+public void testQueryWithSeparateConnectionForViewOnTableThatHasIndex() 
throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection conn2 = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement();
+Statement s2 = conn2.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s2, tableName, 
viewName, indexName);
+}
+}
+
+@Test
+public void testQueryForViewOnTableThatHasIndex() throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s, tableName, viewName, 
indexName);
+}
+}
+
+private void helpTestQueryForViewOnTableThatHasIndex(Statement s1, 
Statement s2, String tableName, String viewName, String indexName)
+throws SQLException {
+// Create a table
+s1.execute("create table " + tableName + " (col1 varchar primary key, 
col2 varchar)");
+
+// Create a view on the table
+s1.execute("create view " + viewName + " (col3 varchar) as select * 
from " + tableName);
+s1.executeQuery("select * from " + viewName);
+// Create a index on the table
+s1.execute("create index " + indexName + " ON " + tableName + " 
(col2)");
+
+try (ResultSet rs =
+s2.executeQuery("explain select /*+ INDEX(" + viewName + " " + 
indexName
++ ") */ * from " + viewName + " where col2 = 'aaa'")) {
+String explainPlan = QueryUtil.getExplainPlan(rs);
+
+// check if the query uses the index
+assertTrue(explainPlan.contains(indexName));
+}
+}
+
 private void validate(String viewName, Connection tenantConn, String[] 
whereClauseArray,
 long[] expectedArray) throws SQLException {
 for (int i = 0; i < whereClauseArray.length; ++i) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5b7b104e/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 372371b..e69dac7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -677,7 +677,7 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in 

phoenix git commit: PHOENIX-4712 When creating an index on a table, meta data cache of views related to the table isn't updated

2018-05-01 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 cfac2daac -> e546e38f1


PHOENIX-4712 When creating an index on a table, meta data cache of views 
related to the table isn't updated


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

Branch: refs/heads/4.x-HBase-1.2
Commit: e546e38f13401a17ab287323cf72fba821a97683
Parents: cfac2da
Author: Thomas D'Silva 
Authored: Tue May 1 13:32:45 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue May 1 21:19:47 2018 -0700

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 46 
 .../apache/phoenix/schema/MetaDataClient.java   | 11 +++--
 2 files changed, 53 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e546e38f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 5c0d100..279bbd7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -33,6 +33,7 @@ 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;
 
@@ -894,6 +895,51 @@ public class ViewIT extends BaseViewIT {
 }
 }
 
+@Test
+public void testQueryWithSeparateConnectionForViewOnTableThatHasIndex() 
throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection conn2 = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement();
+Statement s2 = conn2.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s2, tableName, 
viewName, indexName);
+}
+}
+
+@Test
+public void testQueryForViewOnTableThatHasIndex() throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s, tableName, viewName, 
indexName);
+}
+}
+
+private void helpTestQueryForViewOnTableThatHasIndex(Statement s1, 
Statement s2, String tableName, String viewName, String indexName)
+throws SQLException {
+// Create a table
+s1.execute("create table " + tableName + " (col1 varchar primary key, 
col2 varchar)");
+
+// Create a view on the table
+s1.execute("create view " + viewName + " (col3 varchar) as select * 
from " + tableName);
+s1.executeQuery("select * from " + viewName);
+// Create a index on the table
+s1.execute("create index " + indexName + " ON " + tableName + " 
(col2)");
+
+try (ResultSet rs =
+s2.executeQuery("explain select /*+ INDEX(" + viewName + " " + 
indexName
++ ") */ * from " + viewName + " where col2 = 'aaa'")) {
+String explainPlan = QueryUtil.getExplainPlan(rs);
+
+// check if the query uses the index
+assertTrue(explainPlan.contains(indexName));
+}
+}
+
 private void validate(String viewName, Connection tenantConn, String[] 
whereClauseArray,
 long[] expectedArray) throws SQLException {
 for (int i = 0; i < whereClauseArray.length; ++i) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e546e38f/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 69d8a56..009289b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -682,7 +682,7 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in 

phoenix git commit: PHOENIX-4712 When creating an index on a table, meta data cache of views related to the table isn't updated

2018-05-01 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 5c5153557 -> ab5200afe


PHOENIX-4712 When creating an index on a table, meta data cache of views 
related to the table isn't updated


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

Branch: refs/heads/4.x-HBase-1.3
Commit: ab5200afee0f99cbec2f69b7cec0c2643bb41fdd
Parents: 5c51535
Author: Thomas D'Silva 
Authored: Tue May 1 13:32:45 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue May 1 21:19:06 2018 -0700

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 46 
 .../apache/phoenix/schema/MetaDataClient.java   | 11 +++--
 2 files changed, 53 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ab5200af/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 5c0d100..279bbd7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -33,6 +33,7 @@ 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;
 
@@ -894,6 +895,51 @@ public class ViewIT extends BaseViewIT {
 }
 }
 
+@Test
+public void testQueryWithSeparateConnectionForViewOnTableThatHasIndex() 
throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection conn2 = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement();
+Statement s2 = conn2.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s2, tableName, 
viewName, indexName);
+}
+}
+
+@Test
+public void testQueryForViewOnTableThatHasIndex() throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s, tableName, viewName, 
indexName);
+}
+}
+
+private void helpTestQueryForViewOnTableThatHasIndex(Statement s1, 
Statement s2, String tableName, String viewName, String indexName)
+throws SQLException {
+// Create a table
+s1.execute("create table " + tableName + " (col1 varchar primary key, 
col2 varchar)");
+
+// Create a view on the table
+s1.execute("create view " + viewName + " (col3 varchar) as select * 
from " + tableName);
+s1.executeQuery("select * from " + viewName);
+// Create a index on the table
+s1.execute("create index " + indexName + " ON " + tableName + " 
(col2)");
+
+try (ResultSet rs =
+s2.executeQuery("explain select /*+ INDEX(" + viewName + " " + 
indexName
++ ") */ * from " + viewName + " where col2 = 'aaa'")) {
+String explainPlan = QueryUtil.getExplainPlan(rs);
+
+// check if the query uses the index
+assertTrue(explainPlan.contains(indexName));
+}
+}
+
 private void validate(String viewName, Connection tenantConn, String[] 
whereClauseArray,
 long[] expectedArray) throws SQLException {
 for (int i = 0; i < whereClauseArray.length; ++i) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ab5200af/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 69d8a56..009289b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -682,7 +682,7 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in 

phoenix git commit: PHOENIX-4712 When creating an index on a table, meta data cache of views related to the table isn't updated

2018-05-01 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 6e25a5f74 -> d5921d9fe


PHOENIX-4712 When creating an index on a table, meta data cache of views 
related to the table isn't updated


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

Branch: refs/heads/4.x-HBase-1.1
Commit: d5921d9fe90d60a24e9d7385e2d987ec80f8a8f7
Parents: 6e25a5f
Author: Thomas D'Silva 
Authored: Tue May 1 13:32:45 2018 -0700
Committer: Thomas D'Silva 
Committed: Tue May 1 21:19:37 2018 -0700

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 46 
 .../apache/phoenix/schema/MetaDataClient.java   | 11 +++--
 2 files changed, 53 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5921d9f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 5c0d100..279bbd7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -33,6 +33,7 @@ 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;
 
@@ -894,6 +895,51 @@ public class ViewIT extends BaseViewIT {
 }
 }
 
+@Test
+public void testQueryWithSeparateConnectionForViewOnTableThatHasIndex() 
throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection conn2 = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement();
+Statement s2 = conn2.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s2, tableName, 
viewName, indexName);
+}
+}
+
+@Test
+public void testQueryForViewOnTableThatHasIndex() throws SQLException {
+try (Connection conn = DriverManager.getConnection(getUrl());
+Statement s = conn.createStatement()) {
+String tableName = generateUniqueName();
+String viewName = generateUniqueName();
+String indexName = generateUniqueName();
+helpTestQueryForViewOnTableThatHasIndex(s, s, tableName, viewName, 
indexName);
+}
+}
+
+private void helpTestQueryForViewOnTableThatHasIndex(Statement s1, 
Statement s2, String tableName, String viewName, String indexName)
+throws SQLException {
+// Create a table
+s1.execute("create table " + tableName + " (col1 varchar primary key, 
col2 varchar)");
+
+// Create a view on the table
+s1.execute("create view " + viewName + " (col3 varchar) as select * 
from " + tableName);
+s1.executeQuery("select * from " + viewName);
+// Create a index on the table
+s1.execute("create index " + indexName + " ON " + tableName + " 
(col2)");
+
+try (ResultSet rs =
+s2.executeQuery("explain select /*+ INDEX(" + viewName + " " + 
indexName
++ ") */ * from " + viewName + " where col2 = 'aaa'")) {
+String explainPlan = QueryUtil.getExplainPlan(rs);
+
+// check if the query uses the index
+assertTrue(explainPlan.contains(indexName));
+}
+}
+
 private void validate(String viewName, Connection tenantConn, String[] 
whereClauseArray,
 long[] expectedArray) throws SQLException {
 for (int i = 0; i < whereClauseArray.length; ++i) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5921d9f/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 7fecaad..c80b64a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -676,7 +676,7 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in 

phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master 74228aee7 -> 1099a0a1d


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/master
Commit: 1099a0a1d8d6e8f7cb116d2724b61a489fc1264c
Parents: 74228ae
Author: Thomas D'Silva 
Authored: Thu Mar 15 13:18:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:18:48 2018 -0700

--
 .../regionserver/IndexHalfStoreFileReaderGenerator.java | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1099a0a1/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 67564cd..21a075c 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -210,6 +210,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;
@@ -227,6 +230,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 newScanners.add(((StoreFileScanner) scanner));
 }
 }
+if (s!=null) {
+s.close();
+}
 return new StoreScanner(store, store.getScanInfo(), scan, newScanners,
 scanType, store.getSmallestReadPoint(), earliestPutTs);
 }
@@ -311,6 +317,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 && store.hasReferences()) {
 final long readPt = 
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel
 ());
+if (s!=null) {
+s.close();
+}
 if (!scan.isReversed()) {
 return new StoreScanner(store, store.getScanInfo(), scan,
 targetCols, readPt) {



phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 4c379d764 -> dc7e377d4


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/5.x-HBase-2.0
Commit: dc7e377d4f79b88c2371abf8385a56378667960f
Parents: 4c379d7
Author: Thomas D'Silva 
Authored: Fri Mar 16 14:16:05 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:16:05 2018 -0700

--
 .../hbase/regionserver/IndexHalfStoreFileReaderGenerator.java   | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dc7e377d/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 3a70f66..5241885 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -30,13 +30,13 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.CompareOperator;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValueUtil;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
@@ -204,6 +204,9 @@ public class IndexHalfStoreFileReaderGenerator implements 
RegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;



phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 1f0416616 -> cc23187fb


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: cc23187fb305fefdcba55efb75c1eed5bc72c49b
Parents: 1f04166
Author: Thomas D'Silva 
Authored: Thu Mar 15 13:18:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:21:05 2018 -0700

--
 .../regionserver/IndexHalfStoreFileReaderGenerator.java | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc23187f/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 88154a7..140b0ba 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -210,6 +210,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;
@@ -227,6 +230,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 newScanners.add(((StoreFileScanner) scanner));
 }
 }
+if (s!=null) {
+s.close();
+}
 return new StoreScanner(store, store.getScanInfo(), scan, newScanners,
 scanType, store.getSmallestReadPoint(), earliestPutTs);
 }
@@ -311,6 +317,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 && store.hasReferences()) {
 final long readPt = 
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel
 ());
+if (s!=null) {
+s.close();
+}
 if (!scan.isReversed()) {
 return new StoreScanner(store, store.getScanInfo(), scan,
 targetCols, readPt) {



phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 be634b576 -> 9f3bbd97a


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 9f3bbd97aca97b10bfa5e898d2721b645496e365
Parents: be634b5
Author: Thomas D'Silva 
Authored: Thu Mar 15 13:18:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:22:06 2018 -0700

--
 .../regionserver/IndexHalfStoreFileReaderGenerator.java | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9f3bbd97/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 88154a7..140b0ba 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -210,6 +210,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;
@@ -227,6 +230,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 newScanners.add(((StoreFileScanner) scanner));
 }
 }
+if (s!=null) {
+s.close();
+}
 return new StoreScanner(store, store.getScanInfo(), scan, newScanners,
 scanType, store.getSmallestReadPoint(), earliestPutTs);
 }
@@ -311,6 +317,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 && store.hasReferences()) {
 final long readPt = 
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel
 ());
+if (s!=null) {
+s.close();
+}
 if (!scan.isReversed()) {
 return new StoreScanner(store, store.getScanInfo(), scan,
 targetCols, readPt) {



phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 ae3618ff8 -> af4b81768


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/4.x-HBase-1.3
Commit: af4b81768fed870573b51740c21cdf868d185ab2
Parents: ae3618f
Author: Thomas D'Silva 
Authored: Thu Mar 15 13:18:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:21:30 2018 -0700

--
 .../regionserver/IndexHalfStoreFileReaderGenerator.java | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/af4b8176/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 88154a7..140b0ba 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -210,6 +210,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;
@@ -227,6 +230,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 newScanners.add(((StoreFileScanner) scanner));
 }
 }
+if (s!=null) {
+s.close();
+}
 return new StoreScanner(store, store.getScanInfo(), scan, newScanners,
 scanType, store.getSmallestReadPoint(), earliestPutTs);
 }
@@ -311,6 +317,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 && store.hasReferences()) {
 final long readPt = 
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel
 ());
+if (s!=null) {
+s.close();
+}
 if (!scan.isReversed()) {
 return new StoreScanner(store, store.getScanInfo(), scan,
 targetCols, readPt) {



phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 0d01a3cdd -> eba095001


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/4.x-HBase-1.1
Commit: eba095001c0422534194028e7fb970419cb4361c
Parents: 0d01a3c
Author: Thomas D'Silva 
Authored: Thu Mar 15 13:18:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:22:22 2018 -0700

--
 .../regionserver/IndexHalfStoreFileReaderGenerator.java | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/eba09500/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 88154a7..140b0ba 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -210,6 +210,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;
@@ -227,6 +230,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 newScanners.add(((StoreFileScanner) scanner));
 }
 }
+if (s!=null) {
+s.close();
+}
 return new StoreScanner(store, store.getScanInfo(), scan, newScanners,
 scanType, store.getSmallestReadPoint(), earliestPutTs);
 }
@@ -311,6 +317,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 && store.hasReferences()) {
 final long readPt = 
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel
 ());
+if (s!=null) {
+s.close();
+}
 if (!scan.isReversed()) {
 return new StoreScanner(store, store.getScanInfo(), scan,
 targetCols, readPt) {



phoenix git commit: PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not close the passed in KeyValueScanner while creating and returning a new scanner

2018-03-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 ade93c9d5 -> d92434365


PHOENIX-4505 IndexHalfStoreFileReaderGenerator.preStoreScannerOpen does not 
close the passed in KeyValueScanner while creating and returning a new scanner


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

Branch: refs/heads/4.x-HBase-0.98
Commit: d92434365cd228eb825330256cb148aecd29bfaf
Parents: ade93c9
Author: Thomas D'Silva 
Authored: Thu Mar 15 13:18:24 2018 -0700
Committer: Thomas D'Silva 
Committed: Fri Mar 16 14:22:53 2018 -0700

--
 .../regionserver/IndexHalfStoreFileReaderGenerator.java | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d9243436/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index ffe2e5e..ac90f88 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -209,6 +209,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 }
 }
 if (repairScanner != null) {
+if (s!=null) {
+s.close();
+}
 return repairScanner;
 } else {
 return s;
@@ -226,6 +229,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 newScanners.add(((StoreFileScanner) scanner));
 }
 }
+if (s!=null) {
+s.close();
+}
 return new StoreScanner(store, store.getScanInfo(), scan, newScanners,
 scanType, store.getSmallestReadPoint(), earliestPutTs);
 }
@@ -310,6 +316,9 @@ public class IndexHalfStoreFileReaderGenerator extends 
BaseRegionObserver {
 && store.hasReferences()) {
 final long readPt = 
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel
 ());
+if (s!=null) {
+s.close();
+}
 if (!scan.isReversed()) {
 return new StoreScanner(store, store.getScanInfo(), scan,
 targetCols, readPt) {



phoenix git commit: PHOENIX-4634 Looking up a parent index table of a tenant child view fails in BaseColumnResolver createTableRef()

2018-03-13 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 31dad52c0 -> f81cce37e


PHOENIX-4634 Looking up a parent index table of a tenant child view fails in 
BaseColumnResolver createTableRef()


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

Branch: refs/heads/4.x-HBase-1.3
Commit: f81cce37eb431be16f83dd356941d85a23cd02de
Parents: 31dad52
Author: Thomas D'Silva 
Authored: Tue Mar 6 11:14:47 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Mar 13 10:39:10 2018 -0700

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java |   2 +-
 .../index/ChildViewsUseParentViewIndexIT.java   |  10 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 159 ---
 .../org/apache/phoenix/util/PhoenixRuntime.java |  24 +--
 4 files changed, 115 insertions(+), 80 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f81cce37/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 407e9cf..c93d2aa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -159,7 +159,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 stmt.executeQuery(sql);
 PTable indexTable = stmt.getQueryPlan().getTableRef().getTable();
 String tableName = indexTable.getName().getString();
-String expectedTableName = baseTableIndexName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + viewName;
+String expectedTableName = viewName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + baseTableIndexName;
 assertEquals("Parent Index table is not used ", expectedTableName, 
tableName);
 
 // verify that we can look up the index using PhoenixRuntime from 
a different client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f81cce37/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
index 1e60bf1..6c8f9e8 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
@@ -37,11 +37,11 @@ public class ChildViewsUseParentViewIndexIT extends 
ParallelStatsDisabledIT {
 
 @Test
 public void testIndexOnParentViewWithTenantSpecificConnection() throws 
Exception {
-final String baseTableName = generateUniqueName();
-final String globalViewName = generateUniqueName();
-final String globalViewIdxName = generateUniqueName();
-final String tenantViewName1 = generateUniqueName();
-final String tenantViewName2 = generateUniqueName();
+final String baseTableName = "BT_" + generateUniqueName();
+final String globalViewName = "GV_" + generateUniqueName();
+final String globalViewIdxName = "GVI_" + generateUniqueName();
+final String tenantViewName1 = "TV1_" + generateUniqueName();
+final String tenantViewName2 = "TV2_" + generateUniqueName();
 
 // Set up props with TenantId
 Properties props  = new Properties();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f81cce37/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index e7f7795..d252879 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -596,66 +596,111 @@ public class MetaDataClient {
 int tryCount = 0;
 MetaDataMutationResult result;
 
-do {
-final byte[] schemaBytes = PVarchar.INSTANCE.toBytes(schemaName);
-final byte[] tableBytes = PVarchar.INSTANCE.toBytes(tableName);
-ConnectionQueryServices queryServices = 

phoenix git commit: PHOENIX-4634 Looking up a parent index table of a tenant child view fails in BaseColumnResolver createTableRef()

2018-03-13 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 80df1c3c9 -> 20f4cf99f


PHOENIX-4634 Looking up a parent index table of a tenant child view fails in 
BaseColumnResolver createTableRef()


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 20f4cf99fb6154c251b68e8c02016dec8417d622
Parents: 80df1c3
Author: Thomas D'Silva 
Authored: Tue Mar 6 11:14:47 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Mar 13 10:38:54 2018 -0700

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java |   2 +-
 .../index/ChildViewsUseParentViewIndexIT.java   |  10 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 159 ---
 .../org/apache/phoenix/util/PhoenixRuntime.java |  24 +--
 4 files changed, 115 insertions(+), 80 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/20f4cf99/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 407e9cf..c93d2aa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -159,7 +159,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 stmt.executeQuery(sql);
 PTable indexTable = stmt.getQueryPlan().getTableRef().getTable();
 String tableName = indexTable.getName().getString();
-String expectedTableName = baseTableIndexName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + viewName;
+String expectedTableName = viewName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + baseTableIndexName;
 assertEquals("Parent Index table is not used ", expectedTableName, 
tableName);
 
 // verify that we can look up the index using PhoenixRuntime from 
a different client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/20f4cf99/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
index 1e60bf1..6c8f9e8 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
@@ -37,11 +37,11 @@ public class ChildViewsUseParentViewIndexIT extends 
ParallelStatsDisabledIT {
 
 @Test
 public void testIndexOnParentViewWithTenantSpecificConnection() throws 
Exception {
-final String baseTableName = generateUniqueName();
-final String globalViewName = generateUniqueName();
-final String globalViewIdxName = generateUniqueName();
-final String tenantViewName1 = generateUniqueName();
-final String tenantViewName2 = generateUniqueName();
+final String baseTableName = "BT_" + generateUniqueName();
+final String globalViewName = "GV_" + generateUniqueName();
+final String globalViewIdxName = "GVI_" + generateUniqueName();
+final String tenantViewName1 = "TV1_" + generateUniqueName();
+final String tenantViewName2 = "TV2_" + generateUniqueName();
 
 // Set up props with TenantId
 Properties props  = new Properties();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/20f4cf99/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 24eaef8..5f305a5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -590,66 +590,111 @@ public class MetaDataClient {
 int tryCount = 0;
 MetaDataMutationResult result;
 
-do {
-final byte[] schemaBytes = PVarchar.INSTANCE.toBytes(schemaName);
-final byte[] tableBytes = PVarchar.INSTANCE.toBytes(tableName);
-ConnectionQueryServices queryServices = 

phoenix git commit: PHOENIX-4634 Looking up a parent index table of a tenant child view fails in BaseColumnResolver createTableRef()

2018-03-13 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 6d0cbbb6f -> 1e83415f1


PHOENIX-4634 Looking up a parent index table of a tenant child view fails in 
BaseColumnResolver createTableRef()


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 1e83415f1cfb8dc1e96b53861b8e3097e4c8b4f7
Parents: 6d0cbbb
Author: Thomas D'Silva 
Authored: Tue Mar 6 11:14:47 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Mar 13 10:38:45 2018 -0700

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java |   2 +-
 .../index/ChildViewsUseParentViewIndexIT.java   |  10 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 159 ---
 .../org/apache/phoenix/util/PhoenixRuntime.java |  24 +--
 4 files changed, 115 insertions(+), 80 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e83415f/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 407e9cf..c93d2aa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -159,7 +159,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 stmt.executeQuery(sql);
 PTable indexTable = stmt.getQueryPlan().getTableRef().getTable();
 String tableName = indexTable.getName().getString();
-String expectedTableName = baseTableIndexName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + viewName;
+String expectedTableName = viewName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + baseTableIndexName;
 assertEquals("Parent Index table is not used ", expectedTableName, 
tableName);
 
 // verify that we can look up the index using PhoenixRuntime from 
a different client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e83415f/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
index 1e60bf1..6c8f9e8 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
@@ -37,11 +37,11 @@ public class ChildViewsUseParentViewIndexIT extends 
ParallelStatsDisabledIT {
 
 @Test
 public void testIndexOnParentViewWithTenantSpecificConnection() throws 
Exception {
-final String baseTableName = generateUniqueName();
-final String globalViewName = generateUniqueName();
-final String globalViewIdxName = generateUniqueName();
-final String tenantViewName1 = generateUniqueName();
-final String tenantViewName2 = generateUniqueName();
+final String baseTableName = "BT_" + generateUniqueName();
+final String globalViewName = "GV_" + generateUniqueName();
+final String globalViewIdxName = "GVI_" + generateUniqueName();
+final String tenantViewName1 = "TV1_" + generateUniqueName();
+final String tenantViewName2 = "TV2_" + generateUniqueName();
 
 // Set up props with TenantId
 Properties props  = new Properties();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e83415f/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 3b38ede..6687db6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -591,66 +591,111 @@ public class MetaDataClient {
 int tryCount = 0;
 MetaDataMutationResult result;
 
-do {
-final byte[] schemaBytes = PVarchar.INSTANCE.toBytes(schemaName);
-final byte[] tableBytes = PVarchar.INSTANCE.toBytes(tableName);
-ConnectionQueryServices queryServices = 

phoenix git commit: PHOENIX-4634 Looking up a parent index table of a tenant child view fails in BaseColumnResolver createTableRef()

2018-03-13 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master 7091820ea -> 4e677818e


PHOENIX-4634 Looking up a parent index table of a tenant child view fails in 
BaseColumnResolver createTableRef()


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

Branch: refs/heads/master
Commit: 4e677818e2a2453e3e078506e3e096301df4564f
Parents: 7091820
Author: Thomas D'Silva 
Authored: Tue Mar 6 11:14:47 2018 -0800
Committer: Thomas D'Silva 
Committed: Tue Mar 13 11:04:00 2018 -0700

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java |   2 +-
 .../index/ChildViewsUseParentViewIndexIT.java   |  10 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 159 ---
 .../org/apache/phoenix/util/PhoenixRuntime.java |  24 +--
 4 files changed, 115 insertions(+), 80 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e677818/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 407e9cf..c93d2aa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -159,7 +159,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 stmt.executeQuery(sql);
 PTable indexTable = stmt.getQueryPlan().getTableRef().getTable();
 String tableName = indexTable.getName().getString();
-String expectedTableName = baseTableIndexName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + viewName;
+String expectedTableName = viewName + 
QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR + baseTableIndexName;
 assertEquals("Parent Index table is not used ", expectedTableName, 
tableName);
 
 // verify that we can look up the index using PhoenixRuntime from 
a different client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e677818/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
index 1e60bf1..6c8f9e8 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
@@ -37,11 +37,11 @@ public class ChildViewsUseParentViewIndexIT extends 
ParallelStatsDisabledIT {
 
 @Test
 public void testIndexOnParentViewWithTenantSpecificConnection() throws 
Exception {
-final String baseTableName = generateUniqueName();
-final String globalViewName = generateUniqueName();
-final String globalViewIdxName = generateUniqueName();
-final String tenantViewName1 = generateUniqueName();
-final String tenantViewName2 = generateUniqueName();
+final String baseTableName = "BT_" + generateUniqueName();
+final String globalViewName = "GV_" + generateUniqueName();
+final String globalViewIdxName = "GVI_" + generateUniqueName();
+final String tenantViewName1 = "TV1_" + generateUniqueName();
+final String tenantViewName2 = "TV2_" + generateUniqueName();
 
 // Set up props with TenantId
 Properties props  = new Properties();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e677818/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index e7f7795..d252879 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -596,66 +596,111 @@ public class MetaDataClient {
 int tryCount = 0;
 MetaDataMutationResult result;
 
-do {
-final byte[] schemaBytes = PVarchar.INSTANCE.toBytes(schemaName);
-final byte[] tableBytes = PVarchar.INSTANCE.toBytes(tableName);
-ConnectionQueryServices queryServices = 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)

2018-03-12 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 2b36fa2d7 -> 34dd8cc72


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 34dd8cc72026229a3606ce21bd3fcf574c6dae11
Parents: 2b36fa2
Author: Thomas D'Silva 
Authored: Mon Mar 12 12:01:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Mar 12 12:10:44 2018 -0700

--
 .../phoenix/expression/function/CollationKeyFunction.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/34dd8cc7/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
index cd1ef24..833a4ad 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.Expression;
-import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.parse.FunctionParseNode;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PBoolean;
@@ -190,4 +189,9 @@ public class CollationKeyFunction extends ScalarFunction {
// TODO: Look into calling freeze() on them to be able return 
true here.
return false;
}
+   
+@Override
+public boolean isNullable() {
+   return getChildren().get(0).isNullable();
+}
 }



phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)

2018-03-12 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 1bfcef641 -> 8b24575e1


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 8b24575e152800eab13e32128a9f9403e04e96cb
Parents: 1bfcef6
Author: Thomas D'Silva 
Authored: Mon Mar 12 12:01:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Mar 12 12:11:28 2018 -0700

--
 .../phoenix/expression/function/CollationKeyFunction.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b24575e/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
index cd1ef24..9d48feb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.Expression;
-import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.parse.FunctionParseNode;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PBoolean;
@@ -190,4 +189,9 @@ public class CollationKeyFunction extends ScalarFunction {
// TODO: Look into calling freeze() on them to be able return 
true here.
return false;
}
+   
+@Override
+public boolean isNullable() {
+return getChildren().get(0).isNullable();
+}
 }



phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)

2018-03-12 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 eb3458912 -> 7f2a04dd8


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: 7f2a04dd816ff84e7018e62f6c391775bee52b22
Parents: eb34589
Author: Thomas D'Silva 
Authored: Mon Mar 12 12:01:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Mar 12 12:30:39 2018 -0700

--
 .../phoenix/expression/function/CollationKeyFunction.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7f2a04dd/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
index cd1ef24..9d48feb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.Expression;
-import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.parse.FunctionParseNode;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PBoolean;
@@ -190,4 +189,9 @@ public class CollationKeyFunction extends ScalarFunction {
// TODO: Look into calling freeze() on them to be able return 
true here.
return false;
}
+   
+@Override
+public boolean isNullable() {
+return getChildren().get(0).isNullable();
+}
 }



phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)

2018-03-12 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 8c6cc47a6 -> 4756e0d28


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 4756e0d28275610f374a4ed6618fa145ec353182
Parents: 8c6cc47
Author: Thomas D'Silva 
Authored: Mon Mar 12 12:01:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Mar 12 12:30:28 2018 -0700

--
 .../phoenix/expression/function/CollationKeyFunction.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4756e0d2/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
index cd1ef24..9d48feb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.Expression;
-import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.parse.FunctionParseNode;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PBoolean;
@@ -190,4 +189,9 @@ public class CollationKeyFunction extends ScalarFunction {
// TODO: Look into calling freeze() on them to be able return 
true here.
return false;
}
+   
+@Override
+public boolean isNullable() {
+return getChildren().get(0).isNullable();
+}
 }



phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)

2018-03-12 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 905e25b6b -> a73fb08ca


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)


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

Branch: refs/heads/4.x-HBase-1.3
Commit: a73fb08ca8f77e2d22aa81912bad054778c8ddbf
Parents: 905e25b
Author: Thomas D'Silva 
Authored: Mon Mar 12 12:01:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Mar 12 12:30:34 2018 -0700

--
 .../phoenix/expression/function/CollationKeyFunction.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a73fb08c/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
index cd1ef24..9d48feb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.Expression;
-import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.parse.FunctionParseNode;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PBoolean;
@@ -190,4 +189,9 @@ public class CollationKeyFunction extends ScalarFunction {
// TODO: Look into calling freeze() on them to be able return 
true here.
return false;
}
+   
+@Override
+public boolean isNullable() {
+return getChildren().get(0).isNullable();
+}
 }



phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)

2018-03-12 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master 35a90e4e6 -> cc494a1ba


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions (addendum)


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

Branch: refs/heads/master
Commit: cc494a1ba5f65a2dd87d3e8083cf60efbf8d707a
Parents: 35a90e4
Author: Thomas D'Silva 
Authored: Mon Mar 12 12:01:28 2018 -0700
Committer: Thomas D'Silva 
Committed: Mon Mar 12 12:07:38 2018 -0700

--
 .../phoenix/expression/function/CollationKeyFunction.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc494a1b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
index cd1ef24..9d48feb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CollationKeyFunction.java
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.Expression;
-import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.parse.FunctionParseNode;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PBoolean;
@@ -190,4 +189,9 @@ public class CollationKeyFunction extends ScalarFunction {
// TODO: Look into calling freeze() on them to be able return 
true here.
return false;
}
+   
+@Override
+public boolean isNullable() {
+return getChildren().get(0).isNullable();
+}
 }



phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 107d2fb45 -> 970a184e2


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 970a184e2d6ecbc051bda15b08475af6a2fbe67d
Parents: 107d2fb
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:47:50 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 18 +---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 259 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/970a184e/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 3858825..624f3e3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -131,7 +131,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -141,13 +141,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/970a184e/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 a9128ab..afb6d72 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 ResultSet 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master d2715101e -> 759b7c56d


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/master
Commit: 759b7c56dafcc6aca5afb11cfb16c723a8a9d366
Parents: d271510
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:48:34 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 18 +---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 259 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/759b7c56/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 3858825..624f3e3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -131,7 +131,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -141,13 +141,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/759b7c56/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 a9128ab..afb6d72 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 ResultSet rs = 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 75532db69 -> f1154aa43


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/5.x-HBase-2.0
Commit: f1154aa4341d2dddb8ede41f76964d372b42dcbf
Parents: 75532db
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:48:24 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 18 +---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 259 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f1154aa4/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 3858825..624f3e3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -131,7 +131,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -141,13 +141,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f1154aa4/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 a9128ab..afb6d72 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 ResultSet 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 0aba3a9a1 -> 2f9521fdf


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: 2f9521fdfe73c57e7454ae87927f2387ee8e384a
Parents: 0aba3a9
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:48:13 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 18 +---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 259 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2f9521fd/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 3858825..624f3e3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -131,7 +131,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -141,13 +141,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2f9521fd/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 a9128ab..afb6d72 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 ResultSet 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 94ee389e0 -> 6306ec95f


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6306ec95ff68d83557826a07b9fd99165fee6cfb
Parents: 94ee389
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:34:23 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 18 +---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 259 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6306ec95/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 3858825..624f3e3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -131,7 +131,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -141,13 +141,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6306ec95/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 a9128ab..afb6d72 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 ResultSet 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 c78f58a6f -> 6419d8c94


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 6419d8c94b7ce00a41e95b49ef45a9310ea545dc
Parents: c78f58a
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:48:02 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 18 +---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 259 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6419d8c9/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 3858825..624f3e3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -131,7 +131,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -141,13 +141,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6419d8c9/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 a9128ab..afb6d72 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 ResultSet 

phoenix git commit: PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions

2018-03-10 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 f24a07e8a -> ffb86c12f


PHOENIX-4418 - add locale-awareness to UPPER() and LOWER() functions


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

Branch: refs/heads/4.x-HBase-0.98
Commit: ffb86c12fb203a0edd340e07597bf520d7a0c17f
Parents: f24a07e
Author: Shehzaad 
Authored: Wed Jan 31 02:21:21 2018 -0800
Committer: Thomas D'Silva 
Committed: Sat Mar 10 13:31:44 2018 -0800

--
 .../apache/phoenix/end2end/IndexExtendedIT.java |  6 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java |  6 +-
 .../function/CollationKeyFunction.java  | 11 ---
 .../expression/function/LowerFunction.java  | 28 +-
 .../expression/function/ScalarFunction.java | 15 +++-
 .../expression/function/UpperFunction.java  | 29 +-
 .../expression/function/LowerFunctionTest.java  | 93 
 .../expression/function/UpperFunctionTest.java  | 92 +++
 8 files changed, 258 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffb86c12/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 5b6f753..0093eca 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -133,7 +133,7 @@ public class IndexExtendedIT extends BaseTest {
 IndexToolIT.upsertRow(stmt1, id++);
 conn.commit();
 
-stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME)) ASYNC ", indexTableName,dataTableFullName));
+stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") 
+ " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", 
indexTableName,dataTableFullName));
 
 //update a row 
 stmt1.setInt(1, 1);
@@ -143,13 +143,13 @@ public class IndexExtendedIT extends BaseTest {
 conn.commit();  
 
 //verify rows are fetched from data table.
-String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME) ='UNAME2'",dataTableFullName);
+String selectSql = String.format("SELECT ID FROM %s WHERE 
UPPER(NAME, 'en_US') ='UNAME2'",dataTableFullName);
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + 
selectSql);
 String actualExplainPlan = QueryUtil.getExplainPlan(rs);
 
 //assert we are pulling from data table.
 assertEquals(String.format("CLIENT PARALLEL 1-WAY FULL SCAN OVER 
%s\n" +
-"SERVER FILTER BY UPPER(NAME) = 
'UNAME2'",dataTableFullName),actualExplainPlan);
+"SERVER FILTER BY UPPER(NAME, 'en_US') = 
'UNAME2'",dataTableFullName),actualExplainPlan);
 
 rs = stmt1.executeQuery(selectSql);
 assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffb86c12/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 913a147..8002db0 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
@@ -163,14 +163,14 @@ public class IndexToolIT extends BaseTest {
 
 String stmtString2 =
 String.format(
-"CREATE %s INDEX %s ON %s  
(LPAD(UPPER(NAME),8,'x')||'_xyz') ASYNC ",
+"CREATE %s INDEX %s ON %s  (LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz') ASYNC ",
 (localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
 conn.createStatement().execute(stmtString2);
 
 // verify rows are fetched from data table.
 String selectSql =
 String.format(
-"SELECT ID FROM %s WHERE 
LPAD(UPPER(NAME),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
+"SELECT ID FROM %s WHERE LPAD(UPPER(NAME, 
'en_US'),8,'x')||'_xyz' = 'xxUNAME2_xyz'",
 dataTableFullName);
 

phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master a35591c87 -> 2b7861536


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/master
Commit: 2b7861536909a51167bcd5006eb70f65f03d9536
Parents: a35591c
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:52:07 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2b786153/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 6926c4e..6bff885 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
@@ -129,6 +129,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2449,7 +2450,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 4f7949135 -> 81784909f


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 81784909f76335ae95e5e5a417c2722d283020de
Parents: 4f79491
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:51:49 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/81784909/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 07bef1b..44e7f33 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
@@ -135,6 +135,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2485,7 +2486,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 1da8e8608 -> ca5c9d03c


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: ca5c9d03ceb619f6b8fcb3f443907a0ccf0b9cd0
Parents: 1da8e86
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:51:33 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ca5c9d03/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 6926c4e..6bff885 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
@@ -129,6 +129,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2449,7 +2450,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 bd34ae79f -> 26f06354a


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 26f06354a9a95b6a54bcc2975dc4914f44c79ce8
Parents: bd34ae7
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:51:10 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/26f06354/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 6926c4e..6bff885 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
@@ -129,6 +129,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2449,7 +2450,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 8e0c3d1c0 -> 8f19583c5


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 8f19583c5a06fe468797ba49e763a9a5c3c6278b
Parents: 8e0c3d1
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:49:12 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8f19583c/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 6926c4e..6bff885 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
@@ -129,6 +129,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2449,7 +2450,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 93405cb52 -> c1fcc92ce


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c1fcc92cea9ee4136cc8a510d9d3a7aba506d228
Parents: 93405cb
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:48:59 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1fcc92c/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 517a275..ccc6f99 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
@@ -128,6 +128,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2445,7 +2446,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that don't have CREATE access on SYSTEM.CATALOG

2018-03-02 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 62a611690 -> 0f7879b17


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 0f7879b17f25c110c145ce449da918a80308b18e
Parents: 62a6116
Author: Thomas D'Silva 
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Mar 2 15:48:23 2018 -0800

--
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0f7879b1/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 01c862e..624544f 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
@@ -129,6 +129,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2451,7 +2452,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 setUpgradeRequired();
 }
 } catch (PhoenixIOException e) {
-if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+boolean foundAccessDeniedException = false;
+// when running spark/map reduce jobs the 
ADE might be wrapped
+// in a RemoteException
+for (Throwable t : 
Throwables.getCausalChain(e)) {
+if (t instanceof AccessDeniedException
+|| (t instanceof 
RemoteException
+&& ((RemoteException) 
t).getClassName()
+
.equals(AccessDeniedException.class
+
.getName( {
+foundAccessDeniedException = true;
+break;
+}
+}
+if (foundAccessDeniedException) {
 // Pass
 logger.warn("Could not check for 
Phoenix SYSTEM tables, assuming they exist and are properly configured");
 
checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
 getProps()).getName());



phoenix git commit: PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is not enabled

2018-02-22 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 556b05443 -> b56a3dbdf


PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is 
not enabled


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: b56a3dbdfd29cea0a65f39d317700ceb94a94d7f
Parents: 556b054
Author: Vikas Vishwakarma 
Authored: Thu Feb 22 11:13:34 2018 +0530
Committer: Thomas D'Silva 
Committed: Thu Feb 22 10:42:21 2018 -0800

--
 .../src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b56a3dbd/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 4555190..2b428c9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -1236,7 +1236,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 }
 
 public void addIteratorForLeaseRenewal(@Nonnull TableResultIterator itr) {
-if (services.supportsFeature(Feature.RENEW_LEASE)) {
+if (services.isRenewingLeasesEnabled()) {
 checkNotNull(itr);
 scannerQueue.add(new WeakReference(itr));
 }



phoenix git commit: PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is not enabled

2018-02-22 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master 10109d55d -> f355be008


PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is 
not enabled


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

Branch: refs/heads/master
Commit: f355be00884eb890fa558e3666fce2b93968c15b
Parents: 10109d5
Author: Vikas Vishwakarma 
Authored: Thu Feb 22 11:13:34 2018 +0530
Committer: Thomas D'Silva 
Committed: Thu Feb 22 10:41:39 2018 -0800

--
 .../src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f355be00/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 4555190..2b428c9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -1236,7 +1236,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 }
 
 public void addIteratorForLeaseRenewal(@Nonnull TableResultIterator itr) {
-if (services.supportsFeature(Feature.RENEW_LEASE)) {
+if (services.isRenewingLeasesEnabled()) {
 checkNotNull(itr);
 scannerQueue.add(new WeakReference(itr));
 }



phoenix git commit: PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is not enabled

2018-02-22 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 9e5fdab02 -> cb682c9a1


PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is 
not enabled


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

Branch: refs/heads/4.x-HBase-1.3
Commit: cb682c9a19695ed33c7e6c3889c20b4071cfa9e7
Parents: 9e5fdab
Author: Vikas Vishwakarma 
Authored: Thu Feb 22 11:13:34 2018 +0530
Committer: Thomas D'Silva 
Committed: Thu Feb 22 10:42:11 2018 -0800

--
 .../src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cb682c9a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 4555190..2b428c9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -1236,7 +1236,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 }
 
 public void addIteratorForLeaseRenewal(@Nonnull TableResultIterator itr) {
-if (services.supportsFeature(Feature.RENEW_LEASE)) {
+if (services.isRenewingLeasesEnabled()) {
 checkNotNull(itr);
 scannerQueue.add(new WeakReference(itr));
 }



phoenix git commit: PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is not enabled

2018-02-22 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 63940f949 -> 9ff02ea24


PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is 
not enabled


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 9ff02ea24d21563a011a4cf24882325f23c51726
Parents: 63940f9
Author: Vikas Vishwakarma 
Authored: Thu Feb 22 11:13:34 2018 +0530
Committer: Thomas D'Silva 
Committed: Thu Feb 22 10:41:26 2018 -0800

--
 .../src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ff02ea2/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 4555190..2b428c9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -1236,7 +1236,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 }
 
 public void addIteratorForLeaseRenewal(@Nonnull TableResultIterator itr) {
-if (services.supportsFeature(Feature.RENEW_LEASE)) {
+if (services.isRenewingLeasesEnabled()) {
 checkNotNull(itr);
 scannerQueue.add(new WeakReference(itr));
 }



phoenix git commit: PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is not enabled

2018-02-22 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 ac8c9ee97 -> 4fc3f7545


PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is 
not enabled


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 4fc3f7545db831e83bc82783a0655df79821c107
Parents: ac8c9ee
Author: Vikas Vishwakarma 
Authored: Thu Feb 22 11:13:34 2018 +0530
Committer: Thomas D'Silva 
Committed: Thu Feb 22 10:41:54 2018 -0800

--
 .../src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4fc3f754/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 5b6ab58..7c9f478 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -1220,7 +1220,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 }
 
 public void addIteratorForLeaseRenewal(@Nonnull TableResultIterator itr) {
-if (services.supportsFeature(Feature.RENEW_LEASE)) {
+if (services.isRenewingLeasesEnabled()) {
 checkNotNull(itr);
 scannerQueue.add(new WeakReference(itr));
 }



phoenix git commit: PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is not enabled

2018-02-22 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 27d57de73 -> 650666075


PHOENIX-4625 memory leak in PhoenixConnection if scanner renew lease thread is 
not enabled


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 650666075be29bfab4d8bb050417db5432e0a94f
Parents: 27d57de
Author: Vikas Vishwakarma 
Authored: Thu Feb 22 11:13:34 2018 +0530
Committer: Thomas D'Silva 
Committed: Thu Feb 22 10:42:01 2018 -0800

--
 .../src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/65066607/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 4555190..2b428c9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -1236,7 +1236,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 }
 
 public void addIteratorForLeaseRenewal(@Nonnull TableResultIterator itr) {
-if (services.supportsFeature(Feature.RENEW_LEASE)) {
+if (services.isRenewingLeasesEnabled()) {
 checkNotNull(itr);
 scannerQueue.add(new WeakReference(itr));
 }



phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master ef48ad2ea -> a9e212e41


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/master
Commit: a9e212e41de71dbba82f27ab467ef36974cd6c87
Parents: ef48ad2
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:45 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9e212e4/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index f13510b..f369be9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -34,7 +35,9 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   PhoenixConfigurationUtil
+  

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 82ba1417f -> fa7ff4f4e


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/4.x-HBase-1.3
Commit: fa7ff4f4ea87deaf1fc194d4013318102777a8f4
Parents: 82ba141
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:07 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fa7ff4f4/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index f13510b..f369be9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -34,7 +35,9 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 ea628b4bc -> 0d80b3131


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 0d80b313117652fe425e9b756d90ed44a26db777
Parents: ea628b4
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:32 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d80b313/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index 5fb0184..c227b48 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -35,7 +36,9 @@ import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1107,4 +1110,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   PhoenixConfigurationUtil
+ 

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 1b14b6215 -> 65f82a9d3


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: 65f82a9d3c9472104eacf874f0da9efedefc3444
Parents: 1b14b62
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:20 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/65f82a9d/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index f13510b..f369be9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -34,7 +35,9 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 5e56ab47f -> 27d57de73


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 27d57de736278f074200a9f7a9cd448c9355deb5
Parents: 5e56ab4
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:22:30 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/27d57de7/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index 49efa97..a342206 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -34,7 +35,9 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 e4b63d8c8 -> c6a10dc69


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/4.x-HBase-1.2
Commit: c6a10dc698133f339731ccade68231e9704cd1a0
Parents: e4b63d8
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:22:40 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c6a10dc6/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index f13510b..f369be9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -34,7 +35,9 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 770b9e410 -> ac8c9ee97


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


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

Branch: refs/heads/4.x-HBase-0.98
Commit: ac8c9ee970f8c776d3e8cd269e98d50c679e5c38
Parents: 770b9e4
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:22:19 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ac8c9ee9/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
index c15641d..03cb484 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION;
 import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -34,7 +35,9 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant views that have the same name

2018-01-25 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 a37a30a6c -> 37478531b


PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant 
views that have the same name


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 37478531b9baa67557776054baeebde78843b69d
Parents: a37a30a
Author: Thomas D'Silva 
Authored: Mon Jan 22 11:08:03 2018 -0800
Committer: Thomas D'Silva 
Committed: Thu Jan 25 12:16:42 2018 -0800

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java | 97 ++--
 .../org/apache/phoenix/util/UpgradeUtil.java| 28 --
 2 files changed, 110 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/37478531/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 216653c..407e9cf 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -17,10 +17,17 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LINK_TYPE;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -31,14 +38,18 @@ import java.util.Properties;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.LinkType;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.UpgradeUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -60,16 +71,16 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 DriverManager.registerDriver(PhoenixDriver.INSTANCE);
 }
 
-public Connection createConnection(boolean isMultiTenant, boolean 
isDifferentClient) throws SQLException {
+public Connection createConnection(String tenantId, boolean 
isDifferentClient) throws SQLException {
 Properties props = new Properties();
 props.setProperty(QueryServices.RETURN_SEQUENCE_VALUES_ATTRIB, 
"false");
 // force the use of ConnectionQueryServicesImpl instead of 
ConnectionQueryServicesTestImpl
 props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-if (isMultiTenant)
-props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "tenant1");
+if (tenantId!=null)
+props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
 StringBuilder sb = new StringBuilder(url);
-if (isMultiTenant)
+if (isDifferentClient)
 sb.append(PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "Client2");
 return DriverManager.getConnection(sb.toString(), props);
 }
@@ -80,7 +91,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 String sequenceNameWithoutSchema = generateUniqueSequenceName();
 String sequenceName = SchemaUtil.getTableName(schemaName, 
sequenceNameWithoutSchema);
 
-Connection conn = createConnection(false, false);
+Connection conn = createConnection(null, false);
 conn.createStatement().execute("CREATE SEQUENCE " + sequenceName + " 
START WITH 3 INCREMENT BY 2 CACHE 5");
 

phoenix git commit: PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant views that have the same name

2018-01-24 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master 65f91a11d -> 3a6c76f12


PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant 
views that have the same name


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

Branch: refs/heads/master
Commit: 3a6c76f122d7df1aa6fe9eb76f100ea23d298a03
Parents: 65f91a1
Author: Thomas D'Silva 
Authored: Mon Jan 22 11:08:03 2018 -0800
Committer: Thomas D'Silva 
Committed: Wed Jan 24 09:56:03 2018 -0800

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java | 97 ++--
 .../org/apache/phoenix/util/UpgradeUtil.java| 28 --
 2 files changed, 110 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3a6c76f1/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 216653c..407e9cf 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -17,10 +17,17 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LINK_TYPE;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -31,14 +38,18 @@ import java.util.Properties;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.LinkType;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.UpgradeUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -60,16 +71,16 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 DriverManager.registerDriver(PhoenixDriver.INSTANCE);
 }
 
-public Connection createConnection(boolean isMultiTenant, boolean 
isDifferentClient) throws SQLException {
+public Connection createConnection(String tenantId, boolean 
isDifferentClient) throws SQLException {
 Properties props = new Properties();
 props.setProperty(QueryServices.RETURN_SEQUENCE_VALUES_ATTRIB, 
"false");
 // force the use of ConnectionQueryServicesImpl instead of 
ConnectionQueryServicesTestImpl
 props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-if (isMultiTenant)
-props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "tenant1");
+if (tenantId!=null)
+props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
 StringBuilder sb = new StringBuilder(url);
-if (isMultiTenant)
+if (isDifferentClient)
 sb.append(PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "Client2");
 return DriverManager.getConnection(sb.toString(), props);
 }
@@ -80,7 +91,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 String sequenceNameWithoutSchema = generateUniqueSequenceName();
 String sequenceName = SchemaUtil.getTableName(schemaName, 
sequenceNameWithoutSchema);
 
-Connection conn = createConnection(false, false);
+Connection conn = createConnection(null, false);
 conn.createStatement().execute("CREATE SEQUENCE " + sequenceName + " 
START WITH 3 INCREMENT BY 2 CACHE 5");
 
 

[1/3] phoenix git commit: PHOENIX-4468 Looking up a parent index table of a child view from a different client fails

2018-01-24 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 d1b5fd528 -> ab796a8f5


PHOENIX-4468 Looking up a parent index table of a child view from a different 
client fails


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 6322b7a01f7b1cab66a4e1fdd3c3b1c4ed58e14f
Parents: d1b5fd5
Author: Thomas D'Silva 
Authored: Mon Dec 18 11:48:39 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Jan 24 10:04:15 2018 -0800

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java | 160 +++
 .../org/apache/phoenix/end2end/SequenceIT.java  |  29 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |   1 +
 .../apache/phoenix/schema/MetaDataClient.java   |   4 +-
 .../org/apache/phoenix/schema/PTableImpl.java   |   2 +-
 .../org/apache/phoenix/util/PhoenixRuntime.java |  32 +++-
 6 files changed, 189 insertions(+), 39 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6322b7a0/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
new file mode 100644
index 000..216653c
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -0,0 +1,160 @@
+/*
+ * 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.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.sql.SQLException;
+import java.util.Properties;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixStatement;
+import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PhoenixDriverIT extends BaseUniqueNamesOwnClusterIT {
+
+private static HBaseTestingUtility hbaseTestUtil;
+private static String zkQuorum;
+
+@BeforeClass
+public static void setUp() throws Exception {
+Configuration conf = HBaseConfiguration.create();
+hbaseTestUtil = new HBaseTestingUtility(conf);
+setUpConfigForMiniCluster(conf);
+conf.set(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, 
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
+hbaseTestUtil.startMiniCluster();
+// establish url and quorum. Need to use PhoenixDriver and not 
PhoenixTestDriver
+zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
+url = PhoenixRuntime.JDBC_PROTOCOL + 
PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+DriverManager.registerDriver(PhoenixDriver.INSTANCE);
+}
+
+public Connection createConnection(boolean isMultiTenant, boolean 
isDifferentClient) throws SQLException {
+Properties props = new Properties();
+props.setProperty(QueryServices.RETURN_SEQUENCE_VALUES_ATTRIB, 
"false");
+// force the use of ConnectionQueryServicesImpl instead of 
ConnectionQueryServicesTestImpl
+props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
+QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
+if (isMultiTenant)
+

phoenix git commit: PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant views that have the same name

2018-01-24 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 aa9c7d6e4 -> 3cb0a1d89


PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant 
views that have the same name


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 3cb0a1d8995a126a2854f2c732764d10a5d65c42
Parents: aa9c7d6
Author: Thomas D'Silva 
Authored: Mon Jan 22 11:08:03 2018 -0800
Committer: Thomas D'Silva 
Committed: Wed Jan 24 09:57:29 2018 -0800

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java | 97 ++--
 .../org/apache/phoenix/util/UpgradeUtil.java| 28 --
 2 files changed, 110 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cb0a1d8/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 216653c..407e9cf 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -17,10 +17,17 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LINK_TYPE;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -31,14 +38,18 @@ import java.util.Properties;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.LinkType;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.UpgradeUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -60,16 +71,16 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 DriverManager.registerDriver(PhoenixDriver.INSTANCE);
 }
 
-public Connection createConnection(boolean isMultiTenant, boolean 
isDifferentClient) throws SQLException {
+public Connection createConnection(String tenantId, boolean 
isDifferentClient) throws SQLException {
 Properties props = new Properties();
 props.setProperty(QueryServices.RETURN_SEQUENCE_VALUES_ATTRIB, 
"false");
 // force the use of ConnectionQueryServicesImpl instead of 
ConnectionQueryServicesTestImpl
 props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-if (isMultiTenant)
-props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "tenant1");
+if (tenantId!=null)
+props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
 StringBuilder sb = new StringBuilder(url);
-if (isMultiTenant)
+if (isDifferentClient)
 sb.append(PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "Client2");
 return DriverManager.getConnection(sb.toString(), props);
 }
@@ -80,7 +91,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 String sequenceNameWithoutSchema = generateUniqueSequenceName();
 String sequenceName = SchemaUtil.getTableName(schemaName, 
sequenceNameWithoutSchema);
 
-Connection conn = createConnection(false, false);
+Connection conn = createConnection(null, false);
 conn.createStatement().execute("CREATE SEQUENCE " + sequenceName + " 
START WITH 3 INCREMENT BY 2 CACHE 5");
 

[2/3] phoenix git commit: PHOENIX-4468 Looking up a parent index table of a child view from a different client fails (addendum)

2018-01-24 Thread tdsilva
PHOENIX-4468 Looking up a parent index table of a child view from a different 
client fails (addendum)


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 4031a9c076664c83b6f8a87ca3a149326ba1facd
Parents: 6322b7a
Author: Thomas D'Silva 
Authored: Wed Dec 20 15:47:19 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Jan 24 10:04:29 2018 -0800

--
 phoenix-core/src/main/antlr3/PhoenixSQL.g  | 1 -
 .../src/main/java/org/apache/phoenix/schema/PTableImpl.java| 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4031a9c0/phoenix-core/src/main/antlr3/PhoenixSQL.g
--
diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g 
b/phoenix-core/src/main/antlr3/PhoenixSQL.g
index f5eeb33..93e0ede 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -1084,7 +1084,6 @@ from_table_name returns [TableName ret]
 table_identifier returns [String ret]
 :   c=identifier {
if (c.contains(QueryConstants.NAMESPACE_SEPARATOR) ) { throw new 
RuntimeException("Table or schema name cannot contain colon"); }
-   if (c.contains(QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR) ) { 
throw new RuntimeException("Table or schema name cannot contain hash"); }
$ret = c;
 }
 ;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4031a9c0/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 13d0da6..0b48376 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
@@ -267,7 +267,7 @@ public class PTableImpl implements PTable {
 
 public static PTableImpl makePTable(PTable table, PName tableName, long 
timeStamp, List physicalNames, List indexes, String 
viewStatement, long updateCacheFrequency, PName tenantId) throws SQLException {
 return new PTableImpl(
-tenantId, PNameImpl.EMPTY_NAME, tableName, 
table.getType(), table.getIndexState(), timeStamp,
+tenantId, table.getSchemaName(), tableName, 
table.getType(), table.getIndexState(), timeStamp,
 table.getSequenceNumber(), table.getPKName(), 
table.getBucketNum(), getColumnsToClone(table), table.getParentSchemaName(), 
table.getParentTableName(),
 indexes, table.isImmutableRows(), physicalNames, 
table.getDefaultFamilyName(), viewStatement,
 table.isWALDisabled(), table.isMultiTenant(), 
table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), 
table.getIndexType(),



phoenix git commit: PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant views that have the same name

2018-01-24 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 4a3435ab3 -> 519cca954


PHOENIX-4548 UpgradeUtil.mapChildViewsToNamespace does not handle multi-tenant 
views that have the same name


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: 519cca95435e1558d3edfd37e1462c44de80aa4d
Parents: 4a3435a
Author: Thomas D'Silva 
Authored: Mon Jan 22 11:08:03 2018 -0800
Committer: Thomas D'Silva 
Committed: Wed Jan 24 09:59:35 2018 -0800

--
 .../apache/phoenix/end2end/PhoenixDriverIT.java | 97 ++--
 .../org/apache/phoenix/util/UpgradeUtil.java| 28 --
 2 files changed, 110 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/519cca95/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
index 216653c..407e9cf 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixDriverIT.java
@@ -17,10 +17,17 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LINK_TYPE;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -31,14 +38,18 @@ import java.util.Properties;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.LinkType;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.UpgradeUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -60,16 +71,16 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 DriverManager.registerDriver(PhoenixDriver.INSTANCE);
 }
 
-public Connection createConnection(boolean isMultiTenant, boolean 
isDifferentClient) throws SQLException {
+public Connection createConnection(String tenantId, boolean 
isDifferentClient) throws SQLException {
 Properties props = new Properties();
 props.setProperty(QueryServices.RETURN_SEQUENCE_VALUES_ATTRIB, 
"false");
 // force the use of ConnectionQueryServicesImpl instead of 
ConnectionQueryServicesTestImpl
 props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
 QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-if (isMultiTenant)
-props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "tenant1");
+if (tenantId!=null)
+props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
 StringBuilder sb = new StringBuilder(url);
-if (isMultiTenant)
+if (isDifferentClient)
 sb.append(PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "Client2");
 return DriverManager.getConnection(sb.toString(), props);
 }
@@ -80,7 +91,7 @@ public class PhoenixDriverIT extends 
BaseUniqueNamesOwnClusterIT {
 String sequenceNameWithoutSchema = generateUniqueSequenceName();
 String sequenceName = SchemaUtil.getTableName(schemaName, 
sequenceNameWithoutSchema);
 
-Connection conn = createConnection(false, false);
+Connection conn = createConnection(null, false);
 conn.createStatement().execute("CREATE SEQUENCE " + sequenceName + " 
START WITH 3 INCREMENT BY 2 CACHE 5");
 

<    2   3   4   5   6   7   8   9   10   11   >