Jenkins build is back to normal : Phoenix | Master #1875

2017-11-15 Thread Apache Jenkins Server
See 




Jenkins build is back to normal : Phoenix | 4.x-HBase-0.98 #1761

2017-11-15 Thread Apache Jenkins Server
See 




phoenix git commit: PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally

2017-11-15 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master 205390568 -> ef3bce18f


PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally


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

Branch: refs/heads/master
Commit: ef3bce18fe7373b66136d933cc364001dff2c3f8
Parents: 2053905
Author: Thomas D'Silva 
Authored: Wed Nov 15 18:54:04 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Nov 15 20:59:53 2017 -0800

--
 .../apache/phoenix/execute/MutationState.java   | 15 -
 .../org/apache/phoenix/util/KeyValueUtil.java   | 65 +---
 2 files changed, 43 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef3bce18/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 1f47a33..0cdb010 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -127,6 +127,7 @@ public class MutationState implements SQLCloseable {
 
 private long sizeOffset;
 private int numRows = 0;
+private long estimatedSize = 0;
 private int[] uncommittedStatementIndexes = EMPTY_STATEMENT_INDEX_ARRAY;
 private boolean isExternalTxContext = false;
 private Map> txMutations 
= Collections.emptyMap();
@@ -193,6 +194,7 @@ public class MutationState implements SQLCloseable {
 this.mutations.put(table, mutations);
 }
 this.numRows = mutations.size();
+this.estimatedSize = KeyValueUtil.getEstimatedRowSize(table, 
mutations);
 throwIfTooBig();
 }
 
@@ -354,7 +356,6 @@ public class MutationState implements SQLCloseable {
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED).build()
 .buildException();
 }
-long estimatedSize = KeyValueUtil.getEstimatedRowSize(mutations);
 if (estimatedSize > maxSizeBytes) {
 resetState();
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED)
@@ -433,7 +434,12 @@ public class MutationState implements SQLCloseable {
 
phoenixTransactionContext.join(newMutationState.getPhoenixTransactionContext());
 
 this.sizeOffset += newMutationState.sizeOffset;
+int oldNumRows = this.numRows;
 joinMutationState(newMutationState.mutations, this.mutations);
+// here we increment the estimated size by the fraction of new rows we 
added from the newMutationState 
+if (newMutationState.numRows>0) {
+this.estimatedSize += 
((double)(this.numRows-oldNumRows)/newMutationState.numRows) * 
newMutationState.estimatedSize;
+}
 if (!newMutationState.txMutations.isEmpty()) {
 if (txMutations.isEmpty()) {
 txMutations = 
Maps.newHashMapWithExpectedSize(mutations.size());
@@ -968,6 +974,8 @@ public class MutationState implements SQLCloseable {
 long mutationCommitTime = 0;
 long numFailedMutations = 0;;
 long startTime = 0;
+long startNumRows = numRows;
+long startEstimatedSize = estimatedSize;
 do {
 TableRef origTableRef = tableInfo.getOrigTableRef();
 PTable table = origTableRef.getTable();
@@ -1004,8 +1012,8 @@ public class MutationState implements SQLCloseable {
 for (List mutationBatch : mutationBatchList) 
{
 hTable.batch(mutationBatch);
 batchCount++;
+if (logger.isDebugEnabled()) logger.debug("Sent 
batch of " + mutationBatch.size() + " for " + Bytes.toString(htableName));
 }
-if (logger.isDebugEnabled()) logger.debug("Sent batch 
of " + numMutations + " for " + Bytes.toString(htableName));
 child.stop();
 child.stop();
 shouldRetry = false;
@@ -1015,6 +1023,8 @@ public class MutationState implements SQLCloseable {
 
 if (tableInfo.isDataTable()) {
 numRows -= numMutations;
+// decrement estimated size by 

phoenix git commit: PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally

2017-11-15 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 765e4eac3 -> d9d235402


PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally


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

Branch: refs/heads/4.x-HBase-0.98
Commit: d9d2354021d9d0e77f106832e17d6f8f81c986d0
Parents: 765e4ea
Author: Thomas D'Silva 
Authored: Wed Nov 15 18:54:04 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Nov 15 18:54:04 2017 -0800

--
 .../apache/phoenix/execute/MutationState.java   | 15 -
 .../org/apache/phoenix/util/KeyValueUtil.java   | 65 +---
 2 files changed, 43 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d9d23540/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 29bd31a..1e5a8ad 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -127,6 +127,7 @@ public class MutationState implements SQLCloseable {
 
 private long sizeOffset;
 private int numRows = 0;
+private long estimatedSize = 0;
 private int[] uncommittedStatementIndexes = EMPTY_STATEMENT_INDEX_ARRAY;
 private boolean isExternalTxContext = false;
 private Map> txMutations 
= Collections.emptyMap();
@@ -194,6 +195,7 @@ public class MutationState implements SQLCloseable {
 this.mutations.put(table, mutations);
 }
 this.numRows = mutations.size();
+this.estimatedSize = KeyValueUtil.getEstimatedRowSize(table, 
mutations);
 throwIfTooBig();
 }
 
@@ -355,7 +357,6 @@ public class MutationState implements SQLCloseable {
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED).build()
 .buildException();
 }
-long estimatedSize = KeyValueUtil.getEstimatedRowSize(mutations);
 if (estimatedSize > maxSizeBytes) {
 resetState();
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED)
@@ -434,7 +435,12 @@ public class MutationState implements SQLCloseable {
 
phoenixTransactionContext.join(newMutationState.getPhoenixTransactionContext());
 
 this.sizeOffset += newMutationState.sizeOffset;
+int oldNumRows = this.numRows;
 joinMutationState(newMutationState.mutations, this.mutations);
+// here we increment the estimated size by the fraction of new rows we 
added from the newMutationState 
+if (newMutationState.numRows>0) {
+this.estimatedSize += 
((double)(this.numRows-oldNumRows)/newMutationState.numRows) * 
newMutationState.estimatedSize;
+}
 if (!newMutationState.txMutations.isEmpty()) {
 if (txMutations.isEmpty()) {
 txMutations = 
Maps.newHashMapWithExpectedSize(mutations.size());
@@ -969,6 +975,8 @@ public class MutationState implements SQLCloseable {
 long mutationCommitTime = 0;
 long numFailedMutations = 0;;
 long startTime = 0;
+long startNumRows = numRows;
+long startEstimatedSize = estimatedSize;
 do {
 TableRef origTableRef = tableInfo.getOrigTableRef();
 PTable table = origTableRef.getTable();
@@ -1005,8 +1013,8 @@ public class MutationState implements SQLCloseable {
 for (List mutationBatch : mutationBatchList) 
{
 hTable.batch(mutationBatch);
 batchCount++;
+if (logger.isDebugEnabled()) logger.debug("Sent 
batch of " + mutationBatch.size() + " for " + Bytes.toString(htableName));
 }
-if (logger.isDebugEnabled()) logger.debug("Sent batch 
of " + numMutations + " for " + Bytes.toString(htableName));
 child.stop();
 child.stop();
 shouldRetry = false;
@@ -1016,6 +1024,8 @@ public class MutationState implements SQLCloseable {
 
 if (tableInfo.isDataTable()) {
 numRows -= numMutations;
+// decrement 

phoenix git commit: PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally

2017-11-15 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 693fa6598 -> 6a45c40fc


PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally


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

Branch: refs/heads/5.x-HBase-2.0
Commit: 6a45c40fc7187ec994db389c579ebe21e13ded52
Parents: 693fa65
Author: Thomas D'Silva 
Authored: Wed Nov 15 18:54:04 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Nov 15 20:59:41 2017 -0800

--
 .../apache/phoenix/execute/MutationState.java   | 15 -
 .../phoenix/util/PhoenixKeyValueUtil.java   | 65 +---
 2 files changed, 43 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a45c40f/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 04ed864..eab64f1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -128,6 +128,7 @@ public class MutationState implements SQLCloseable {
 
 private long sizeOffset;
 private int numRows = 0;
+private long estimatedSize = 0;
 private int[] uncommittedStatementIndexes = EMPTY_STATEMENT_INDEX_ARRAY;
 private boolean isExternalTxContext = false;
 private Map> txMutations 
= Collections.emptyMap();
@@ -194,6 +195,7 @@ public class MutationState implements SQLCloseable {
 this.mutations.put(table, mutations);
 }
 this.numRows = mutations.size();
+this.estimatedSize = KeyValueUtil.getEstimatedRowSize(table, 
mutations);
 throwIfTooBig();
 }
 
@@ -355,7 +357,6 @@ public class MutationState implements SQLCloseable {
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED).build()
 .buildException();
 }
-long estimatedSize = 
PhoenixKeyValueUtil.getEstimatedRowSize(mutations);
 if (estimatedSize > maxSizeBytes) {
 resetState();
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED)
@@ -434,7 +435,12 @@ public class MutationState implements SQLCloseable {
 
phoenixTransactionContext.join(newMutationState.getPhoenixTransactionContext());
 
 this.sizeOffset += newMutationState.sizeOffset;
+int oldNumRows = this.numRows;
 joinMutationState(newMutationState.mutations, this.mutations);
+// here we increment the estimated size by the fraction of new rows we 
added from the newMutationState 
+if (newMutationState.numRows>0) {
+this.estimatedSize += 
((double)(this.numRows-oldNumRows)/newMutationState.numRows) * 
newMutationState.estimatedSize;
+}
 if (!newMutationState.txMutations.isEmpty()) {
 if (txMutations.isEmpty()) {
 txMutations = 
Maps.newHashMapWithExpectedSize(mutations.size());
@@ -968,6 +974,8 @@ public class MutationState implements SQLCloseable {
 long mutationCommitTime = 0;
 long numFailedMutations = 0;;
 long startTime = 0;
+long startNumRows = numRows;
+long startEstimatedSize = estimatedSize;
 do {
 TableRef origTableRef = tableInfo.getOrigTableRef();
 PTable table = origTableRef.getTable();
@@ -1005,8 +1013,8 @@ public class MutationState implements SQLCloseable {
 // TODO need to get the the results of batch and 
fail if any exceptions.
 hTable.batch(mutationBatch, null);
 batchCount++;
+if (logger.isDebugEnabled()) logger.debug("Sent 
batch of " + mutationBatch.size() + " for " + Bytes.toString(htableName));
 }
-if (logger.isDebugEnabled()) logger.debug("Sent batch 
of " + numMutations + " for " + Bytes.toString(htableName));
 child.stop();
 child.stop();
 shouldRetry = false;
@@ -1016,6 +1024,8 @@ public class MutationState implements SQLCloseable {
 
 if (tableInfo.isDataTable()) {
 numRows -= numMutations;
+ 

phoenix git commit: PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally

2017-11-15 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.13-HBase-1.3 fab91472d -> 14d833b54


PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally


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

Branch: refs/heads/4.13-HBase-1.3
Commit: 14d833b547385158b9ce64ad0ac6a6085ae0848f
Parents: fab9147
Author: Thomas D'Silva 
Authored: Wed Nov 15 18:54:04 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Nov 15 21:00:08 2017 -0800

--
 .../apache/phoenix/execute/MutationState.java   | 15 -
 .../org/apache/phoenix/util/KeyValueUtil.java   | 65 +---
 2 files changed, 43 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d833b5/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 1f47a33..0cdb010 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -127,6 +127,7 @@ public class MutationState implements SQLCloseable {
 
 private long sizeOffset;
 private int numRows = 0;
+private long estimatedSize = 0;
 private int[] uncommittedStatementIndexes = EMPTY_STATEMENT_INDEX_ARRAY;
 private boolean isExternalTxContext = false;
 private Map> txMutations 
= Collections.emptyMap();
@@ -193,6 +194,7 @@ public class MutationState implements SQLCloseable {
 this.mutations.put(table, mutations);
 }
 this.numRows = mutations.size();
+this.estimatedSize = KeyValueUtil.getEstimatedRowSize(table, 
mutations);
 throwIfTooBig();
 }
 
@@ -354,7 +356,6 @@ public class MutationState implements SQLCloseable {
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED).build()
 .buildException();
 }
-long estimatedSize = KeyValueUtil.getEstimatedRowSize(mutations);
 if (estimatedSize > maxSizeBytes) {
 resetState();
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED)
@@ -433,7 +434,12 @@ public class MutationState implements SQLCloseable {
 
phoenixTransactionContext.join(newMutationState.getPhoenixTransactionContext());
 
 this.sizeOffset += newMutationState.sizeOffset;
+int oldNumRows = this.numRows;
 joinMutationState(newMutationState.mutations, this.mutations);
+// here we increment the estimated size by the fraction of new rows we 
added from the newMutationState 
+if (newMutationState.numRows>0) {
+this.estimatedSize += 
((double)(this.numRows-oldNumRows)/newMutationState.numRows) * 
newMutationState.estimatedSize;
+}
 if (!newMutationState.txMutations.isEmpty()) {
 if (txMutations.isEmpty()) {
 txMutations = 
Maps.newHashMapWithExpectedSize(mutations.size());
@@ -968,6 +974,8 @@ public class MutationState implements SQLCloseable {
 long mutationCommitTime = 0;
 long numFailedMutations = 0;;
 long startTime = 0;
+long startNumRows = numRows;
+long startEstimatedSize = estimatedSize;
 do {
 TableRef origTableRef = tableInfo.getOrigTableRef();
 PTable table = origTableRef.getTable();
@@ -1004,8 +1012,8 @@ public class MutationState implements SQLCloseable {
 for (List mutationBatch : mutationBatchList) 
{
 hTable.batch(mutationBatch);
 batchCount++;
+if (logger.isDebugEnabled()) logger.debug("Sent 
batch of " + mutationBatch.size() + " for " + Bytes.toString(htableName));
 }
-if (logger.isDebugEnabled()) logger.debug("Sent batch 
of " + numMutations + " for " + Bytes.toString(htableName));
 child.stop();
 child.stop();
 shouldRetry = false;
@@ -1015,6 +1023,8 @@ public class MutationState implements SQLCloseable {
 
 if (tableInfo.isDataTable()) {
 numRows -= numMutations;
+// decrement 

phoenix git commit: PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally

2017-11-15 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.13-HBase-0.98 c455886c3 -> 92546891e


PHOENIX-4381 Calculate the estimatedSize of MutationState incrementally


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

Branch: refs/heads/4.13-HBase-0.98
Commit: 92546891e97aa47c17203b8a36a750e0006c3541
Parents: c455886
Author: Thomas D'Silva 
Authored: Wed Nov 15 18:54:04 2017 -0800
Committer: Thomas D'Silva 
Committed: Wed Nov 15 20:59:59 2017 -0800

--
 .../apache/phoenix/execute/MutationState.java   | 15 -
 .../org/apache/phoenix/util/KeyValueUtil.java   | 65 +---
 2 files changed, 43 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/92546891/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 29bd31a..1e5a8ad 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -127,6 +127,7 @@ public class MutationState implements SQLCloseable {
 
 private long sizeOffset;
 private int numRows = 0;
+private long estimatedSize = 0;
 private int[] uncommittedStatementIndexes = EMPTY_STATEMENT_INDEX_ARRAY;
 private boolean isExternalTxContext = false;
 private Map> txMutations 
= Collections.emptyMap();
@@ -194,6 +195,7 @@ public class MutationState implements SQLCloseable {
 this.mutations.put(table, mutations);
 }
 this.numRows = mutations.size();
+this.estimatedSize = KeyValueUtil.getEstimatedRowSize(table, 
mutations);
 throwIfTooBig();
 }
 
@@ -355,7 +357,6 @@ public class MutationState implements SQLCloseable {
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED).build()
 .buildException();
 }
-long estimatedSize = KeyValueUtil.getEstimatedRowSize(mutations);
 if (estimatedSize > maxSizeBytes) {
 resetState();
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED)
@@ -434,7 +435,12 @@ public class MutationState implements SQLCloseable {
 
phoenixTransactionContext.join(newMutationState.getPhoenixTransactionContext());
 
 this.sizeOffset += newMutationState.sizeOffset;
+int oldNumRows = this.numRows;
 joinMutationState(newMutationState.mutations, this.mutations);
+// here we increment the estimated size by the fraction of new rows we 
added from the newMutationState 
+if (newMutationState.numRows>0) {
+this.estimatedSize += 
((double)(this.numRows-oldNumRows)/newMutationState.numRows) * 
newMutationState.estimatedSize;
+}
 if (!newMutationState.txMutations.isEmpty()) {
 if (txMutations.isEmpty()) {
 txMutations = 
Maps.newHashMapWithExpectedSize(mutations.size());
@@ -969,6 +975,8 @@ public class MutationState implements SQLCloseable {
 long mutationCommitTime = 0;
 long numFailedMutations = 0;;
 long startTime = 0;
+long startNumRows = numRows;
+long startEstimatedSize = estimatedSize;
 do {
 TableRef origTableRef = tableInfo.getOrigTableRef();
 PTable table = origTableRef.getTable();
@@ -1005,8 +1013,8 @@ public class MutationState implements SQLCloseable {
 for (List mutationBatch : mutationBatchList) 
{
 hTable.batch(mutationBatch);
 batchCount++;
+if (logger.isDebugEnabled()) logger.debug("Sent 
batch of " + mutationBatch.size() + " for " + Bytes.toString(htableName));
 }
-if (logger.isDebugEnabled()) logger.debug("Sent batch 
of " + numMutations + " for " + Bytes.toString(htableName));
 child.stop();
 child.stop();
 shouldRetry = false;
@@ -1016,6 +1024,8 @@ public class MutationState implements SQLCloseable {
 
 if (tableInfo.isDataTable()) {
 numRows -= numMutations;
+// decrement 

Build failed in Jenkins: Phoenix-4.x-HBase-1.1 #624

2017-11-15 Thread Apache Jenkins Server
See 


Changes:

[jtaylor] PHOENIX-4379 Upgrade code to create CHILD links should only create the

--
[...truncated 112.61 KB...]
[INFO] Running org.apache.phoenix.end2end.ConnectionUtilIT
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 39.953 s 
- in org.apache.phoenix.end2end.ConnectionUtilIT
[INFO] Running org.apache.phoenix.end2end.ContextClassloaderIT
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.687 s 
- in org.apache.phoenix.end2end.ContextClassloaderIT
[INFO] Running org.apache.phoenix.end2end.CountDistinctCompressionIT
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.204 s 
- in org.apache.phoenix.end2end.CountDistinctCompressionIT
[INFO] Running org.apache.phoenix.end2end.CsvBulkLoadToolIT
[WARNING] Tests run: 26, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 
151.862 s - in 
org.apache.phoenix.end2end.ColumnEncodedImmutableNonTxStatsCollectorIT
[WARNING] Tests run: 26, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 
154.538 s - in 
org.apache.phoenix.end2end.ColumnEncodedImmutableTxStatsCollectorIT
[WARNING] Tests run: 26, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 
154.884 s - in org.apache.phoenix.end2end.ColumnEncodedMutableTxStatsCollectorIT
[WARNING] Tests run: 26, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 
157.63 s - in 
org.apache.phoenix.end2end.ColumnEncodedMutableNonTxStatsCollectorIT
[INFO] Running org.apache.phoenix.end2end.DropSchemaIT
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.8 s - 
in org.apache.phoenix.end2end.DropSchemaIT
[INFO] Running org.apache.phoenix.end2end.FlappingLocalIndexIT
[INFO] Running org.apache.phoenix.end2end.IndexToolForPartialBuildIT
[INFO] Running org.apache.phoenix.end2end.IndexScrutinyToolIT
[INFO] Running org.apache.phoenix.end2end.IndexExtendedIT
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 109.824 
s - in org.apache.phoenix.end2end.CsvBulkLoadToolIT
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.039 s 
- in org.apache.phoenix.end2end.IndexToolForPartialBuildIT
[INFO] Running 
org.apache.phoenix.end2end.IndexToolForPartialBuildWithNamespaceEnabledIT
[INFO] Running org.apache.phoenix.end2end.IndexToolIT
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 41.288 s 
- in org.apache.phoenix.end2end.IndexToolForPartialBuildWithNamespaceEnabledIT
[INFO] Running org.apache.phoenix.end2end.MigrateSystemTablesToSystemNamespaceIT
[INFO] Running org.apache.phoenix.end2end.LocalIndexSplitMergeIT
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 69.779 s 
- in org.apache.phoenix.end2end.LocalIndexSplitMergeIT
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 177.87 
s - in org.apache.phoenix.end2end.FlappingLocalIndexIT
[INFO] Tests run: 32, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 180.595 
s - in org.apache.phoenix.end2end.IndexExtendedIT
[INFO] Running 
org.apache.phoenix.end2end.NonColumnEncodedImmutableNonTxStatsCollectorIT
[INFO] Running org.apache.phoenix.end2end.PartialResultServerConfigurationIT
[INFO] Running 
org.apache.phoenix.end2end.NonColumnEncodedImmutableTxStatsCollectorIT
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 46.684 s 
- in org.apache.phoenix.end2end.PartialResultServerConfigurationIT
[INFO] Running org.apache.phoenix.end2end.QueryTimeoutIT
[ERROR] Tests run: 32, Failures: 0, Errors: 16, Skipped: 0, Time elapsed: 
283.969 s <<< FAILURE! - in org.apache.phoenix.end2end.IndexToolIT
[ERROR] testSecondaryIndex[transactional = true , mutable = false , localIndex 
= false, directApi = false, useSnapshot = 
false](org.apache.phoenix.end2end.IndexToolIT)  Time elapsed: 2.029 s  <<< 
ERROR!
java.lang.RuntimeException: org.apache.thrift.TException: Unable to discover 
transaction service.
at 
org.apache.phoenix.end2end.IndexToolIT.testSecondaryIndex(IndexToolIT.java:132)
Caused by: org.apache.thrift.TException: Unable to discover transaction service.
at 
org.apache.phoenix.end2end.IndexToolIT.testSecondaryIndex(IndexToolIT.java:132)

[ERROR] testSecondaryIndex[transactional = true , mutable = false , localIndex 
= false, directApi = false, useSnapshot = 
true](org.apache.phoenix.end2end.IndexToolIT)  Time elapsed: 2.002 s  <<< ERROR!
java.lang.RuntimeException: org.apache.thrift.TException: Unable to discover 
transaction service.
at 
org.apache.phoenix.end2end.IndexToolIT.testSecondaryIndex(IndexToolIT.java:132)
Caused by: org.apache.thrift.TException: Unable to discover transaction service.
at 
org.apache.phoenix.end2end.IndexToolIT.testSecondaryIndex(IndexToolIT.java:132)

[ERROR] testSecondaryIndex[transactional = true , mutable = false , localIndex 
= false, directApi = true, useSnapshot = 

Build failed in Jenkins: Phoenix-4.x-HBase-1.2 #209

2017-11-15 Thread Apache Jenkins Server
See 


Changes:

[jtaylor] Fix version in poms to be HBase-1.2

--
[...truncated 126.90 KB...]
[INFO] Running org.apache.phoenix.end2end.index.IndexMetadataIT
[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 384.98 
s - in org.apache.phoenix.end2end.UpgradeIT
[INFO] Running org.apache.phoenix.end2end.index.IndexUsageIT
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 141.775 
s - in org.apache.phoenix.end2end.index.IndexMaintenanceIT
[INFO] Running org.apache.phoenix.end2end.index.IndexWithTableSchemaChangeIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 338.908 
s - in org.apache.phoenix.end2end.index.GlobalImmutableNonTxIndexIT
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 139.868 
s - in org.apache.phoenix.end2end.index.IndexMetadataIT
[INFO] Running org.apache.phoenix.end2end.index.LocalImmutableTxIndexIT
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 404.339 
s - in org.apache.phoenix.end2end.index.DropColumnIT
[INFO] Running org.apache.phoenix.end2end.index.LocalImmutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalMutableNonTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 351.56 
s - in org.apache.phoenix.end2end.index.GlobalImmutableTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 339.373 
s - in org.apache.phoenix.end2end.index.GlobalMutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalMutableTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.MutableIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 357.655 
s - in org.apache.phoenix.end2end.index.GlobalMutableTxIndexIT
[INFO] Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 245.546 
s - in org.apache.phoenix.end2end.index.IndexWithTableSchemaChangeIT
[INFO] Running org.apache.phoenix.end2end.index.SaltedIndexIT
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 25.156 s 
- in org.apache.phoenix.end2end.index.SaltedIndexIT
[INFO] Running org.apache.phoenix.end2end.index.txn.MutableRollbackIT
[INFO] Running org.apache.phoenix.end2end.index.ViewIndexIT
[INFO] Tests run: 37, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 360.808 
s - in org.apache.phoenix.end2end.index.IndexUsageIT
[INFO] Running org.apache.phoenix.end2end.index.txn.RollbackIT
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 107.868 
s - in org.apache.phoenix.end2end.index.txn.MutableRollbackIT
[INFO] Running org.apache.phoenix.end2end.join.HashJoinCacheIT
[WARNING] Tests run: 12, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 
97.093 s - in org.apache.phoenix.end2end.index.ViewIndexIT
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.561 s 
- in org.apache.phoenix.end2end.join.HashJoinCacheIT
[INFO] Running org.apache.phoenix.end2end.join.HashJoinLocalIndexIT
[INFO] Running org.apache.phoenix.end2end.join.HashJoinGlobalIndexIT
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 78.016 s 
- in org.apache.phoenix.end2end.index.txn.RollbackIT
[INFO] Running org.apache.phoenix.end2end.join.HashJoinMoreIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 449.815 
s - in org.apache.phoenix.end2end.index.LocalImmutableNonTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 480.474 
s - in org.apache.phoenix.end2end.index.LocalImmutableTxIndexIT
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 91.188 s 
- in org.apache.phoenix.end2end.join.HashJoinMoreIT
[INFO] Running org.apache.phoenix.end2end.join.SortMergeJoinLocalIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 459.999 
s - in org.apache.phoenix.end2end.index.LocalMutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.join.HashJoinNoIndexIT
[INFO] Running org.apache.phoenix.end2end.join.SortMergeJoinGlobalIndexIT
[INFO] Running org.apache.phoenix.end2end.join.SortMergeJoinNoIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 476.247 
s - in org.apache.phoenix.end2end.index.LocalMutableTxIndexIT
[INFO] Running org.apache.phoenix.end2end.join.SubqueryIT
[INFO] Tests run: 33, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 332.092 
s - in org.apache.phoenix.end2end.join.HashJoinNoIndexIT
[INFO] Tests run: 64, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 727.104 
s - in org.apache.phoenix.end2end.index.MutableIndexIT
[INFO] Running org.apache.phoenix.end2end.join.SubqueryUsingSortMergeJoinIT
[INFO] Running org.apache.phoenix.end2end.salted.SaltedTableIT
[INFO] Tests run: 34, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 363.052 
s - in org.apache.phoenix.end2end.join.SortMergeJoinNoIndexIT
[INFO] Tests 

Build failed in Jenkins: Phoenix-4.x-HBase-1.1 #623

2017-11-15 Thread Apache Jenkins Server
See 


Changes:

[jtaylor] PHOENIX-4283 fix a coearceByte issue which causes nested group by big

[jtaylor] PHOENIX-4294 Allow scalar function to declare that it's not thread 
safe

[jtaylor] PHOENIX-4295 Fix argument order for StatsCollectorIT derived classes

[jtaylor] Revert "PHOENIX-4198 Remove the need for users to have access to the

[jtaylor] PHOENIX-4242 Fix Indexer post-compact hook logging of NPE and

[jtaylor] PHOENIX-4269 IndexScrutinyToolIT is flapping

[jtaylor] PHOENIX-4280 Delete doesn't work when immutable indexes are in 
building

[jtaylor] PHOENIX-4310 Remove unnecessary casts in

[jtaylor] PHOENIX-4292 Filters on Tables and Views with composite PK of VARCHAR

[jtaylor] PHOENIX-3757 System mutex table not being created in SYSTEM namespace

[jtaylor] PHOENIX-4289 UPDATE STATISTICS command does not collect stats for 
local

[jtaylor] PHOENIX-4277 Treat delete markers consistently with puts for

[jtaylor] PHOENIX-4329 Test IndexScrutinyTool while table is taking writes

[jtaylor] PHOENIX-4322 DESC primary key column with variable length does not 
work

[jtaylor] PHOENIX-4322 DESC primary key column with variable length does not 
work

[jtaylor] Revert "PHOENIX-4322 DESC primary key column with variable length does

[jtaylor] Revert "PHOENIX-4322 DESC primary key column with variable length does

[jtaylor] PHOENIX-4290 Full table scan performed for DELETE with table having

[jtaylor] PHOENIX-4287 Incorrect aggregate query results when stats are disable

[jtaylor] PHOENIX-4333 Test to demonstrate partial stats information for tenant

[jtaylor] PHOENIX-4335 System catalog snapshot created each time a new 
connection

[jtaylor] PHOENIX-4287 Addendum to correctly set useStatsForParallelization

[jtaylor] PHOENIX-4343 In CREATE TABLE allow setting guide post width only on 
base

[jtaylor] PHOENIX-4332 Indexes should inherit guide post width of the base data

[jtaylor] PHOENIX-3460 Namespace separator : should not be allowed in table or

[jtaylor] PHOENIX-4287 Make indexes inherit use stats property from their parent

[jtaylor] PHOENIX-4287 Add null check for parent name

[jtaylor] PHOENIX-4348 Point deletes do not work when there are immutable 
indexes

[jtaylor] PHOENIX-4237 Allow sorting on (Java) collation keys for non-English

[jtaylor] PHOENIX-4349 Update version to 4.13.0

[jtaylor] PHOENIX-4291 Merge release script for mac and linux

[jtaylor] Set version to 4.13.0-HBase-1.3 for release

[jtaylor] PHOENIX-4291 Addendum - Merge release script for mac and linux

[jtaylor] PHOENIX-4351 Add i18n-util to bin LICENSE file and to

[jtaylor] Fix version in poms to be HBase-1.1

--
[...truncated 1.76 MB...]
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 67.142 s 
- in org.apache.phoenix.end2end.index.GlobalIndexOptimizationIT
[INFO] Running org.apache.phoenix.end2end.index.IndexMaintenanceIT
[INFO] Running org.apache.phoenix.end2end.index.GlobalMutableTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 355.098 
s - in org.apache.phoenix.end2end.index.GlobalImmutableNonTxIndexIT
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 148.175 
s - in org.apache.phoenix.end2end.index.IndexMaintenanceIT
[INFO] Running org.apache.phoenix.end2end.index.IndexMetadataIT
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 414.23 
s - in org.apache.phoenix.end2end.index.DropColumnIT
[INFO] Running org.apache.phoenix.end2end.index.IndexUsageIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 377.331 
s - in org.apache.phoenix.end2end.index.GlobalImmutableTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.IndexWithTableSchemaChangeIT
[INFO] Running org.apache.phoenix.end2end.index.LocalImmutableNonTxIndexIT
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 189.471 
s - in org.apache.phoenix.end2end.index.IndexMetadataIT
[INFO] Running org.apache.phoenix.end2end.index.LocalImmutableTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 378.833 
s - in org.apache.phoenix.end2end.index.GlobalMutableNonTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 406 s - 
in org.apache.phoenix.end2end.index.GlobalMutableTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalMutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalMutableTxIndexIT
[INFO] Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 281.974 
s - in org.apache.phoenix.end2end.index.IndexWithTableSchemaChangeIT
[INFO] Running org.apache.phoenix.end2end.index.MutableIndexIT
[INFO] Tests run: 37, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 432.564 
s - in org.apache.phoenix.end2end.index.IndexUsageIT
[INFO] Running org.apache.phoenix.end2end.index.SaltedIndexIT
[INFO] Tests run: 3, Failures: 

Build failed in Jenkins: Phoenix-4.x-HBase-1.2 #208

2017-11-15 Thread Apache Jenkins Server
See 


Changes:

[jtaylor] PHOENIX-4283 fix a coearceByte issue which causes nested group by big

[jtaylor] PHOENIX-4294 Allow scalar function to declare that it's not thread 
safe

[jtaylor] PHOENIX-4295 Fix argument order for StatsCollectorIT derived classes

[jtaylor] Revert "PHOENIX-4198 Remove the need for users to have access to the

[jtaylor] Revert "PHOENIX-4373 Local index variable length key can have trailing

[jtaylor] PHOENIX-4242 Fix Indexer post-compact hook logging of NPE and

[jtaylor] PHOENIX-4269 IndexScrutinyToolIT is flapping

[jtaylor] PHOENIX-4280 Delete doesn't work when immutable indexes are in 
building

[jtaylor] PHOENIX-4310 Remove unnecessary casts in

[jtaylor] PHOENIX-4292 Filters on Tables and Views with composite PK of VARCHAR

[jtaylor] PHOENIX-3757 System mutex table not being created in SYSTEM namespace

[jtaylor] PHOENIX-4289 UPDATE STATISTICS command does not collect stats for 
local

[jtaylor] PHOENIX-4277 Treat delete markers consistently with puts for

[jtaylor] PHOENIX-4329 Test IndexScrutinyTool while table is taking writes

[jtaylor] PHOENIX-4322 DESC primary key column with variable length does not 
work

[jtaylor] PHOENIX-4322 DESC primary key column with variable length does not 
work

[jtaylor] Revert "PHOENIX-4322 DESC primary key column with variable length does

[jtaylor] Revert "PHOENIX-4322 DESC primary key column with variable length does

[jtaylor] PHOENIX-4290 Full table scan performed for DELETE with table having

[jtaylor] PHOENIX-4287 Incorrect aggregate query results when stats are disable

[jtaylor] PHOENIX-4333 Test to demonstrate partial stats information for tenant

[jtaylor] PHOENIX-4335 System catalog snapshot created each time a new 
connection

[jtaylor] PHOENIX-4287 Addendum to correctly set useStatsForParallelization

[jtaylor] PHOENIX-4343 In CREATE TABLE allow setting guide post width only on 
base

[jtaylor] PHOENIX-4332 Indexes should inherit guide post width of the base data

[jtaylor] PHOENIX-3460 Namespace separator : should not be allowed in table or

[jtaylor] PHOENIX-4287 Make indexes inherit use stats property from their parent

[jtaylor] PHOENIX-4287 Add null check for parent name

[jtaylor] PHOENIX-4348 Point deletes do not work when there are immutable 
indexes

[jtaylor] PHOENIX-4237 Allow sorting on (Java) collation keys for non-English

[jtaylor] PHOENIX-4349 Update version to 4.13.0

[jtaylor] PHOENIX-4291 Merge release script for mac and linux

[jtaylor] Set version to 4.13.0-HBase-1.3 for release

[jtaylor] PHOENIX-4291 Addendum - Merge release script for mac and linux

[jtaylor] PHOENIX-4351 Add i18n-util to bin LICENSE file and to

[jtaylor] Remove print outs to stdout from GroupByIT

[jtaylor] PHOENIX-4379 Upgrade code to create CHILD links should only create the

--
[...truncated 103.37 KB...]
[INFO] Running org.apache.phoenix.end2end.index.IndexMetadataIT
[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 405.209 
s - in org.apache.phoenix.end2end.UpgradeIT
[INFO] Running org.apache.phoenix.end2end.index.IndexUsageIT
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 145.078 
s - in org.apache.phoenix.end2end.index.IndexMaintenanceIT
[INFO] Running org.apache.phoenix.end2end.index.IndexWithTableSchemaChangeIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 348.921 
s - in org.apache.phoenix.end2end.index.GlobalImmutableNonTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 360.353 
s - in org.apache.phoenix.end2end.index.GlobalImmutableTxIndexIT
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 140.208 
s - in org.apache.phoenix.end2end.index.IndexMetadataIT
[INFO] Running org.apache.phoenix.end2end.index.LocalMutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalImmutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalImmutableTxIndexIT
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 410.307 
s - in org.apache.phoenix.end2end.index.DropColumnIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 372.176 
s - in org.apache.phoenix.end2end.index.GlobalMutableTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.LocalMutableTxIndexIT
[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 357.345 
s - in org.apache.phoenix.end2end.index.GlobalMutableNonTxIndexIT
[INFO] Running org.apache.phoenix.end2end.index.MutableIndexIT
[INFO] Running org.apache.phoenix.end2end.index.SaltedIndexIT
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.059 s 
- in org.apache.phoenix.end2end.index.SaltedIndexIT
[INFO] Running org.apache.phoenix.end2end.index.ViewIndexIT
[INFO] Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 263.313 
s - in 

phoenix git commit: PHOENIX-4379 Upgrade code to create CHILD links should only create the links for views and not for indexes

2017-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 e47edd86f -> 0a9475457


PHOENIX-4379 Upgrade code to create CHILD links should only create the links 
for views and not for indexes


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 0a94754570b688a3a0004e545e36b18e8eb471b7
Parents: e47edd8
Author: Thomas D'Silva 
Authored: Tue Nov 14 15:28:01 2017 -0800
Committer: James Taylor 
Committed: Wed Nov 15 10:55:05 2017 -0800

--
 .../org/apache/phoenix/end2end/UpgradeIT.java   | 73 
 .../org/apache/phoenix/util/UpgradeUtil.java|  1 +
 2 files changed, 74 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0a947545/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 4cb4642..b71dd7c 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
@@ -39,12 +39,14 @@ import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Properties;
+import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.FutureTask;
 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;
@@ -67,6 +69,7 @@ import org.apache.phoenix.schema.PMetaData;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PNameFactory;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.LinkType;
 import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
@@ -838,4 +841,74 @@ public class UpgradeIT extends ParallelStatsDisabledIT {
 return DriverManager.getConnection(getUrl());
 }
 
+@Test
+public void testAddParentChildLinks() throws Exception {
+String schema = "S_" + generateUniqueName();
+String table1 = "T_" + generateUniqueName();
+String table2 = "T_" + generateUniqueName();
+String tableName = SchemaUtil.getTableName(schema, table1);
+String multiTenantTableName = SchemaUtil.getTableName(schema, table2);
+String viewName1 = "VIEW_" + generateUniqueName();
+String viewIndexName1 = "VIDX_" + generateUniqueName();
+String viewName2 = "VIEW_" + generateUniqueName();
+String viewIndexName2 = "VIDX_" + generateUniqueName();
+try (Connection conn = getConnection(false, null);
+Connection tenantConn = getConnection(true, "tenant1");
+Connection metaConn = getConnection(false, null)) {
+// create a non multi-tenant and multi-tenant table
+conn.createStatement()
+.execute("CREATE TABLE IF NOT EXISTS " + tableName + " ("
++ " TENANT_ID CHAR(15) NOT NULL, " + " PK1 integer 
NOT NULL, "
++ "PK2 bigint NOT NULL, " + "V1 VARCHAR, " + "V2 
VARCHAR "
++ " CONSTRAINT NAME_PK PRIMARY KEY (TENANT_ID, 
PK1, PK2))");
+conn.createStatement()
+.execute("CREATE TABLE IF NOT EXISTS " + 
multiTenantTableName + " ("
++ " TENANT_ID CHAR(15) NOT NULL, " + " PK1 integer 
NOT NULL, "
++ "PK2 bigint NOT NULL, " + "V1 VARCHAR, " + "V2 
VARCHAR "
++ " CONSTRAINT NAME_PK PRIMARY KEY (TENANT_ID, 
PK1, PK2)"
++ " ) MULTI_TENANT= true");
+// create tenant and global view
+conn.createStatement().execute(
+"CREATE VIEW " + viewName1 + " (col VARCHAR) AS SELECT * FROM 
" + tableName);
+tenantConn.createStatement().execute("CREATE VIEW " + viewName2
++ "(col VARCHAR) AS SELECT * FROM " + 
multiTenantTableName);
+// create index on the above views
+conn.createStatement()
+.execute("create index " + viewIndexName1 + "  on " + 
viewName1 + "(col)");
+

phoenix git commit: Fix version in poms to be HBase-1.2

2017-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 a3bebbeb5 -> 9dab525f9


Fix version in poms to be HBase-1.2


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 9dab525f9ff102808d15cce319b140bfc68ec6cc
Parents: a3bebbe
Author: James Taylor 
Authored: Wed Nov 15 10:53:31 2017 -0800
Committer: James Taylor 
Committed: Wed Nov 15 10:53:31 2017 -0800

--
 phoenix-assembly/pom.xml   | 2 +-
 phoenix-client/pom.xml | 2 +-
 phoenix-core/pom.xml   | 2 +-
 phoenix-flume/pom.xml  | 2 +-
 phoenix-hive/pom.xml   | 2 +-
 phoenix-kafka/pom.xml  | 2 +-
 phoenix-load-balancer/pom.xml  | 2 +-
 phoenix-pherf/pom.xml  | 2 +-
 phoenix-pig/pom.xml| 2 +-
 phoenix-queryserver-client/pom.xml | 2 +-
 phoenix-queryserver/pom.xml| 2 +-
 phoenix-server/pom.xml | 2 +-
 phoenix-spark/pom.xml  | 2 +-
 phoenix-tracing-webapp/pom.xml | 2 +-
 pom.xml| 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 8ec4ebb..e9e9f02 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.2
   
   phoenix-assembly
   Phoenix Assembly

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-client/pom.xml
--
diff --git a/phoenix-client/pom.xml b/phoenix-client/pom.xml
index 77df4ca..d64d3dc 100644
--- a/phoenix-client/pom.xml
+++ b/phoenix-client/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.2
   
   phoenix-client
   Phoenix Client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 93fc70b..1344511 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -4,7 +4,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.2
   
   phoenix-core
   Phoenix Core

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index bd1cd7e..951b444 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -26,7 +26,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.2
   
   phoenix-flume
   Phoenix - Flume

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-hive/pom.xml
--
diff --git a/phoenix-hive/pom.xml b/phoenix-hive/pom.xml
index a2531e0..61dcca4 100644
--- a/phoenix-hive/pom.xml
+++ b/phoenix-hive/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.2
   
   phoenix-hive
   Phoenix - Hive

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-kafka/pom.xml
--
diff --git a/phoenix-kafka/pom.xml b/phoenix-kafka/pom.xml
index 610bb01..e573cd6 100644
--- a/phoenix-kafka/pom.xml
+++ b/phoenix-kafka/pom.xml
@@ -26,7 +26,7 @@

org.apache.phoenix
phoenix
-   4.13.0-HBase-1.3
+   4.13.0-HBase-1.2

phoenix-kafka
Phoenix - Kafka

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-load-balancer/pom.xml
--
diff --git a/phoenix-load-balancer/pom.xml b/phoenix-load-balancer/pom.xml
index 7b819e1..a164ebd 100644
--- a/phoenix-load-balancer/pom.xml
+++ b/phoenix-load-balancer/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.2
   
   phoenix-load-balancer
   Phoenix Load Balancer

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dab525f/phoenix-pherf/pom.xml
--
diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml
index edd9a27..1da6179 100644
--- 

phoenix git commit: Fix version in poms to be HBase-1.1

2017-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 d200b5165 -> e47edd86f


Fix version in poms to be HBase-1.1


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e47edd86f6a561150a0a8abaf6d98e7381911c54
Parents: d200b51
Author: James Taylor 
Authored: Wed Nov 15 10:50:37 2017 -0800
Committer: James Taylor 
Committed: Wed Nov 15 10:50:37 2017 -0800

--
 phoenix-assembly/pom.xml   | 2 +-
 phoenix-client/pom.xml | 2 +-
 phoenix-core/pom.xml   | 2 +-
 phoenix-flume/pom.xml  | 2 +-
 phoenix-hive/pom.xml   | 2 +-
 phoenix-kafka/pom.xml  | 2 +-
 phoenix-load-balancer/pom.xml  | 2 +-
 phoenix-pherf/pom.xml  | 2 +-
 phoenix-pig/pom.xml| 2 +-
 phoenix-queryserver-client/pom.xml | 2 +-
 phoenix-queryserver/pom.xml| 2 +-
 phoenix-server/pom.xml | 2 +-
 phoenix-spark/pom.xml  | 2 +-
 phoenix-tracing-webapp/pom.xml | 2 +-
 pom.xml| 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 8ec4ebb..8ea129e 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.1
   
   phoenix-assembly
   Phoenix Assembly

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-client/pom.xml
--
diff --git a/phoenix-client/pom.xml b/phoenix-client/pom.xml
index 77df4ca..999ee5b 100644
--- a/phoenix-client/pom.xml
+++ b/phoenix-client/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.1
   
   phoenix-client
   Phoenix Client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 93fc70b..5bf8c75 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -4,7 +4,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.1
   
   phoenix-core
   Phoenix Core

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index bd1cd7e..feec767 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -26,7 +26,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.1
   
   phoenix-flume
   Phoenix - Flume

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-hive/pom.xml
--
diff --git a/phoenix-hive/pom.xml b/phoenix-hive/pom.xml
index a2531e0..47bc08e 100644
--- a/phoenix-hive/pom.xml
+++ b/phoenix-hive/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.1
   
   phoenix-hive
   Phoenix - Hive

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-kafka/pom.xml
--
diff --git a/phoenix-kafka/pom.xml b/phoenix-kafka/pom.xml
index 610bb01..089f7ae 100644
--- a/phoenix-kafka/pom.xml
+++ b/phoenix-kafka/pom.xml
@@ -26,7 +26,7 @@

org.apache.phoenix
phoenix
-   4.13.0-HBase-1.3
+   4.13.0-HBase-1.1

phoenix-kafka
Phoenix - Kafka

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-load-balancer/pom.xml
--
diff --git a/phoenix-load-balancer/pom.xml b/phoenix-load-balancer/pom.xml
index 7b819e1..a040a4f 100644
--- a/phoenix-load-balancer/pom.xml
+++ b/phoenix-load-balancer/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-HBase-1.3
+4.13.0-HBase-1.1
   
   phoenix-load-balancer
   Phoenix Load Balancer

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e47edd86/phoenix-pherf/pom.xml
--
diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml
index edd9a27..baa415b 100644
--- 

[23/37] phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables

2017-11-15 Thread jamestaylor
PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data 
tables


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 21606e5e33c5b5aec448ca269bf1d3617a269049
Parents: 637b24f
Author: Samarth Jain 
Authored: Wed Nov 1 23:21:01 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:40 2017 -0800

--
 .../apache/phoenix/end2end/CreateTableIT.java   | 73 
 .../end2end/ExplainPlanWithStatsEnabledIT.java  |  2 +-
 .../phoenix/exception/SQLExceptionCode.java |  2 +-
 .../apache/phoenix/schema/MetaDataClient.java   |  7 ++
 4 files changed, 82 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/21606e5e/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
index 93bb02b..1abc653 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -35,6 +36,7 @@ import java.util.Properties;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import 
org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder;
 import org.apache.hadoop.hbase.regionserver.BloomType;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT 
{
 }
 conn2.close();
 }
+
+@Test
+public void testSettingGuidePostWidth() throws Exception {
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+String dataTable = generateUniqueName();
+int guidePostWidth = 20;
+String ddl =
+"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a 
bigint, b bigint)"
++ " GUIDE_POSTS_WIDTH=" + guidePostWidth;
+conn.createStatement().execute(ddl);
+assertEquals(20, checkGuidePostWidth(dataTable));
+String viewName = "V_" + generateUniqueName();
+ddl =
+"CREATE VIEW " + viewName + " AS SELECT * FROM " + 
dataTable
++ " GUIDE_POSTS_WIDTH=" + guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+
assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(),
+e.getErrorCode());
+}
+
+// let the view creation go through
+ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable;
+conn.createStatement().execute(ddl);
+
+String globalIndex = "GI_" + generateUniqueName();
+ddl =
+"CREATE INDEX " + globalIndex + " ON " + dataTable
++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + 
guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+
assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(),
+e.getErrorCode());
+}
+String localIndex = "LI_" + generateUniqueName();
+ddl =
+"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable
++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + 
guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+
assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(),
+e.getErrorCode());
+}
+String viewIndex = "VI_" + generateUniqueName();
+ddl =
+"CREATE LOCAL INDEX " + viewIndex + " ON " + dataTable
++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + 
guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+ 

[35/37] phoenix git commit: Set version to 4.13.0-HBase-1.3 for release

2017-11-15 Thread jamestaylor
Set version to 4.13.0-HBase-1.3 for release


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 47e7c60ebb158a231d614e7088e20a44da413e56
Parents: 8947624
Author: Mujtaba 
Authored: Fri Nov 3 11:59:25 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:42 2017 -0800

--
 phoenix-assembly/pom.xml   | 2 +-
 phoenix-client/pom.xml | 2 +-
 phoenix-core/pom.xml   | 2 +-
 phoenix-flume/pom.xml  | 2 +-
 phoenix-hive/pom.xml   | 2 +-
 phoenix-kafka/pom.xml  | 2 +-
 phoenix-load-balancer/pom.xml  | 2 +-
 phoenix-pherf/pom.xml  | 2 +-
 phoenix-pig/pom.xml| 2 +-
 phoenix-queryserver-client/pom.xml | 2 +-
 phoenix-queryserver/pom.xml| 2 +-
 phoenix-server/pom.xml | 2 +-
 phoenix-spark/pom.xml  | 2 +-
 phoenix-tracing-webapp/pom.xml | 2 +-
 pom.xml| 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index ae28514..8ec4ebb 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-SNAPSHOT
+4.13.0-HBase-1.3
   
   phoenix-assembly
   Phoenix Assembly

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-client/pom.xml
--
diff --git a/phoenix-client/pom.xml b/phoenix-client/pom.xml
index 648c452..77df4ca 100644
--- a/phoenix-client/pom.xml
+++ b/phoenix-client/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-SNAPSHOT
+4.13.0-HBase-1.3
   
   phoenix-client
   Phoenix Client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index f82cddc..0bdcc07 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -4,7 +4,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-SNAPSHOT
+4.13.0-HBase-1.3
   
   phoenix-core
   Phoenix Core

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index 63df1af..bd1cd7e 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -26,7 +26,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-SNAPSHOT
+4.13.0-HBase-1.3
   
   phoenix-flume
   Phoenix - Flume

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-hive/pom.xml
--
diff --git a/phoenix-hive/pom.xml b/phoenix-hive/pom.xml
index b0fd817..a2531e0 100644
--- a/phoenix-hive/pom.xml
+++ b/phoenix-hive/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-SNAPSHOT
+4.13.0-HBase-1.3
   
   phoenix-hive
   Phoenix - Hive

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-kafka/pom.xml
--
diff --git a/phoenix-kafka/pom.xml b/phoenix-kafka/pom.xml
index 47da23c..610bb01 100644
--- a/phoenix-kafka/pom.xml
+++ b/phoenix-kafka/pom.xml
@@ -26,7 +26,7 @@

org.apache.phoenix
phoenix
-   4.13.0-SNAPSHOT
+   4.13.0-HBase-1.3

phoenix-kafka
Phoenix - Kafka

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-load-balancer/pom.xml
--
diff --git a/phoenix-load-balancer/pom.xml b/phoenix-load-balancer/pom.xml
index b682140..7b819e1 100644
--- a/phoenix-load-balancer/pom.xml
+++ b/phoenix-load-balancer/pom.xml
@@ -27,7 +27,7 @@
   
 org.apache.phoenix
 phoenix
-4.13.0-SNAPSHOT
+4.13.0-HBase-1.3
   
   phoenix-load-balancer
   Phoenix Load Balancer

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47e7c60e/phoenix-pherf/pom.xml
--
diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml
index 8368c45..edd9a27 100644
--- a/phoenix-pherf/pom.xml
+++ b/phoenix-pherf/pom.xml
@@ -15,7 +15,7 @@


[16/37] phoenix git commit: PHOENIX-4329 Test IndexScrutinyTool while table is taking writes (Vincent Poon)

2017-11-15 Thread jamestaylor
PHOENIX-4329 Test IndexScrutinyTool while table is taking writes (Vincent Poon)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e319ff02e2d135c526b7334a65bfe1628c0dd220
Parents: 7c21a83
Author: James Taylor 
Authored: Sun Oct 29 15:20:23 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:39 2017 -0800

--
 .../phoenix/end2end/IndexScrutinyToolIT.java| 101 ++-
 1 file changed, 96 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e319ff02/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
index 10595a7..cbce7b2 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
@@ -36,6 +36,9 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.TreeSet;
 import java.util.UUID;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 import com.google.common.collect.Sets;
 import org.apache.commons.io.IOUtils;
@@ -43,6 +46,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.mapreduce.Counters;
 import org.apache.hadoop.mapreduce.Job;
@@ -103,6 +107,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 private PreparedStatement indexTableUpsertStmt;
 
 private long testTime;
+private Properties props;
 
 @Parameterized.Parameters
 public static Collection data() {
@@ -120,8 +125,11 @@ public class IndexScrutinyToolIT extends BaseTest {
 
 @BeforeClass
 public static void doSetup() throws Exception {
-Map props = Maps.newHashMap();
-setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+Map serverProps = Maps.newHashMap();
+//disable major compactions
+serverProps.put(HConstants.MAJOR_COMPACTION_PERIOD, "0");
+Map clientProps = Maps.newHashMap();
+setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
 }
 
 /**
@@ -133,7 +141,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 createTestTable(getUrl(), String.format(dataTableDdl, 
dataTableFullName));
 createTestTable(getUrl(),
 String.format(indexTableDdl, indexTableName, dataTableFullName));
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 conn = DriverManager.getConnection(getUrl(), props);
 String dataTableUpsert = String.format(UPSERT_SQL, dataTableFullName);
 dataTableUpsertStmt = conn.prepareStatement(dataTableUpsert);
@@ -141,6 +149,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 indexTableUpsertStmt = conn.prepareStatement(indexTableUpsert);
 conn.setAutoCommit(false);
 testTime = EnvironmentEdgeManager.currentTimeMillis() - 1000;
+
 }
 
 @After
@@ -177,6 +186,77 @@ public class IndexScrutinyToolIT extends BaseTest {
 }
 
 /**
+ * Tests running a scrutiny while updates and deletes are happening.
+ * Since CURRENT_SCN is set, the scrutiny shouldn't report any issue.
+ */
+@Test
+public void testScrutinyWhileTakingWrites() throws Exception {
+int id = 0;
+while (id < 1000) {
+int index = 1;
+dataTableUpsertStmt.setInt(index++, id);
+dataTableUpsertStmt.setString(index++, "name-" + id);
+dataTableUpsertStmt.setInt(index++, id);
+dataTableUpsertStmt.setTimestamp(index++, new Timestamp(testTime));
+dataTableUpsertStmt.executeUpdate();
+id++;
+}
+conn.commit();
+
+//CURRENT_SCN for scrutiny
+long scrutinyTS = EnvironmentEdgeManager.currentTimeMillis();
+
+// launch background upserts and deletes
+final Random random = new Random(0);
+Runnable 

[26/37] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table

2017-11-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/730f9588/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
index daf7c70..788e2dd 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
@@ -18,6 +18,8 @@
 package org.apache.phoenix.schema.stats;
 
 import java.io.IOException;
+import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -45,15 +47,22 @@ import 
org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.schema.PName;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.IndexType;
+import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PLong;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.MetaDataUtil;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Maps;
 
 /**
@@ -75,6 +84,7 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 private ImmutableBytesWritable currentRow;
 private final long clientTimeStamp;
 private final String tableName;
+private final boolean isViewIndexTable;
 
 DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String 
tableName, long clientTimeStamp, byte[] family,
 byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws 
IOException {
@@ -95,6 +105,9 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 // since there's no row representing those in SYSTEM.CATALOG.
 if (MetaDataUtil.isViewIndex(tableName)) {
 pName = MetaDataUtil.getViewIndexUserTableName(tableName);
+isViewIndexTable = true;
+} else {
+isViewIndexTable = false;
 }
 ptableKey = SchemaUtil.getTableKeyFromFullName(pName);
 this.clientTimeStamp = clientTimeStamp;
@@ -109,7 +122,7 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 }
 }
 
-private void initGuidepostDepth() throws IOException {
+private void initGuidepostDepth() throws IOException, 
ClassNotFoundException, SQLException {
 // First check is if guidepost info set on statement itself
 if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) {
 int guidepostPerRegion = 0;
@@ -135,6 +148,38 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 if (!result.isEmpty()) {
 Cell cell = result.listCells().get(0);
 guidepostWidth = 
PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), 
cell.getValueOffset(), SortOrder.getDefault());
+} else if (!isViewIndexTable) {
+/*
+ * The table we are collecting stats for is potentially a 
base table, or local
+ * index or a global index. For view indexes, we rely on 
the the guide post
+ * width column in the parent data table's metadata which 
we already tried
+ * retrieving above.
+ */
+try (Connection conn =
+
QueryUtil.getConnectionOnServer(env.getConfiguration())) {
+PTable table = PhoenixRuntime.getTable(conn, 
tableName);
+if (table.getType() == PTableType.INDEX
+&& table.getIndexType() == IndexType.GLOBAL) {
+/*
+ * For global indexes, we need to get the 
parentName first and then
+ * fetch guide post width configured for the 
parent table.
+ */
+PName parentName = table.getParentName();
+byte[] parentKey =
+
SchemaUtil.getTableKeyFromFullName(parentName.getString());
+get = new Get(parentKey);
+

[19/37] phoenix git commit: PHOENIX-4290 Full table scan performed for DELETE with table having immutable indexes

2017-11-15 Thread jamestaylor
PHOENIX-4290 Full table scan performed for DELETE with table having immutable 
indexes


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e0df4b2e6c2f386336f660301a093e295f489ec4
Parents: 969b79c
Author: James Taylor 
Authored: Mon Oct 30 19:25:53 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:39 2017 -0800

--
 .../org/apache/phoenix/end2end/DeleteIT.java| 134 ++-
 .../phoenix/end2end/index/ImmutableIndexIT.java |  22 +-
 .../end2end/index/IndexMaintenanceIT.java   |  18 +-
 .../org/apache/phoenix/tx/TxCheckpointIT.java   |  18 +-
 .../apache/phoenix/compile/DeleteCompiler.java  | 849 ++-
 .../apache/phoenix/compile/FromCompiler.java|  49 +-
 .../compile/TupleProjectionCompiler.java|   2 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 -
 .../apache/phoenix/execute/MutationState.java   |   4 +-
 .../apache/phoenix/index/IndexMaintainer.java   |  35 +-
 .../apache/phoenix/optimize/QueryOptimizer.java |   2 +-
 .../org/apache/phoenix/schema/PTableImpl.java   |  10 +
 .../java/org/apache/phoenix/util/IndexUtil.java |  18 +-
 .../phoenix/compile/QueryCompilerTest.java  |  27 -
 14 files changed, 643 insertions(+), 546 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e0df4b2e/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
index 09e1021..aa4d36e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
@@ -19,7 +19,6 @@ package org.apache.phoenix.end2end;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.sql.Date;
@@ -33,7 +32,10 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
 
 
@@ -136,18 +138,25 @@ public class DeleteIT extends ParallelStatsDisabledIT {
 rs.close();
 }
 
-private static void assertIndexUsed (Connection conn, String query, String 
indexName, boolean expectedToBeUsed) throws SQLException {
-assertIndexUsed(conn, query, Collections.emptyList(), indexName, 
expectedToBeUsed);
+private static void assertIndexUsed (Connection conn, String query, String 
indexName, boolean expectedToBeUsed, boolean local) throws SQLException {
+assertIndexUsed(conn, query, Collections.emptyList(), indexName, 
expectedToBeUsed, local);
 }
 
-private static void assertIndexUsed (Connection conn, String query, 
List binds, String indexName, boolean expectedToBeUsed) throws 
SQLException {
+private static void assertIndexUsed (Connection conn, String query, 
List binds, String indexName, boolean expectedToBeUsed, boolean local) 
throws SQLException {
 PreparedStatement stmt = conn.prepareStatement("EXPLAIN " + query);
 for (int i = 0; i < binds.size(); i++) {
 stmt.setObject(i+1, binds.get(i));
 }
 ResultSet rs = stmt.executeQuery();
 String explainPlan = QueryUtil.getExplainPlan(rs);
-assertEquals(expectedToBeUsed, explainPlan.contains(" SCAN OVER " 
+ indexName));
+// It's very difficult currently to check if a local index is 
being used
+// This check is brittle as it checks that the index ID appears in 
the range scan
+// TODO: surface QueryPlan from MutationPlan
+if (local) {
+assertEquals(expectedToBeUsed, explainPlan.contains(indexName 
+ " [1]") || explainPlan.contains(indexName + " [1,"));
+} else {
+assertEquals(expectedToBeUsed, explainPlan.contains(" SCAN 
OVER " + indexName));
+}
}
 
 private void testDeleteRange(boolean autoCommit, boolean createIndex) 
throws Exception {
@@ -190,9 +199,7 @@ public class DeleteIT extends ParallelStatsDisabledIT {
 PreparedStatement stmt;
 conn.setAutoCommit(autoCommit);
 deleteStmt = "DELETE FROM " + tableName + " WHERE i >= ? and i < ?";
-if(!local) {
-assertIndexUsed(conn, 

[37/37] phoenix git commit: PHOENIX-4351 Add i18n-util to bin LICENSE file and to dependencyManagement

2017-11-15 Thread jamestaylor
PHOENIX-4351 Add i18n-util to bin LICENSE file and to dependencyManagement


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

Branch: refs/heads/4.x-HBase-1.1
Commit: d200b51658b028950b0768df85521f79aeb6a951
Parents: b115f9b
Author: Josh Elser 
Authored: Mon Nov 6 15:21:35 2017 -0500
Committer: James Taylor 
Committed: Wed Nov 15 10:46:42 2017 -0800

--
 dev/release_files/LICENSE | 2 ++
 phoenix-core/pom.xml  | 3 +--
 pom.xml   | 5 +
 3 files changed, 8 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d200b516/dev/release_files/LICENSE
--
diff --git a/dev/release_files/LICENSE b/dev/release_files/LICENSE
index a72ce86..0fd0255 100644
--- a/dev/release_files/LICENSE
+++ b/dev/release_files/LICENSE
@@ -254,6 +254,8 @@ Janino Compiler (https://github.com/janino-compiler/janino)
 
 Hamcrest-core 1.3 (http://www.hamcrest.org) Copyright (c) 2000-2006, 
www.hamcrest.org
 
+i18n-util 1.0.1 (https://github.com/salesforce/i18n-util) Copyright (c) 2017, 
Salesforce.com, Inc. All rights reserved.
+
 ---
 
 This product bundles the following products which are licensed with

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d200b516/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 0bdcc07..93fc70b 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -471,10 +471,9 @@
   stream
   ${stream.version}
 
- 
+
   com.salesforce.i18n
   i18n-util
-  1.0.1
 
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d200b516/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 933e710..48bfa16 100644
--- a/pom.xml
+++ b/pom.xml
@@ -927,6 +927,11 @@
 stream
 ${stream.version}
   
+  
+com.salesforce.i18n
+i18n-util
+1.0.1
+  
 
   
 



[01/37] phoenix git commit: PHOENIX-4283 fix a coearceByte issue which causes nested group by big int incorrect

2017-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 7a4a974d3 -> d200b5165


PHOENIX-4283 fix a coearceByte issue which causes nested group by big int 
incorrect

Signed-off-by: aertoria 


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 7d2c1edd66cf7fb2df17a13884bb6b5e4acdbe48
Parents: 7a4a974
Author: aertoria 
Authored: Sun Oct 15 18:36:44 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:38:41 2017 -0800

--
 .../org/apache/phoenix/end2end/AggregateIT.java | 21 +++-
 .../org/apache/phoenix/schema/types/PLong.java  |  3 ++-
 2 files changed, 22 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d2c1edd/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 67a468a..3d0e590 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
@@ -936,7 +936,26 @@ public class AggregateIT extends ParallelStatsDisabledIT {
 public void testCountNullInNonEncodedNonEmptyKeyValueCF() throws Exception 
{
 testCountNullInNonEmptyKeyValueCF(0);
 }
-
+
+@Test
+public void testNestedGroupedAggregationWithBigInt() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+String tableName = generateUniqueName();
+try(Connection conn = DriverManager.getConnection(getUrl(), props);) {
+String createQuery="CREATE TABLE "+tableName+" (a BIGINT NOT 
NULL,c BIGINT NOT NULL CONSTRAINT PK PRIMARY KEY (a, c))";
+String updateQuery="UPSERT INTO "+tableName+"(a,c) 
VALUES(444, 555)";
+String query="SELECT a FROM (SELECT a, c FROM "+tableName+" GROUP 
BY a, c) GROUP BY a, c";
+conn.prepareStatement(createQuery).execute();
+conn.prepareStatement(updateQuery).execute();
+conn.commit();
+PreparedStatement statement = conn.prepareStatement(query);
+ResultSet rs = statement.executeQuery();
+assertTrue(rs.next());
+assertEquals(444L,rs.getLong(1));
+assertFalse(rs.next());
+}
+}
+
 private void testCountNullInNonEmptyKeyValueCF(int columnEncodedBytes) 
throws Exception {
 try (Connection conn = DriverManager.getConnection(getUrl())) {
 //Type is INT

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d2c1edd/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java
index 0402c6e..acd16c5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java
@@ -133,8 +133,9 @@ public class PLong extends PWholeNumber {
 public void coerceBytes(ImmutableBytesWritable ptr, Object object, 
PDataType actualType,
 Integer maxLength, Integer scale, SortOrder actualModifier, 
Integer desiredMaxLength, Integer desiredScale,
 SortOrder expectedModifier) {
+
 // Decrease size of TIMESTAMP to size of LONG and continue coerce
-if (ptr.getLength() > getByteSize()) {
+if (ptr.getLength() > getByteSize() && 
actualType.isCoercibleTo(PTimestamp.INSTANCE)) {
 ptr.set(ptr.get(), ptr.getOffset(), getByteSize());
 }
 super.coerceBytes(ptr, object, actualType, maxLength, scale, 
actualModifier, desiredMaxLength,



[30/37] phoenix git commit: PHOENIX-4237 Allow sorting on (Java) collation keys for non-English locales (Shehzaad Nakhoda)

2017-11-15 Thread jamestaylor
PHOENIX-4237 Allow sorting on (Java) collation keys for non-English locales 
(Shehzaad Nakhoda)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 81019c644a1085f81ab1f84af46e411660320171
Parents: 5820ff4
Author: James Taylor 
Authored: Fri Nov 3 09:17:29 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:41 2017 -0800

--
 LICENSE |  43 ++--
 phoenix-core/pom.xml|   5 +
 .../phoenix/end2end/CollationKeyFunctionIT.java | 181 ++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../function/CollationKeyFunction.java  | 199 +++
 .../apache/phoenix/jdbc/PhoenixConnection.java  |   3 +
 .../apache/phoenix/util/VarBinaryFormatter.java |  52 
 .../function/CollationKeyFunctionTest.java  | 243 +++
 phoenix-server/pom.xml  |   1 +
 9 files changed, 713 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/81019c64/LICENSE
--
diff --git a/LICENSE b/LICENSE
index 08e5e10..7bd8ad1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -236,23 +236,32 @@ Font Awesome fonts (http://fontawesome.io/)
 
 3-Clause BSD License:
 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ---
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/81019c64/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 6f3adb4..f82cddc 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -471,5 +471,10 @@
   stream
   ${stream.version}
 
+ 
+  com.salesforce.i18n
+  i18n-util
+  1.0.1
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/81019c64/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 

[02/37] phoenix git commit: PHOENIX-4294 Allow scalar function to declare that it's not thread safe

2017-11-15 Thread jamestaylor
PHOENIX-4294 Allow scalar function to declare that it's not thread safe


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e2351ef4a23ef63747fede4b80859d7b2f7f34f4
Parents: 7d2c1ed
Author: James Taylor 
Authored: Wed Oct 18 09:28:31 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:39:19 2017 -0800

--
 .../apache/phoenix/expression/function/ScalarFunction.java  | 9 +
 .../phoenix/expression/visitor/CloneExpressionVisitor.java  | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e2351ef4/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
index 4f44cde..2a5fe44 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
@@ -87,4 +87,13 @@ public abstract class ScalarFunction extends 
FunctionExpression {
 public KeyPart newKeyPart(KeyPart childPart) {
 return null;
 }
+
+/**
+ * Used to determine if the same ScalarFunction instance may be
+ * used by multiple threads. 
+ * @return true if function is thread safe and false otherwise.
+ */
+public boolean isThreadSafe() {
+return true;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e2351ef4/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
index e47fb64..c6d7c9e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
@@ -110,7 +110,7 @@ public abstract class CloneExpressionVisitor extends 
TraverseAllExpressionVisito
 
 @Override
 public Expression visitLeave(ScalarFunction node, List l) {
-return isCloneNode(node, l) ? node.clone(l) : node;
+return isCloneNode(node, l) || !node.isThreadSafe() ? node.clone(l) : 
node;
 }
 
 public Expression visitLeave(UDFExpression node, List l) {



[33/37] phoenix git commit: PHOENIX-4287 Add null check for parent name

2017-11-15 Thread jamestaylor
PHOENIX-4287 Add null check for parent name


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

Branch: refs/heads/4.x-HBase-1.1
Commit: a50aab0063dbbb95d7e21922871aaac18fdc90e1
Parents: f974679
Author: Samarth Jain 
Authored: Thu Nov 2 17:52:32 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:41 2017 -0800

--
 .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a50aab00/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 18f28e2..eb09813 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -1246,9 +1246,10 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
 }
 /*
  * For a view index, we use the property set on view. For indexes on 
base table, whether
- * global or local, we use the property set on the base table.
+ * global or local, we use the property set on the base table. Null 
check needed when
+ * dropping local indexes.
  */
-if (table.getType() == PTableType.INDEX) {
+if (table.getType() == PTableType.INDEX && table.getParentName() != 
null) {
 PhoenixConnection conn = context.getConnection();
 String parentTableName = table.getParentName().getString();
 try {



[27/37] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table

2017-11-15 Thread jamestaylor
PHOENIX-4332 Indexes should inherit guide post width of the base data table


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 730f958846475bd3b8996cdb6d31bc5342e0e2eb
Parents: 21606e5
Author: Samarth Jain 
Authored: Wed Nov 1 23:24:52 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:40 2017 -0800

--
 ...mnEncodedImmutableNonTxStatsCollectorIT.java |   1 +
 ...olumnEncodedImmutableTxStatsCollectorIT.java |   1 +
 ...lumnEncodedMutableNonTxStatsCollectorIT.java |   1 +
 .../ColumnEncodedMutableTxStatsCollectorIT.java |   1 +
 ...mnEncodedImmutableNonTxStatsCollectorIT.java |   1 +
 ...olumnEncodedImmutableTxStatsCollectorIT.java |   1 +
 .../phoenix/end2end/StatsCollectorIT.java   | 734 
 ...SysTableNamespaceMappedStatsCollectorIT.java |   1 +
 .../phoenix/schema/stats/StatsCollectorIT.java  | 832 +++
 .../stats/DefaultStatisticsCollector.java   |  58 +-
 10 files changed, 895 insertions(+), 736 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/730f9588/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
index d5d8442..eb01e89 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.end2end;
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.phoenix.schema.stats.StatsCollectorIT;
 import org.junit.runners.Parameterized.Parameters;
 
 public class ColumnEncodedImmutableNonTxStatsCollectorIT extends 
StatsCollectorIT {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/730f9588/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
index 23b1654..4e90d70 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.end2end;
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.phoenix.schema.stats.StatsCollectorIT;
 import org.junit.runners.Parameterized.Parameters;
 
 public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT 
{

http://git-wip-us.apache.org/repos/asf/phoenix/blob/730f9588/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
index 24869a2..2a560db 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.end2end;
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.phoenix.schema.stats.StatsCollectorIT;
 import org.junit.runners.Parameterized.Parameters;
 
 public class ColumnEncodedMutableNonTxStatsCollectorIT extends 
StatsCollectorIT {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/730f9588/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
index eea591d..01fa2b5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
+++ 

[09/37] phoenix git commit: PHOENIX-4242 Fix Indexer post-compact hook logging of NPE and TableNotFound

2017-11-15 Thread jamestaylor
PHOENIX-4242 Fix Indexer post-compact hook logging of NPE and TableNotFound


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e98c44773fb5711cca47d9dc545453462acd4ec9
Parents: 5003ac3
Author: Vincent Poon 
Authored: Thu Oct 19 14:28:27 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../UngroupedAggregateRegionObserverIT.java | 171 +++
 .../UngroupedAggregateRegionObserver.java   | 103 ++-
 .../org/apache/phoenix/hbase/index/Indexer.java |  52 --
 .../apache/phoenix/schema/MetaDataClient.java   |   3 +
 4 files changed, 239 insertions(+), 90 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e98c4477/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
new file mode 100644
index 000..3efd40e
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
@@ -0,0 +1,171 @@
+/*
+ * 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.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.schema.PIndexState;
+import org.apache.phoenix.util.EnvironmentEdgeManager;
+import org.apache.phoenix.util.IndexUtil;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class UngroupedAggregateRegionObserverIT extends 
ParallelStatsDisabledIT {
+
+private String dataTableName;
+private String indexTableName;
+private String schemaName;
+private String dataTableFullName;
+private static String indexTableFullName;
+
+@Mock
+private Appender mockAppender;
+
+@Captor
+private ArgumentCaptor captorLoggingEvent;
+private UngroupedAggregateRegionObserver ungroupedObserver;
+
+@Before
+public void setup() {
+ungroupedObserver = new UngroupedAggregateRegionObserver();
+
ungroupedObserver.setCompactionConfig(PropertiesUtil.cloneConfig(config));
+}
+
+/**
+ * Tests the that post compact hook doesn't log any NPE for a System table
+ */
+@Test
+public void testPostCompactSystemSequence() throws Exception {
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+startCapturingIndexLog();
+// run the post-compact hook
+ungroupedObserver.clearTsOnDisabledIndexes("SYSTEM.SEQUENCE");
+stopCapturingIndexLog();
+// uneventful - nothing should be logged
+Mockito.verify(mockAppender, never())
+.doAppend((LoggingEvent) captorLoggingEvent.capture());
+}

[28/37] phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization

2017-11-15 Thread jamestaylor
PHOENIX-4287 Incorrect aggregate query results when stats are disable for 
parallelization


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

Branch: refs/heads/4.x-HBase-1.1
Commit: cba2b5719cb39f244f12b79f732233bb9ef6fb4c
Parents: e0df4b2
Author: Samarth Jain 
Authored: Tue Oct 31 10:12:22 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:40 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 209 ++-
 .../phoenix/iterate/BaseResultIterators.java|  55 +++--
 2 files changed, 246 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cba2b571/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 62538af..931c398 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
@@ -20,6 +20,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;
 import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
@@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 @Test
 public void testBytesRowsForSelectOnTenantViews() throws Exception {
 String tenant1View = generateUniqueName();
-;
 String tenant2View = generateUniqueName();
-;
 String tenant3View = generateUniqueName();
-;
 String multiTenantBaseTable = generateUniqueName();
 String tenant1 = "tenant1";
 String tenant2 = "tenant2";
@@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 }
 }
 
+@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287
+public void testEstimatesForAggregateQueries() throws Exception {
+String tableName = generateUniqueName();
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+int guidePostWidth = 20;
+String ddl =
+"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a 
bigint, b bigint)"
++ " GUIDE_POSTS_WIDTH=" + guidePostWidth
++ ", USE_STATS_FOR_PARALLELIZATION=false";
+byte[][] splits =
+new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), 
Bytes.toBytes(108) };
+BaseTest.createTestTable(getUrl(), ddl, splits, null);
+conn.createStatement().execute("upsert into " + tableName + " 
values (100,1,3)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (101,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (102,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (103,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (104,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (105,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (106,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (107,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (108,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (109,2,4)");
+conn.commit();
+conn.createStatement().execute("UPDATE STATISTICS " + tableName + 
"");
+}
+List binds = Lists.newArrayList();
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+String sql = "SELECT COUNT(*) " + " FROM " + tableName;
+ResultSet rs = conn.createStatement().executeQuery(sql);
+assertTrue(rs.next());
+assertEquals(10, rs.getInt(1));
+Estimate info = getByteRowEstimates(conn, sql, binds);
+assertEquals((Long) 10l, info.getEstimatedRows());
+assertTrue(info.getEstimateInfoTs() > 0);
+
+   

[12/37] phoenix git commit: PHOENIX-4310 Remove unnecessary casts in UngroupedAggregateRegionObserverIT

2017-11-15 Thread jamestaylor
PHOENIX-4310 Remove unnecessary casts in UngroupedAggregateRegionObserverIT


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 3f453e152c2315e68fb9afe702fd650e4d0d3bef
Parents: a49aed8
Author: James Taylor 
Authored: Fri Oct 20 12:19:37 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../end2end/UngroupedAggregateRegionObserverIT.java   | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f453e15/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
index 3efd40e..0ae1bb5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
@@ -82,7 +82,7 @@ public class UngroupedAggregateRegionObserverIT extends 
ParallelStatsDisabledIT
 stopCapturingIndexLog();
 // uneventful - nothing should be logged
 Mockito.verify(mockAppender, never())
-.doAppend((LoggingEvent) captorLoggingEvent.capture());
+.doAppend(captorLoggingEvent.capture());
 }
 }
 
@@ -126,8 +126,8 @@ public class UngroupedAggregateRegionObserverIT extends 
ParallelStatsDisabledIT
 ungroupedObserver.clearTsOnDisabledIndexes(tableToCompact);
 stopCapturingIndexLog();
 // an event should've been logged
-Mockito.verify(mockAppender).doAppend((LoggingEvent) 
captorLoggingEvent.capture());
-LoggingEvent loggingEvent = (LoggingEvent) 
captorLoggingEvent.getValue();
+Mockito.verify(mockAppender).doAppend(captorLoggingEvent.capture());
+LoggingEvent loggingEvent = captorLoggingEvent.getValue();
 assertThat(loggingEvent.getLevel(), is(Level.INFO));
 // index should be permanently disabled (disabletime of 0)
 assertTrue(TestUtil.checkIndexState(pConn, indexTableFullName, 
PIndexState.DISABLE, 0L));
@@ -147,8 +147,8 @@ public class UngroupedAggregateRegionObserverIT extends 
ParallelStatsDisabledIT
 ungroupedObserver.clearTsOnDisabledIndexes(nonPhoenixTable);
 stopCapturingIndexLog();
 // a debug level event should've been logged
-Mockito.verify(mockAppender).doAppend((LoggingEvent) 
captorLoggingEvent.capture());
-LoggingEvent loggingEvent = (LoggingEvent) 
captorLoggingEvent.getValue();
+
Mockito.verify(mockAppender).doAppend(captorLoggingEvent.capture());
+LoggingEvent loggingEvent = captorLoggingEvent.getValue();
 assertThat(loggingEvent.getLevel(), is(Level.DEBUG));
 }
 }



[22/37] phoenix git commit: PHOENIX-4335 System catalog snapshot created each time a new connection is created

2017-11-15 Thread jamestaylor
PHOENIX-4335 System catalog snapshot created each time a new connection is 
created


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

Branch: refs/heads/4.x-HBase-1.1
Commit: ef39feebe0cf3b59537c0d0261657c090abe039c
Parents: e811218
Author: James Taylor 
Authored: Tue Oct 31 15:55:03 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:40 2017 -0800

--
 .../phoenix/end2end/SystemCatalogUpgradeIT.java | 121 +++
 .../phoenix/coprocessor/MetaDataProtocol.java   |  12 +-
 .../query/ConnectionQueryServicesImpl.java  |  39 --
 .../java/org/apache/phoenix/query/BaseTest.java |  35 --
 4 files changed, 190 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef39feeb/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
new file mode 100644
index 000..e5b1d6e
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
@@ -0,0 +1,121 @@
+/*
+ * 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.assertTrue;
+
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.query.ConnectionQueryServicesImpl;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesTestImpl;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+
+public class SystemCatalogUpgradeIT extends BaseTest {
+private static boolean reinitialize;
+private static int countUpgradeAttempts;
+private static long systemTableVersion = 
MetaDataProtocol.getPriorVersion();
+
+private static class PhoenixUpgradeCountingServices extends 
ConnectionQueryServicesImpl {
+public PhoenixUpgradeCountingServices(QueryServices services, 
ConnectionInfo connectionInfo, Properties info) {
+super(services, connectionInfo, info);
+}
+
+@Override
+protected void setUpgradeRequired() {
+super.setUpgradeRequired();
+countUpgradeAttempts++;
+}
+
+@Override
+protected long getSystemTableVersion() {
+return systemTableVersion;
+}
+
+@Override
+protected boolean isInitialized() {
+return !reinitialize && super.isInitialized();
+}
+}
+
+public static class PhoenixUpgradeCountingDriver extends PhoenixTestDriver 
{
+private ConnectionQueryServices cqs;
+private final ReadOnlyProps overrideProps;
+
+public PhoenixUpgradeCountingDriver(ReadOnlyProps props) {
+overrideProps = props;
+}
+
+@Override
+public boolean acceptsURL(String url) throws SQLException {
+return true;
+}
+
+@Override // public for testing
+public synchronized ConnectionQueryServices 
getConnectionQueryServices(String url, Properties info) throws SQLException {
+if (cqs == null) {
+cqs = new 

[14/37] phoenix git commit: Revert "PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4322 DESC primary key column with variable length does not work 
in SkipScanFilter"

This reverts commit b0220fa7522fd7e1848ad428a47121b205dec504.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 969b79c22a377a0faf0d6195cdbcc878fffba36b
Parents: 0ac0549
Author: James Taylor 
Authored: Mon Oct 30 19:24:51 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:39 2017 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/SortOrderIT.java | 9 -
 .../src/main/java/org/apache/phoenix/util/ScanUtil.java | 7 ++-
 2 files changed, 2 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/969b79c2/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
index 58bbabb..655dbb1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
@@ -167,15 +167,6 @@ public class SortOrderIT extends ParallelStatsDisabledIT {
 runQueryTest(ddl, upsert("oid", "code"), insertedRows, new 
Object[][]{{"o2", 2}}, new WhereCondition("oid", "IN", "('o2')"),
 table);
 }
-
-@Test
-public void inDescCompositePK3() throws Exception {
-String table = generateUniqueName();
-String ddl = "CREATE table " + table + " (oid INTEGER NOT NULL, code 
VARCHAR NOT NULL constraint pk primary key (oid DESC, code DESC))";
-Object[][] insertedRows = new Object[][]{{1, "o1"}, {2, "o2"}, {3, 
"o3"}};
-runQueryTest(ddl, upsert("oid", "code"), insertedRows, new 
Object[][]{{2, "o2"}, {1, "o1"}},
-new WhereCondition("(oid, code)", "IN", "((1, 'o1'), (2, 'o2'))"), 
table);
-}
 
 @Test
 public void likeDescCompositePK1() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/969b79c2/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 8ab4f20..a844226 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -431,11 +431,8 @@ public class ScanUtil {
 anyInclusiveUpperRangeKey |= !range.isSingleKey() && 
inclusiveUpper;
 // A null or empty byte array is always represented as a zero byte
 byte sepByte = 
SchemaUtil.getSeparatorByte(schema.rowKeyOrderOptimizable(), bytes.length == 0, 
field);
-// The result of an RVC evaluation can come with a trailing 
separator already, so we
-// should avoid adding another one.
-if ( !isFixedWidth
-&& ( bytes.length == 0 || key[offset - 1] != sepByte )
-&& ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
+
+if ( !isFixedWidth && ( sepByte == 
QueryConstants.DESC_SEPARATOR_BYTE 
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {
 key[offset++] = sepByte;



[08/37] phoenix git commit: PHOENIX-4280 Delete doesn't work when immutable indexes are in building state

2017-11-15 Thread jamestaylor
PHOENIX-4280 Delete doesn't work when immutable indexes are in building state


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

Branch: refs/heads/4.x-HBase-1.1
Commit: a49aed8e755ccf35e1938754ebba982ca456ab3c
Parents: b1fa6b5
Author: James Taylor 
Authored: Thu Oct 19 17:52:29 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../phoenix/end2end/index/DropColumnIT.java |   3 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java | 105 -
 .../end2end/index/IndexMaintenanceIT.java   |   7 +-
 .../apache/phoenix/compile/DeleteCompiler.java  |  18 ++-
 .../hbase/index/builder/BaseIndexCodec.java |  33 +++---
 .../hbase/index/covered/IndexMetaData.java  |  13 ++-
 .../hbase/index/covered/LocalTableState.java|  69 ++-
 .../hbase/index/covered/NonTxIndexBuilder.java  | 115 +--
 .../hbase/index/scanner/ScannerBuilder.java |   2 +-
 .../hbase/index/util/IndexManagementUtil.java   |   2 -
 .../apache/phoenix/index/IndexMaintainer.java   |  29 -
 .../phoenix/index/PhoenixIndexMetaData.java |  14 ++-
 .../index/PhoenixTransactionalIndexer.java  |  34 ++
 .../index/covered/LocalTableStateTest.java  |  31 ++---
 .../index/covered/NonTxIndexBuilderTest.java|   2 +-
 15 files changed, 255 insertions(+), 222 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a49aed8e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
index 4f6c37e..badb2a6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
@@ -294,7 +295,7 @@ public class DropColumnIT extends ParallelStatsDisabledIT {
 if (!mutable && columnEncoded) {
 KeyValueColumnExpression colExpression = new 
SingleCellColumnExpression(localIndexCol, "0:V2", 
localIndexTable.getEncodingScheme());
 ImmutableBytesPtr ptr = new ImmutableBytesPtr();
-colExpression.evaluate(new ResultTuple(result), ptr);
+assertTrue(colExpression.evaluate(new ResultTuple(result), ptr));
 colValue = ptr.copyBytesIfNecessary();
 }
 else {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a49aed8e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
index 4c43068..9eb5440 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
@@ -29,6 +29,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -40,6 +41,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.hbase.HBaseIOException;
+import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@@ -47,12 +49,15 @@ import 
org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.end2end.BaseUniqueNamesOwnClusterIT;
 import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.query.QueryServices;
 import 

[18/37] phoenix git commit: PHOENIX-4290 Full table scan performed for DELETE with table having immutable indexes

2017-11-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e0df4b2e/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
index f88b34b..b5293bb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
@@ -17,8 +17,6 @@
  */
 package org.apache.phoenix.compile;
 
-import static 
org.apache.phoenix.schema.PTable.QualifierEncodingScheme.NON_ENCODED_QUALIFIERS;
-
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.util.ArrayList;
@@ -66,6 +64,7 @@ import org.apache.phoenix.schema.ColumnNotFoundException;
 import org.apache.phoenix.schema.ColumnRef;
 import org.apache.phoenix.schema.FunctionNotFoundException;
 import org.apache.phoenix.schema.MetaDataClient;
+import org.apache.phoenix.schema.MetaDataEntityNotFoundException;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PColumnFamily;
 import org.apache.phoenix.schema.PColumnFamilyImpl;
@@ -73,9 +72,9 @@ import org.apache.phoenix.schema.PColumnImpl;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PNameFactory;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.ImmutableStorageScheme;
 import org.apache.phoenix.schema.PTable.IndexType;
 import org.apache.phoenix.schema.PTable.QualifierEncodingScheme;
-import org.apache.phoenix.schema.PTable.ImmutableStorageScheme;
 import org.apache.phoenix.schema.PTableImpl;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.PTableType;
@@ -871,7 +870,9 @@ public class FromCompiler {
 TableRef tableRef = iterator.next();
 try {
 PColumnFamily columnFamily = 
tableRef.getTable().getColumnFamily(cfName);
-if (theColumnFamilyRef != null) { throw new 
TableNotFoundException(cfName); }
+if (columnFamily == null) { 
+throw new TableNotFoundException(cfName); 
+}
 theColumnFamilyRef = new ColumnFamilyRef(tableRef, 
columnFamily);
 } catch (ColumnFamilyNotFoundException e) {}
 }
@@ -914,10 +915,42 @@ public class FromCompiler {
 PColumn column = 
tableRef.getTable().getColumnForColumnName(colName);
 return new ColumnRef(tableRef, column.getPosition());
 } catch (TableNotFoundException e) {
-// Try using the tableName as a columnFamily reference 
instead
-ColumnFamilyRef cfRef = resolveColumnFamily(schemaName, 
tableName);
-PColumn column = 
cfRef.getFamily().getPColumnForColumnName(colName);
-return new ColumnRef(cfRef.getTableRef(), 
column.getPosition());
+TableRef theTableRef = null;
+PColumn theColumn = null;
+PColumnFamily theColumnFamily = null;
+if (schemaName != null) {
+try {
+// Try schemaName as the tableName and use 
tableName as column family name
+theTableRef = resolveTable(null, schemaName);
+theColumnFamily = 
theTableRef.getTable().getColumnFamily(tableName);
+theColumn = 
theColumnFamily.getPColumnForColumnName(colName);
+} catch (MetaDataEntityNotFoundException e2) {
+}
+} 
+if (theColumn == null) {
+// Try using the tableName as a columnFamily reference 
instead
+// and resolve column in each column family.
+Iterator iterator = tables.iterator();
+while (iterator.hasNext()) {
+TableRef tableRef = iterator.next();
+try {
+PColumnFamily columnFamily = 
tableRef.getTable().getColumnFamily(tableName);
+PColumn column = 
columnFamily.getPColumnForColumnName(colName);
+if (theColumn != null) {
+throw new 
AmbiguousColumnException(colName);
+}
+theTableRef = tableRef;
+theColumnFamily = columnFamily;
+theColumn = column;
+} catch (MetaDataEntityNotFoundException e1) {
+}
+}
+   

[05/37] phoenix git commit: Revert "PHOENIX-4198 Remove the need for users to have access to the Phoenix SYSTEM tables to create tables"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4198 Remove the need for users to have access to the Phoenix 
SYSTEM tables to create tables"

This reverts commit 7a4a974d3e82292b5b5ce94868d8d57c5272d114.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 5003ac304eaa3ff27a3c5199f56e9954835ddc87
Parents: 1c3116f
Author: James Taylor 
Authored: Wed Nov 15 10:40:36 2017 -0800
Committer: James Taylor 
Committed: Wed Nov 15 10:40:36 2017 -0800

--
 .../phoenix/end2end/TableDDLPermissionsIT.java  | 692 ---
 .../org/apache/hadoop/hbase/ipc/RpcUtil.java|  32 -
 .../BaseMetaDataEndpointObserver.java   | 111 ---
 .../coprocessor/MetaDataEndpointImpl.java   | 338 ++---
 .../coprocessor/MetaDataEndpointObserver.java   |  68 --
 .../coprocessor/MetaDataRegionObserver.java |  17 +-
 .../coprocessor/PhoenixAccessController.java| 628 -
 .../PhoenixMetaDataCoprocessorHost.java | 236 ---
 .../index/PhoenixIndexFailurePolicy.java| 109 ++-
 .../query/ConnectionQueryServicesImpl.java  |  15 +-
 .../org/apache/phoenix/query/QueryServices.java |   4 -
 .../phoenix/query/QueryServicesOptions.java |  14 +-
 .../phoenix/schema/stats/StatisticsWriter.java  |  42 +-
 .../org/apache/phoenix/util/MetaDataUtil.java   |  18 -
 .../org/apache/phoenix/util/SchemaUtil.java |  12 -
 15 files changed, 140 insertions(+), 2196 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5003ac30/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
deleted file mode 100644
index 971383b..000
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
+++ /dev/null
@@ -1,692 +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.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.lang.reflect.UndeclaredThrowableException;
-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.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.AuthUtil;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.NamespaceDescriptor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.security.AccessDeniedException;
-import org.apache.hadoop.hbase.security.access.AccessControlClient;
-import org.apache.hadoop.hbase.security.access.Permission.Action;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.phoenix.exception.PhoenixIOException;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.util.MetaDataUtil;
-import org.apache.phoenix.util.SchemaUtil;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import 

[07/37] phoenix git commit: PHOENIX-3757 System mutex table not being created in SYSTEM namespace when namespace mapping is enabled

2017-11-15 Thread jamestaylor
PHOENIX-3757 System mutex table not being created in SYSTEM namespace when 
namespace mapping is enabled


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6c527c1b1da6f50f75dcb63c2396daf1318c1f22
Parents: 87f8b1e
Author: Karan Mehta 
Authored: Thu Oct 26 11:32:14 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../MigrateSystemTablesToSystemNamespaceIT.java | 402 +++
 .../end2end/SystemTablePermissionsIT.java   |   3 +-
 .../phoenix/coprocessor/MetaDataProtocol.java   |   3 +
 .../exception/UpgradeInProgressException.java   |   8 +-
 .../query/ConnectionQueryServicesImpl.java  | 184 ++---
 .../org/apache/phoenix/util/UpgradeUtil.java|  44 +-
 .../query/ConnectionQueryServicesImplTest.java  |   9 +-
 7 files changed, 572 insertions(+), 81 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c527c1b/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
new file mode 100644
index 000..91e34be
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
@@ -0,0 +1,402 @@
+/*
+ * 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 org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.exception.UpgradeInProgressException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+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.schema.PTableType;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import 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"));
+private static final Set PHOENIX_NAMESPACE_MAPPED_SYSTEM_TABLES = 
new HashSet<>(
+Arrays.asList("SYSTEM:CATALOG", "SYSTEM:SEQUENCE", "SYSTEM:STATS", 
"SYSTEM:FUNCTION",
+"SYSTEM:MUTEX"));
+private static final String SCHEMA_NAME = "MIGRATETEST";
+private static final String TABLE_NAME =
+SCHEMA_NAME + "." + 
MigrateSystemTablesToSystemNamespaceIT.class.getSimpleName().toUpperCase();
+private static final int NUM_RECORDS = 5;
+
+private HBaseTestingUtility testUtil = null;
+

[13/37] phoenix git commit: PHOENIX-4277 Treat delete markers consistently with puts for point-in-time scans

2017-11-15 Thread jamestaylor
PHOENIX-4277 Treat delete markers consistently with puts for point-in-time scans


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 7c21a83df97878f421464147d29a9dfd2d636870
Parents: 8b360e2
Author: James Taylor 
Authored: Sun Oct 29 15:19:23 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:34 2017 -0800

--
 .../phoenix/end2end/PointInTimeQueryIT.java |  2 +-
 .../hadoop/hbase/regionserver/ScanInfoUtil.java | 35 
 .../coprocessor/BaseScannerRegionObserver.java  | 21 
 .../apache/phoenix/util/TransactionUtil.java|  7 ++--
 4 files changed, 62 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7c21a83d/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
index c53e523..ed3e8a9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
@@ -63,7 +63,7 @@ public class PointInTimeQueryIT extends BaseQueryIT {
 public PointInTimeQueryIT(String idxDdl, boolean columnEncoded)
 throws Exception {
 // These queries fail without KEEP_DELETED_CELLS=true
-super(idxDdl, columnEncoded, true);
+super(idxDdl, columnEncoded, false);
 }
 
 @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7c21a83d/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
new file mode 100644
index 000..9d61437
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
@@ -0,0 +1,35 @@
+/*
+ * 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.hadoop.hbase.regionserver;
+
+import org.apache.hadoop.hbase.KeepDeletedCells;
+
+public class ScanInfoUtil {
+private ScanInfoUtil() {
+}
+
+public static boolean isKeepDeletedCells(ScanInfo scanInfo) {
+return scanInfo.getKeepDeletedCells() != KeepDeletedCells.FALSE;
+}
+
+public static ScanInfo cloneScanInfoWithKeepDeletedCells(ScanInfo 
scanInfo) {
+return new ScanInfo(scanInfo.getFamily(), 
Math.max(scanInfo.getMinVersions(), 1),
+scanInfo.getMaxVersions(), scanInfo.getTtl(), 
KeepDeletedCells.TRUE,
+scanInfo.getTimeToPurgeDeletes(), 
scanInfo.getComparator());
+}
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7c21a83d/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 1b95058..8aa9532 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
@@ -19,10 +19,12 @@ package org.apache.phoenix.coprocessor;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.NavigableSet;
 
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import 

[10/37] phoenix git commit: PHOENIX-4269 IndexScrutinyToolIT is flapping

2017-11-15 Thread jamestaylor
PHOENIX-4269 IndexScrutinyToolIT is flapping


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

Branch: refs/heads/4.x-HBase-1.1
Commit: b1fa6b53c69096a2eb743e10eb11b0ae899bcba0
Parents: e98c447
Author: Vincent Poon 
Authored: Thu Oct 19 15:54:11 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../phoenix/end2end/IndexScrutinyToolIT.java| 61 ++--
 1 file changed, 30 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b1fa6b53/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
index f2384ec..10595a7 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
@@ -56,6 +56,7 @@ import 
org.apache.phoenix.mapreduce.index.SourceTargetColumnNames;
 import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -107,7 +108,9 @@ public class IndexScrutinyToolIT extends BaseTest {
 public static Collection data() {
 return Arrays.asList(new Object[][] {
 { "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR)", "CREATE LOCAL INDEX %s 
ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" },
-{ "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR) SALT_BUCKETS=2", "CREATE 
INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" } });
+{ "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR) SALT_BUCKETS=2", "CREATE 
INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" },
+{ "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR) SALT_BUCKETS=2", "CREATE 
LOCAL INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" }
+});
 }
 
 public IndexScrutinyToolIT(String dataTableDdl, String indexTableDdl) {
@@ -137,7 +140,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 String indexTableUpsert = String.format(INDEX_UPSERT_SQL, 
indexTableFullName);
 indexTableUpsertStmt = conn.prepareStatement(indexTableUpsert);
 conn.setAutoCommit(false);
-testTime = System.currentTimeMillis();
+testTime = EnvironmentEdgeManager.currentTimeMillis() - 1000;
 }
 
 @After
@@ -257,8 +260,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 
 // run scrutiny with batch size of 10
 List completedJobs =
-runScrutiny(schemaName, dataTableName, indexTableName, 
System.currentTimeMillis(),
-10L);
+runScrutiny(schemaName, dataTableName, indexTableName, 10L);
 Job job = completedJobs.get(0);
 assertTrue(job.isSuccessful());
 Counters counters = job.getCounters();
@@ -305,8 +307,8 @@ public class IndexScrutinyToolIT extends BaseTest {
 conn.commit();
 
 List completedJobs =
-runScrutiny(schemaName, dataTableName, indexTableName, 
System.currentTimeMillis(),
-10L, SourceTable.INDEX_TABLE_SOURCE);
+runScrutiny(schemaName, dataTableName, indexTableName, 10L,
+SourceTable.INDEX_TABLE_SOURCE);
 Job job = completedJobs.get(0);
 assertTrue(job.isSuccessful());
 Counters counters = job.getCounters();
@@ -334,8 +336,8 @@ public class IndexScrutinyToolIT extends BaseTest {
 conn.commit();
 
 List completedJobs =
-runScrutiny(schemaName, dataTableName, indexTableName, 
System.currentTimeMillis(),
-10L, SourceTable.BOTH);
+runScrutiny(schemaName, dataTableName, indexTableName, 10L,
+SourceTable.BOTH);
 assertEquals(2, completedJobs.size());
 for (Job job : completedJobs) {
 assertTrue(job.isSuccessful());
@@ -353,8 +355,8 @@ 

[04/37] phoenix git commit: Revert "PHOENIX-4198 Remove the need for users to have access to the Phoenix SYSTEM tables to create tables"

2017-11-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/5003ac30/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
deleted file mode 100644
index 8437b37..000
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
+++ /dev/null
@@ -1,628 +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.coprocessor;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.AuthUtil;
-import org.apache.hadoop.hbase.CoprocessorEnvironment;
-import org.apache.hadoop.hbase.DoNotRetryIOException;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.NamespaceDescriptor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.ClusterConnection;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.coprocessor.BaseMasterAndRegionObserver;
-import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController;
-import org.apache.hadoop.hbase.ipc.RpcServer;
-import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
-import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
-import 
org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService;
-import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
-import org.apache.hadoop.hbase.security.AccessDeniedException;
-import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.security.UserProvider;
-import org.apache.hadoop.hbase.security.access.AccessControlClient;
-import org.apache.hadoop.hbase.security.access.AuthResult;
-import org.apache.hadoop.hbase.security.access.Permission;
-import org.apache.hadoop.hbase.security.access.Permission.Action;
-import org.apache.hadoop.hbase.security.access.UserPermission;
-import org.apache.hadoop.hbase.util.Bytes;
-import 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.PhoenixMetaDataControllerEnvironment;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.query.QueryServicesOptions;
-import org.apache.phoenix.schema.PIndexState;
-import org.apache.phoenix.schema.PTable;
-import org.apache.phoenix.schema.PTableType;
-import org.apache.phoenix.util.MetaDataUtil;
-
-import com.google.common.collect.Lists;
-import com.google.protobuf.RpcCallback;
-
-public class PhoenixAccessController extends BaseMetaDataEndpointObserver {
-
-private PhoenixMetaDataControllerEnvironment env;
-private ArrayList accessControllers;
-private boolean accessCheckEnabled;
-private UserProvider userProvider;
-private boolean isAutomaticGrantEnabled;
-private boolean isStrictMode;
-public static final Log LOG = 
LogFactory.getLog(PhoenixAccessController.class);
-private static final Log AUDITLOG =
-
LogFactory.getLog("SecurityLogger."+PhoenixAccessController.class.getName());
-
-private List getAccessControllers() throws 
IOException {
-if (accessControllers == null) {
-synchronized (this) {
-if (accessControllers == null) {
-accessControllers = new 
ArrayList();
-RegionCoprocessorHost cpHost = 
this.env.getCoprocessorHost();
-List coprocessors = cpHost
-

[15/37] phoenix git commit: PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter (fix test failures)

2017-11-15 Thread jamestaylor
PHOENIX-4322 DESC primary key column with variable length does not work in 
SkipScanFilter (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/1d85ffa6
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1d85ffa6
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1d85ffa6

Branch: refs/heads/4.x-HBase-1.1
Commit: 1d85ffa61254102035e419d38e100cff5be54a98
Parents: 3df249c
Author: maryannxue 
Authored: Mon Oct 30 15:13:43 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:39 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1d85ffa6/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 8ab4f20..3fe8ad3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -434,7 +434,7 @@ public class ScanUtil {
 // The result of an RVC evaluation can come with a trailing 
separator already, so we
 // should avoid adding another one.
 if ( !isFixedWidth
-&& ( bytes.length == 0 || key[offset - 1] != sepByte )
+&& ( bytes.length == 0 || slotSpan[i] == 0 || key[offset - 
1] != sepByte )
 && ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {



[32/37] phoenix git commit: PHOENIX-4291 Merge release script for mac and linux

2017-11-15 Thread jamestaylor
PHOENIX-4291 Merge release script for mac and linux


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 8947624df820a8e5f8821f409c65293373734992
Parents: 07aacc2
Author: Mujtaba 
Authored: Fri Nov 3 11:55:25 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:41 2017 -0800

--
 dev/make_rc.sh|  26 +++---
 dev/make_rc_on_mac.sh | 121 -
 2 files changed, 18 insertions(+), 129 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8947624d/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index 29227b0..31cb9f9 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -43,7 +43,7 @@ DIR_DOCS=dev/release_files
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
-RESULT=$(find -iname target)
+RESULT=$(find . -iname target)
 
 if [ -z "$RESULT" ]
 then
@@ -73,7 +73,7 @@ mvn clean apache-rat:check package -DskipTests 
-Dcheckstyle.skip=true -q;
 rm -rf $(find . -type d -name archive-tmp);
 
 # Copy all phoenix-*.jars to release dir
-phx_jars=$(find -iwholename "./*/target/phoenix-*.jar")
+phx_jars=$(find . -iwholename "./*/target/phoenix-*.jar")
 cp $phx_jars $DIR_REL_BIN_PATH;
 
 # Copy bin
@@ -81,7 +81,7 @@ cp bin/* $DIR_BIN;
 cp -R $DIR_PHERF_CONF $DIR_BIN;
 
 # Copy release docs
-
+cp README $DIR_REL_BIN_PATH;
 cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 
 # Copy examples
@@ -97,10 +97,20 @@ echo "Now signing source and binary tars"
 # Sign
 function_sign() {
   phoenix_tar=$(find apache-phoenix-*.gz);
-  gpg --armor --output $phoenix_tar.asc --detach-sig $phoenix_tar;
-  md5sum -b $phoenix_tar > $phoenix_tar.md5;
-  sha512sum -b $phoenix_tar > $phoenix_tar.sha;
-  sha256sum -b $phoenix_tar >> $phoenix_tar.sha;
+
+  # if on MAC OS
+  if [[ "$OSTYPE" == "darwin"* ]]; then
+gpg2 --armor --output $phoenix_tar.asc --detach-sig $phoenix_tar;
+openssl md5 $phoenix_tar > $phoenix_tar.md5;
+openssl dgst -sha512 $phoenix_tar > $phoenix_tar.sha;
+openssl dgst -sha256 $phoenix_tar >> $phoenix_tar.sha;
+  # all other OS
+  else
+gpg --armor --output $phoenix_tar.asc --detach-sig $phoenix_tar;
+md5sum -b $phoenix_tar > $phoenix_tar.md5;
+sha512sum -b $phoenix_tar > $phoenix_tar.sha;
+sha256sum -b $phoenix_tar >> $phoenix_tar.sha;
+  fi
 }
 
 cd $DIR_REL_BIN_TAR_PATH; function_sign;
@@ -111,7 +121,7 @@ read -p "Do you want add tag for this RC in GIT? (Y for yes 
or any other key to
 if [[ $prompt =~ [yY](es)* ]]
 then
   echo "Tagging..."
-  read -p "Enter tag (Example 5.0.0-rc0):" prompt
+  read -p "Enter tag (Example 4.13.0-HBase-0.98-rc0):" prompt
   echo "Setting tag: $prompt";sleep 5s
   git tag -a $prompt -m "$prompt"; git push origin $prompt
   mv $DIR_REL_ROOT $DIR_REL_BASE/phoenix-$prompt

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8947624d/dev/make_rc_on_mac.sh
--
diff --git a/dev/make_rc_on_mac.sh b/dev/make_rc_on_mac.sh
deleted file mode 100755
index 0b924f1..000
--- a/dev/make_rc_on_mac.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-set -e
-
-echo "Script that assembles all you need to make an RC."
-echo "It generates source and binary tar in release directory"
-echo "Presumes that you can sign a release as described at 
https://www.apache.org/dev/release-signing.html;
-echo "Starting...";sleep 2s
-
-# Set directory variables
-DIR_ROOT="$(cd $(dirname $0);pwd)/.."
-cd $DIR_ROOT
-PHOENIX="$(xmllint --xpath 
"//*[local-name()='project']/*[local-name()='version']/text()" 

[20/37] phoenix git commit: Revert "PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter (fix test failures)"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4322 DESC primary key column with variable length does not work 
in SkipScanFilter (fix test failures)"

This reverts commit 45a9c275dbbf9206264236c690f40c309d97da3c.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 0ac05493534686cd4946b40589fc7e92944ceae5
Parents: 1d85ffa
Author: James Taylor 
Authored: Mon Oct 30 19:24:36 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:39 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ac05493/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 3fe8ad3..8ab4f20 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -434,7 +434,7 @@ public class ScanUtil {
 // The result of an RVC evaluation can come with a trailing 
separator already, so we
 // should avoid adding another one.
 if ( !isFixedWidth
-&& ( bytes.length == 0 || slotSpan[i] == 0 || key[offset - 
1] != sepByte )
+&& ( bytes.length == 0 || key[offset - 1] != sepByte )
 && ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {



[31/37] phoenix git commit: PHOENIX-4349 Update version to 4.13.0

2017-11-15 Thread jamestaylor
PHOENIX-4349 Update version to 4.13.0


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 07aacc2febb6c23be6fa7ad95c9e49690accb9d2
Parents: 81019c6
Author: James Taylor 
Authored: Fri Nov 3 09:26:58 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:41 2017 -0800

--
 .../java/org/apache/phoenix/coprocessor/MetaDataProtocol.java  | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/07aacc2f/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 c4ecc3f..fe11ec7 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
@@ -63,7 +63,7 @@ import com.google.protobuf.ByteString;
  */
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
-public static final int PHOENIX_MINOR_VERSION = 12;
+public static final int PHOENIX_MINOR_VERSION = 13;
 public static final int PHOENIX_PATCH_NUMBER = 0;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
@@ -92,8 +92,9 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0 = 
MIN_TABLE_TIMESTAMP + 27;
 // Since there's no upgrade code, keep the version the same as the 
previous version
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0 = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0 = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0;
 // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the 
MIN_SYSTEM_TABLE_TIMESTAMP_* constants
-public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0;
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
@@ -112,6 +113,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_10_0, "4.10.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0, "4.11.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0, "4.12.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0, "4.13.x");
 }
 
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 



[21/37] phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views

2017-11-15 Thread jamestaylor
PHOENIX-4333 Test to demonstrate partial stats information for tenant views


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e811218f9b8d9fba71e88a8a4d9cd3e2ea47ff8d
Parents: cba2b57
Author: Samarth Jain 
Authored: Tue Oct 31 14:14:56 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:40 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 95 
 1 file changed, 95 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e811218f/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 931c398..25d4194 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
@@ -31,6 +31,7 @@ import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.BaseTest;
@@ -782,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 this.time += t;
 }
 }
+
+@Test
+public void testPartialStatsForTenantViews() throws Exception {
+String tenant1View = generateUniqueName();
+String tenant2View = generateUniqueName();
+String multiTenantTable = generateUniqueName();
+String tenantId1 = "00Dabcdetenant1";
+String tenantId2 = "00Dabcdetenant2";
+
+String ddl =
+"CREATE TABLE " + multiTenantTable
++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a 
bigint, b bigint CONSTRAINT PK PRIMARY KEY "
++ "(ORGID, PK2)) MULTI_TENANT=true, 
GUIDE_POSTS_WIDTH=20";
+createTestTable(getUrl(), ddl, null, null);
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+// split such that some data for view2 resides on region of view1
+try (HBaseAdmin admin =
+
conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) {
+byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B");
+admin.split(Bytes.toBytes(multiTenantTable), splitKey);
+}
+
+/**
+ * Insert 2 rows for tenant1 and 6 for tenant2
+ */
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId1 + 
"','00A',1,1)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId1 + 
"','00B',2,2)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00A',3,3)");
+// We split at tenant2 + 00B. So the following rows will reside in 
a different region
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00B',4,4)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00C',5,5)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00D',6,6)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00E',7,7)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00F',8,8)");
+conn.commit();
+}
+try (Connection conn = getTenantConnection(tenantId1)) {
+conn.createStatement().execute(
+"CREATE VIEW " + tenant1View + " AS SELECT * FROM " + 
multiTenantTable);
+}
+try (Connection conn = getTenantConnection(tenantId2)) {
+conn.createStatement().execute(
+"CREATE VIEW " + tenant2View + " AS SELECT * FROM " + 
multiTenantTable);
+}
+String sql = "";
+List binds = Lists.newArrayList();
+try (Connection conn = 

[36/37] phoenix git commit: PHOENIX-4291 Addendum - Merge release script for mac and linux

2017-11-15 Thread jamestaylor
PHOENIX-4291 Addendum - Merge release script for mac and linux


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

Branch: refs/heads/4.x-HBase-1.1
Commit: b115f9b46531c08edbefb8c60bde9811d19fff6e
Parents: 47e7c60
Author: Mujtaba 
Authored: Fri Nov 3 13:41:45 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:42 2017 -0800

--
 dev/make_rc.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b115f9b4/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index 31cb9f9..638968c 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -81,7 +81,7 @@ cp bin/* $DIR_BIN;
 cp -R $DIR_PHERF_CONF $DIR_BIN;
 
 # Copy release docs
-cp README $DIR_REL_BIN_PATH;
+cp README* $DIR_REL_BIN_PATH;
 cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 
 # Copy examples



[06/37] phoenix git commit: PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes

2017-11-15 Thread jamestaylor
PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 8b360e23e910f28d4bb7bf2e0470e120ffc9ca85
Parents: 6c527c1
Author: Samarth Jain 
Authored: Sun Oct 29 22:59:03 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 13 
 .../phoenix/end2end/index/BaseLocalIndexIT.java |  3 +
 .../phoenix/end2end/index/LocalIndexIT.java | 46 ++-
 .../phoenix/iterate/BaseResultIterators.java|  4 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 80 +---
 5 files changed, 115 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b360e23/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 cd4555c..62538af 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
@@ -32,6 +32,7 @@ import java.util.List;
 
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -306,6 +307,18 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 final Long estimatedRows;
 final Long estimateInfoTs;
 
+public Long getEstimatedBytes() {
+return estimatedBytes;
+}
+
+public Long getEstimatedRows() {
+return estimatedRows;
+}
+
+public Long getEstimateInfoTs() {
+return estimateInfoTs;
+}
+
 Estimate(Long rows, Long bytes, Long ts) {
 this.estimatedBytes = bytes;
 this.estimatedRows = rows;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b360e23/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
index 30baec4..1659d73 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
@@ -59,6 +59,9 @@ public abstract class BaseLocalIndexIT extends 
BaseUniqueNamesOwnClusterIT {
 serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
 Map clientProps = Maps.newHashMapWithExpectedSize(1);
 clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
+// setting update frequency to a large value to test out that we are
+// generating stats for local indexes
+clientProps.put(QueryServices.MIN_STATS_UPDATE_FREQ_MS_ATTRIB, 
"12");
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b360e23/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
index 48221ab..0dcf1d5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end.index;
 
+import static 
org.apache.phoenix.end2end.ExplainPlanWithStatsEnabledIT.getByteRowEstimates;
 import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceName;
 import static 
org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceSchemaName;
 import static org.junit.Assert.assertArrayEquals;
@@ -55,8 +56,10 @@ import org.apache.hadoop.hbase.util.FSUtils;
 import 

[34/37] phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view

2017-11-15 Thread jamestaylor
PHOENIX-4287 Make indexes inherit use stats property from their parent table or 
view


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

Branch: refs/heads/4.x-HBase-1.1
Commit: f9746794b0f2d2d1fbe7a3da822340bfc656daed
Parents: 474bc18
Author: Samarth Jain 
Authored: Thu Nov 2 16:55:55 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:41 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 146 +--
 .../phoenix/iterate/BaseResultIterators.java|  41 +-
 2 files changed, 171 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f9746794/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 e76b147..bfc6819 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
@@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 private static void createIndex(String indexName, String table, long 
guidePostWidth)
 throws Exception {
 try (Connection conn = DriverManager.getConnection(getUrl())) {
-conn.createStatement().execute("CREATE INDEX " + indexName + " ON 
" + table
-+ " (c1.a) INCLUDE (c2.b) ");
+conn.createStatement().execute(
+"CREATE INDEX " + indexName + " ON " + table + " (c1.a) 
INCLUDE (c2.b) ");
 conn.createStatement().execute("UPDATE STATISTICS " + indexName);
 }
 }
@@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 Estimate info = getByteRowEstimates(conn, sql, binds);
 assertEquals((Long) 10l, info.getEstimatedRows());
 assertTrue(info.getEstimateInfoTs() > 0);
-
+
 // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table
-conn.createStatement().execute("ALTER TABLE " + tableName + " SET 
USE_STATS_FOR_PARALLELIZATION = " + false);
+conn.createStatement().execute(
+"ALTER TABLE " + tableName + " SET 
USE_STATS_FOR_PARALLELIZATION = " + false);
 rs = conn.createStatement().executeQuery(sql);
 // stats are not being used for parallelization. So number of 
scans is lower.
 assertEquals(4, 
rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan()
@@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 info = getByteRowEstimates(conn, sql, binds);
 assertEquals((Long) 10l, info.getEstimatedRows());
 assertTrue(info.getEstimateInfoTs() > 0);
-
+
 // assert that the aggregate query on view also works correctly
 String viewName = "V_" + generateUniqueName();
-conn.createStatement()
-.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " 
+ tableName + " USE_STATS_FOR_PARALLELIZATION = false");
+conn.createStatement().execute("CREATE VIEW " + viewName + " AS 
SELECT * FROM "
++ tableName + " USE_STATS_FOR_PARALLELIZATION = false");
 sql = "SELECT COUNT(*) FROM " + viewName;
 rs = conn.createStatement().executeQuery(sql);
 // stats are not being used for parallelization. So number of 
scans is lower.
@@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 rs = conn.createStatement().executeQuery(sql);
 // stats are being used for parallelization. So number of scans is 
higher.
 assertEquals(14, 
rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan()
-.getScans().get(0).size());
+.getScans().get(0).size());
 assertTrue(rs.next());
 assertEquals(10, rs.getInt(1));
 info = getByteRowEstimates(conn, sql, binds);
 assertEquals((Long) 10l, info.getEstimatedRows());
 assertTrue(info.getEstimateInfoTs() > 0);
 
-conn.createStatement().execute(
-"ALTER TABLE " + viewName + " SET 
USE_STATS_FOR_PARALLELIZATION=true");
+

[29/37] phoenix git commit: PHOENIX-4348 Point deletes do not work when there are immutable indexes with only row key columns

2017-11-15 Thread jamestaylor
PHOENIX-4348 Point deletes do not work when there are immutable indexes with 
only row key columns


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 5820ff438e8e90c8b7b3a7d41bd9d44ac270e405
Parents: a50aab0
Author: James Taylor 
Authored: Thu Nov 2 18:47:01 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:41 2017 -0800

--
 .../org/apache/phoenix/end2end/DeleteIT.java| 96 +++-
 .../apache/phoenix/compile/DeleteCompiler.java  |  5 +-
 2 files changed, 94 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5820ff43/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
index aa4d36e..9eac0af 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
@@ -18,6 +18,7 @@
 package org.apache.phoenix.end2end;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
@@ -32,10 +33,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
 
 
@@ -339,8 +337,6 @@ public class DeleteIT extends ParallelStatsDisabledIT {
 con.commit();
 }
 
-
TestUtil.dumpTable(con.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
-
 ResultSet rs = con.createStatement().executeQuery("SELECT /*+ 
NO_INDEX */ count(*) FROM " + tableName);
 assertTrue(rs.next());
 assertEquals(0, rs.getLong(1));
@@ -370,6 +366,96 @@ public class DeleteIT extends ParallelStatsDisabledIT {
 testDeleteRowFromTableWithImmutableIndex(true, false);
 }
 
+@Test
+public void testPointDeleteRowFromTableWithImmutableIndex() throws 
Exception {
+testPointDeleteRowFromTableWithImmutableIndex(false, false);
+}
+
+@Test
+public void testPointDeleteRowFromTableWithLocalImmutableIndex() throws 
Exception {
+testPointDeleteRowFromTableWithImmutableIndex(true, false);
+}
+
+@Test
+public void testPointDeleteRowFromTableWithImmutableIndex2() throws 
Exception {
+testPointDeleteRowFromTableWithImmutableIndex(false, true);
+}
+
+public void testPointDeleteRowFromTableWithImmutableIndex(boolean 
localIndex, boolean addNonPKIndex) throws Exception {
+Connection con = null;
+try {
+boolean autoCommit = false;
+con = DriverManager.getConnection(getUrl());
+con.setAutoCommit(autoCommit);
+
+Statement stm = con.createStatement();
+
+String tableName = generateUniqueName();
+String indexName1 = generateUniqueName();
+String indexName2 = generateUniqueName();
+String indexName3 = addNonPKIndex? generateUniqueName() : null;
+
+stm.execute("CREATE TABLE IF NOT EXISTS " + tableName + " (" +
+"HOST CHAR(2) NOT NULL," +
+"DOMAIN VARCHAR NOT NULL, " +
+"FEATURE VARCHAR NOT NULL, " +
+"\"DATE\" DATE NOT NULL, \n" + 
+"USAGE.CORE BIGINT," +
+"USAGE.DB BIGINT," +
+"STATS.ACTIVE_VISITOR INTEGER " +
+"CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, 
\"DATE\")) IMMUTABLE_ROWS=true");
+stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + 
indexName1 + " ON " + tableName + " (\"DATE\", FEATURE)");
+stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + 
indexName2 + " ON " + tableName + " (FEATURE, DOMAIN)");
+if (addNonPKIndex) {
+stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX 
" + indexName3 + " ON " + tableName + " (\"DATE\", FEATURE, USAGE.DB)");
+}
+
+Date date = new Date(0);
+PreparedStatement psInsert = con
+.prepareStatement("UPSERT INTO " + tableName + "(HOST, 

[11/37] phoenix git commit: PHOENIX-4292 Filters on Tables and Views with composite PK of VARCHAR fields with sort direction DESC do not work (addendum)

2017-11-15 Thread jamestaylor
PHOENIX-4292 Filters on Tables and Views with composite PK of VARCHAR fields 
with sort direction DESC do not work (addendum)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 87f8b1ed0f64f2504fdf6b084f81ad7f98641c77
Parents: 3f453e1
Author: Thomas D'Silva 
Authored: Mon Oct 23 20:19:15 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:41:23 2017 -0800

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 202 ---
 1 file changed, 129 insertions(+), 73 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/87f8b1ed/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 66e2430..5c0d100 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
@@ -791,77 +791,133 @@ public class ViewIT extends BaseViewIT {
 assertArrayEquals(expectedPKs, actualPKs);
 }
 
-   @Test
-   public void testCompositeDescPK() throws SQLException {
-   Properties props = new Properties();
-   try (Connection globalConn = 
DriverManager.getConnection(getUrl(), props)) {
-   String tableName = generateUniqueName();
-   String viewName = generateUniqueName();
-
-   // create global base table
-   globalConn.createStatement().execute("CREATE TABLE " + 
tableName
-   + " (TENANT_ID CHAR(15) NOT NULL, 
KEY_PREFIX CHAR(3) NOT NULL, CREATED_DATE DATE, CREATED_BY CHAR(15), 
SYSTEM_MODSTAMP DATE CONSTRAINT PK PRIMARY KEY (TENANT_ID, KEY_PREFIX)) 
VERSIONS=1, MULTI_TENANT=true, IMMUTABLE_ROWS=TRUE, REPLICATION_SCOPE=1");
-
-   // create various tenant specific views
-   globalConn.createStatement()
-   .execute("CREATE VIEW " + viewName
-   + " (pk1 VARCHAR(10) 
NOT NULL, pk2 VARCHAR(10) NOT NULL, col1 DATE, col3 DECIMAL CONSTRAINT PK 
PRIMARY KEY (pk1 DESC, pk2 DESC)) AS SELECT * FROM "
-   + tableName + " WHERE 
KEY_PREFIX = 'abc' ");
-
-   String tenantId = "tenantId";
-   Properties tenantProps = new Properties();
-   
tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
-   // create a tenant specific view
-   try (Connection tenantConn = 
DriverManager.getConnection(getUrl(), tenantProps)) {
-   // upsert rows
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'testb', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'testc', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'testd', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'teste', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testb', 'testa', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.commit();
-
-   // run queries
-   ResultSet rs = tenantConn.createStatement()
-   .executeQuery("SELECT count(*) 
FROM " + viewName + " WHERE pk1 = 'testa'");
-   assertTrue(rs.next());
-   

[25/37] phoenix git commit: PHOENIX-3460 Namespace separator : should not be allowed in table or schema name

2017-11-15 Thread jamestaylor
PHOENIX-3460 Namespace separator : should not be allowed in table or schema name


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 474bc1866985e85c5647d8ce95a439b452a31301
Parents: 730f958
Author: Thomas D'Silva 
Authored: Thu Nov 2 12:08:07 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:46:40 2017 -0800

--
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 15 ++
 .../apache/phoenix/parse/QueryParserTest.java   | 21 
 2 files changed, 32 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/474bc186/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 721b514..93e0ede 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -1071,14 +1071,21 @@ cursor_name returns [CursorName ret]
 
 // TODO: figure out how not repeat this two times
 table_name returns [TableName ret]
-:   t=identifier {$ret = factory.table(null, t); }
-|   s=identifier DOT t=identifier {$ret = factory.table(s, t); }
+:   t=table_identifier {$ret = factory.table(null, t); }
+|   s=table_identifier DOT t=table_identifier {$ret = factory.table(s, t); 
}
 ;
 
 // TODO: figure out how not repeat this two times
 from_table_name returns [TableName ret]
-:   t=identifier {$ret = factory.table(null, t); }
-|   s=identifier DOT t=identifier {$ret = factory.table(s, t); }
+:   t=table_identifier {$ret = factory.table(null, t); }
+|   s=table_identifier DOT t=table_identifier {$ret = factory.table(s, t); 
}
+;
+
+table_identifier returns [String ret]
+:   c=identifier {
+   if (c.contains(QueryConstants.NAMESPACE_SEPARATOR) ) { throw new 
RuntimeException("Table or schema name cannot contain colon"); }
+   $ret = c;
+}
 ;
 
 // The lowest level function, which includes literals, binds, but also 
parenthesized expressions, functions, and case statements.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/474bc186/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
index e7127b7..431f60b 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
@@ -29,6 +29,7 @@ import java.sql.SQLFeatureNotSupportedException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.exception.PhoenixParserException;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixStatement.Operation;
 import org.apache.phoenix.schema.SortOrder;
@@ -56,6 +57,15 @@ public class QueryParserTest {
 assertEquals("Expected equality:\n" + sql + "\n" + newSQL, stmt, 
newStmt);
 }
 
+private void parseQueryThatShouldFail(String sql) throws Exception {
+try {
+parseQuery(sql);
+fail("Query should throw a PhoenixParserException \n " + sql);
+}
+catch (PhoenixParserException e){
+}
+}
+
 @Test
 public void testParsePreQuery0() throws Exception {
 String sql = ((
@@ -782,4 +792,15 @@ public class QueryParserTest {
 String sql = Joiner.on(unicodeEnSpace).join(new String[] {"SELECT", 
"*", "FROM", "T"});
 parseQuery(sql);
 }
+
+@Test
+public void testInvalidTableOrSchemaName() throws Exception {
+// namespace separator (:) cannot be used
+parseQueryThatShouldFail("create table a:b (id varchar not null 
primary key)");
+parseQueryThatShouldFail("create table \"a:b\" (id varchar not null 
primary key)");
+// name separator (.) cannot be used without double quotes
+parseQueryThatShouldFail("create table a.b.c.d (id varchar not null 
primary key)");
+parseQuery("create table \"a.b\".\"c.d\" (id varchar not null primary 
key)");
+parseQuery("create table \"a.b.c.d\" (id varchar not null primary 
key)");
+}
 }



[24/40] phoenix git commit: PHOENIX-4349 Update version to 4.13.0

2017-11-15 Thread jamestaylor
PHOENIX-4349 Update version to 4.13.0


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

Branch: refs/heads/4.x-HBase-1.2
Commit: a82ddc32c0c333081247eea008bf72f92d134baf
Parents: c77f3ba
Author: James Taylor 
Authored: Fri Nov 3 09:26:58 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../java/org/apache/phoenix/coprocessor/MetaDataProtocol.java  | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a82ddc32/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 c4ecc3f..fe11ec7 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
@@ -63,7 +63,7 @@ import com.google.protobuf.ByteString;
  */
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
-public static final int PHOENIX_MINOR_VERSION = 12;
+public static final int PHOENIX_MINOR_VERSION = 13;
 public static final int PHOENIX_PATCH_NUMBER = 0;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
@@ -92,8 +92,9 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0 = 
MIN_TABLE_TIMESTAMP + 27;
 // Since there's no upgrade code, keep the version the same as the 
previous version
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0 = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0 = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0;
 // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the 
MIN_SYSTEM_TABLE_TIMESTAMP_* constants
-public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0;
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
@@ -112,6 +113,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_10_0, "4.10.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0, "4.11.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0, "4.12.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0, "4.13.x");
 }
 
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 



[21/40] phoenix git commit: Revert "PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter (fix test failures)"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4322 DESC primary key column with variable length does not work 
in SkipScanFilter (fix test failures)"

This reverts commit 45a9c275dbbf9206264236c690f40c309d97da3c.


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 1b46b60382d37033128df1df4653f9facd07d94e
Parents: 698b074
Author: James Taylor 
Authored: Mon Oct 30 19:24:36 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b46b603/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 3fe8ad3..8ab4f20 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -434,7 +434,7 @@ public class ScanUtil {
 // The result of an RVC evaluation can come with a trailing 
separator already, so we
 // should avoid adding another one.
 if ( !isFixedWidth
-&& ( bytes.length == 0 || slotSpan[i] == 0 || key[offset - 
1] != sepByte )
+&& ( bytes.length == 0 || key[offset - 1] != sepByte )
 && ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {



[07/40] phoenix git commit: PHOENIX-4329 Test IndexScrutinyTool while table is taking writes (Vincent Poon)

2017-11-15 Thread jamestaylor
PHOENIX-4329 Test IndexScrutinyTool while table is taking writes (Vincent Poon)


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 798ebb4a7037009e57bca771a436e1135e39e0c1
Parents: a918955
Author: James Taylor 
Authored: Sun Oct 29 15:20:23 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../phoenix/end2end/IndexScrutinyToolIT.java| 101 ++-
 1 file changed, 96 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/798ebb4a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
index 10595a7..cbce7b2 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
@@ -36,6 +36,9 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.TreeSet;
 import java.util.UUID;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 import com.google.common.collect.Sets;
 import org.apache.commons.io.IOUtils;
@@ -43,6 +46,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.mapreduce.Counters;
 import org.apache.hadoop.mapreduce.Job;
@@ -103,6 +107,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 private PreparedStatement indexTableUpsertStmt;
 
 private long testTime;
+private Properties props;
 
 @Parameterized.Parameters
 public static Collection data() {
@@ -120,8 +125,11 @@ public class IndexScrutinyToolIT extends BaseTest {
 
 @BeforeClass
 public static void doSetup() throws Exception {
-Map props = Maps.newHashMap();
-setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+Map serverProps = Maps.newHashMap();
+//disable major compactions
+serverProps.put(HConstants.MAJOR_COMPACTION_PERIOD, "0");
+Map clientProps = Maps.newHashMap();
+setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
 }
 
 /**
@@ -133,7 +141,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 createTestTable(getUrl(), String.format(dataTableDdl, 
dataTableFullName));
 createTestTable(getUrl(),
 String.format(indexTableDdl, indexTableName, dataTableFullName));
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 conn = DriverManager.getConnection(getUrl(), props);
 String dataTableUpsert = String.format(UPSERT_SQL, dataTableFullName);
 dataTableUpsertStmt = conn.prepareStatement(dataTableUpsert);
@@ -141,6 +149,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 indexTableUpsertStmt = conn.prepareStatement(indexTableUpsert);
 conn.setAutoCommit(false);
 testTime = EnvironmentEdgeManager.currentTimeMillis() - 1000;
+
 }
 
 @After
@@ -177,6 +186,77 @@ public class IndexScrutinyToolIT extends BaseTest {
 }
 
 /**
+ * Tests running a scrutiny while updates and deletes are happening.
+ * Since CURRENT_SCN is set, the scrutiny shouldn't report any issue.
+ */
+@Test
+public void testScrutinyWhileTakingWrites() throws Exception {
+int id = 0;
+while (id < 1000) {
+int index = 1;
+dataTableUpsertStmt.setInt(index++, id);
+dataTableUpsertStmt.setString(index++, "name-" + id);
+dataTableUpsertStmt.setInt(index++, id);
+dataTableUpsertStmt.setTimestamp(index++, new Timestamp(testTime));
+dataTableUpsertStmt.executeUpdate();
+id++;
+}
+conn.commit();
+
+//CURRENT_SCN for scrutiny
+long scrutinyTS = EnvironmentEdgeManager.currentTimeMillis();
+
+// launch background upserts and deletes
+final Random random = new Random(0);
+Runnable 

[05/40] phoenix git commit: Revert "PHOENIX-4198 Remove the need for users to have access to the Phoenix SYSTEM tables to create tables"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4198 Remove the need for users to have access to the Phoenix 
SYSTEM tables to create tables"

This reverts commit f4489cfc16819d90639706f27d3bfc15c98fc881.


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

Branch: refs/heads/4.x-HBase-1.2
Commit: fa3884a02e70edad341a6adec2218759b340ef29
Parents: fd88b74
Author: James Taylor 
Authored: Wed Nov 15 09:56:03 2017 -0800
Committer: James Taylor 
Committed: Wed Nov 15 09:56:03 2017 -0800

--
 .../phoenix/end2end/TableDDLPermissionsIT.java  | 692 ---
 .../org/apache/hadoop/hbase/ipc/RpcUtil.java|  32 -
 .../BaseMetaDataEndpointObserver.java   | 111 ---
 .../coprocessor/MetaDataEndpointImpl.java   | 339 ++---
 .../coprocessor/MetaDataEndpointObserver.java   |  68 --
 .../coprocessor/MetaDataRegionObserver.java |  17 +-
 .../coprocessor/PhoenixAccessController.java| 628 -
 .../PhoenixMetaDataCoprocessorHost.java | 236 ---
 .../index/PhoenixIndexFailurePolicy.java| 109 ++-
 .../query/ConnectionQueryServicesImpl.java  |  15 +-
 .../org/apache/phoenix/query/QueryServices.java |   4 -
 .../phoenix/query/QueryServicesOptions.java |  14 +-
 .../phoenix/schema/stats/StatisticsWriter.java  |  42 +-
 .../org/apache/phoenix/util/MetaDataUtil.java   |  18 -
 .../org/apache/phoenix/util/SchemaUtil.java |  12 -
 15 files changed, 141 insertions(+), 2196 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fa3884a0/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
deleted file mode 100644
index 971383b..000
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableDDLPermissionsIT.java
+++ /dev/null
@@ -1,692 +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.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.lang.reflect.UndeclaredThrowableException;
-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.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.AuthUtil;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.NamespaceDescriptor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.security.AccessDeniedException;
-import org.apache.hadoop.hbase.security.access.AccessControlClient;
-import org.apache.hadoop.hbase.security.access.Permission.Action;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.phoenix.exception.PhoenixIOException;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.util.MetaDataUtil;
-import org.apache.phoenix.util.SchemaUtil;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import 

[03/40] phoenix git commit: PHOENIX-4295 Fix argument order for StatsCollectorIT derived classes

2017-11-15 Thread jamestaylor
PHOENIX-4295 Fix argument order for StatsCollectorIT derived classes


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

Branch: refs/heads/4.x-HBase-1.2
Commit: fd88b74921e306ef78770c48e681b279ee757ea1
Parents: b605c19
Author: James Taylor 
Authored: Wed Oct 18 09:29:44 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 09:54:39 2017 -0800

--
 .../end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java| 4 ++--
 .../end2end/ColumnEncodedImmutableTxStatsCollectorIT.java   | 5 ++---
 .../end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java  | 5 ++---
 .../phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java | 5 ++---
 .../end2end/NonColumnEncodedImmutableNonTxStatsCollectorIT.java | 5 ++---
 .../end2end/NonColumnEncodedImmutableTxStatsCollectorIT.java| 5 ++---
 .../end2end/SysTableNamespaceMappedStatsCollectorIT.java| 3 +--
 7 files changed, 13 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd88b749/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
index 7ef825e..d5d8442 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
@@ -29,10 +29,10 @@ public class ColumnEncodedImmutableNonTxStatsCollectorIT 
extends StatsCollectorI
 super(mutable, transactional, userTableNamespaceMapped, columnEncoded);
 }
 
-@Parameters(name="columnEncoded = {0}, mutable = {1}, transactional = {2}, 
isUserTableNamespaceMapped = {3}")
+@Parameters(name = "mutable = {0}, transactional = {1}, 
isUserTableNamespaceMapped = {2}, columnEncoded = {3}")
 public static Collection data() {
 return Arrays.asList(new Boolean[][] { 
-{ true, false, false, false }, { true, false, false, true }
+{ false, false, false, true }, { false, false, true, true }
 });
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd88b749/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
index 0c6934b..23b1654 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
@@ -29,10 +29,9 @@ public class ColumnEncodedImmutableTxStatsCollectorIT 
extends StatsCollectorIT {
 super(mutable, transactional, userTableNamespaceMapped, columnEncoded);
 }
 
-@Parameters(
-name = "columnEncoded = {0}, mutable = {1}, transactional = {2}, 
isUserTableNamespaceMapped = {3}")
+@Parameters(name = "mutable = {0}, transactional = {1}, 
isUserTableNamespaceMapped = {2}, columnEncoded = {3}")
 public static Collection data() {
 return Arrays.asList(
-new Boolean[][] { { true, false, true, false }, { true, false, 
true, true }, });
+new Boolean[][] { { false, true, false, true }, { false, true, 
true, true }, });
 }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd88b749/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
index 3cd81c7..24869a2 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
@@ -29,10 +29,9 @@ public class ColumnEncodedMutableNonTxStatsCollectorIT 
extends StatsCollectorIT
 super(mutable, transactional, 

[23/40] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table

2017-11-15 Thread jamestaylor
PHOENIX-4332 Indexes should inherit guide post width of the base data table


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 7bea88dd81b95d162aa9b79f4c788967d523acda
Parents: 32beb70
Author: Samarth Jain 
Authored: Wed Nov 1 23:24:52 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 ...mnEncodedImmutableNonTxStatsCollectorIT.java |   1 +
 ...olumnEncodedImmutableTxStatsCollectorIT.java |   1 +
 ...lumnEncodedMutableNonTxStatsCollectorIT.java |   1 +
 .../ColumnEncodedMutableTxStatsCollectorIT.java |   1 +
 ...mnEncodedImmutableNonTxStatsCollectorIT.java |   1 +
 ...olumnEncodedImmutableTxStatsCollectorIT.java |   1 +
 .../phoenix/end2end/StatsCollectorIT.java   | 734 
 ...SysTableNamespaceMappedStatsCollectorIT.java |   1 +
 .../phoenix/schema/stats/StatsCollectorIT.java  | 832 +++
 .../stats/DefaultStatisticsCollector.java   |  58 +-
 10 files changed, 895 insertions(+), 736 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7bea88dd/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
index d5d8442..eb01e89 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.end2end;
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.phoenix.schema.stats.StatsCollectorIT;
 import org.junit.runners.Parameterized.Parameters;
 
 public class ColumnEncodedImmutableNonTxStatsCollectorIT extends 
StatsCollectorIT {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7bea88dd/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
index 23b1654..4e90d70 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.end2end;
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.phoenix.schema.stats.StatsCollectorIT;
 import org.junit.runners.Parameterized.Parameters;
 
 public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT 
{

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7bea88dd/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
index 24869a2..2a560db 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java
@@ -20,6 +20,7 @@ package org.apache.phoenix.end2end;
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.phoenix.schema.stats.StatsCollectorIT;
 import org.junit.runners.Parameterized.Parameters;
 
 public class ColumnEncodedMutableNonTxStatsCollectorIT extends 
StatsCollectorIT {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7bea88dd/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
index eea591d..01fa2b5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java
+++ 

[14/40] phoenix git commit: PHOENIX-3757 System mutex table not being created in SYSTEM namespace when namespace mapping is enabled

2017-11-15 Thread jamestaylor
PHOENIX-3757 System mutex table not being created in SYSTEM namespace when 
namespace mapping is enabled


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 7111d31e036b8c6e419212695810e62864c19a3b
Parents: a8a1abc
Author: Karan Mehta 
Authored: Thu Oct 26 11:32:14 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../MigrateSystemTablesToSystemNamespaceIT.java | 402 +++
 .../end2end/SystemTablePermissionsIT.java   |   3 +-
 .../phoenix/coprocessor/MetaDataProtocol.java   |   3 +
 .../exception/UpgradeInProgressException.java   |   8 +-
 .../query/ConnectionQueryServicesImpl.java  | 184 ++---
 .../org/apache/phoenix/util/UpgradeUtil.java|  44 +-
 .../query/ConnectionQueryServicesImplTest.java  |   9 +-
 7 files changed, 572 insertions(+), 81 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7111d31e/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
new file mode 100644
index 000..91e34be
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MigrateSystemTablesToSystemNamespaceIT.java
@@ -0,0 +1,402 @@
+/*
+ * 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 org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.exception.UpgradeInProgressException;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+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.schema.PTableType;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import 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"));
+private static final Set PHOENIX_NAMESPACE_MAPPED_SYSTEM_TABLES = 
new HashSet<>(
+Arrays.asList("SYSTEM:CATALOG", "SYSTEM:SEQUENCE", "SYSTEM:STATS", 
"SYSTEM:FUNCTION",
+"SYSTEM:MUTEX"));
+private static final String SCHEMA_NAME = "MIGRATETEST";
+private static final String TABLE_NAME =
+SCHEMA_NAME + "." + 
MigrateSystemTablesToSystemNamespaceIT.class.getSimpleName().toUpperCase();
+private static final int NUM_RECORDS = 5;
+
+private HBaseTestingUtility testUtil = null;
+

[12/40] phoenix git commit: PHOENIX-4277 Treat delete markers consistently with puts for point-in-time scans

2017-11-15 Thread jamestaylor
PHOENIX-4277 Treat delete markers consistently with puts for point-in-time scans


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

Branch: refs/heads/4.x-HBase-1.2
Commit: a91895558b5cb37db5efae023c59550c2b168e28
Parents: 2135207
Author: James Taylor 
Authored: Sun Oct 29 15:19:23 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../phoenix/end2end/PointInTimeQueryIT.java |  2 +-
 .../hadoop/hbase/regionserver/ScanInfoUtil.java | 35 
 .../coprocessor/BaseScannerRegionObserver.java  | 21 
 .../apache/phoenix/util/TransactionUtil.java|  7 ++--
 4 files changed, 62 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9189555/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
index c53e523..ed3e8a9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PointInTimeQueryIT.java
@@ -63,7 +63,7 @@ public class PointInTimeQueryIT extends BaseQueryIT {
 public PointInTimeQueryIT(String idxDdl, boolean columnEncoded)
 throws Exception {
 // These queries fail without KEEP_DELETED_CELLS=true
-super(idxDdl, columnEncoded, true);
+super(idxDdl, columnEncoded, false);
 }
 
 @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9189555/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
new file mode 100644
index 000..9885c78
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
@@ -0,0 +1,35 @@
+/*
+ * 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.hadoop.hbase.regionserver;
+
+import org.apache.hadoop.hbase.KeepDeletedCells;
+
+public class ScanInfoUtil {
+private ScanInfoUtil() {
+}
+
+public static boolean isKeepDeletedCells(ScanInfo scanInfo) {
+return scanInfo.getKeepDeletedCells() != KeepDeletedCells.FALSE;
+}
+
+public static ScanInfo cloneScanInfoWithKeepDeletedCells(ScanInfo 
scanInfo) {
+return new ScanInfo(scanInfo.getConfiguration(), scanInfo.getFamily(), 
Math.max(scanInfo.getMinVersions(), 1),
+scanInfo.getMaxVersions(), scanInfo.getTtl(), 
KeepDeletedCells.TRUE,
+scanInfo.getTimeToPurgeDeletes(), 
scanInfo.getComparator());
+}
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9189555/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 0022a0b..1c18a34 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
@@ -19,10 +19,12 @@ package org.apache.phoenix.coprocessor;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.NavigableSet;
 
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import 

[18/40] phoenix git commit: PHOENIX-4287 Addendum to correctly set useStatsForParallelization property

2017-11-15 Thread jamestaylor
PHOENIX-4287 Addendum to correctly set useStatsForParallelization property


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 4fdf70824d66f4eb897ece3cebf4b150c422e738
Parents: 2dab4f6
Author: Samarth Jain 
Authored: Wed Nov 1 21:13:40 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 87 +---
 .../coprocessor/MetaDataEndpointImpl.java   |  2 +-
 .../phoenix/iterate/BaseResultIterators.java|  9 +-
 .../apache/phoenix/schema/DelegateTable.java|  2 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 26 +++---
 .../java/org/apache/phoenix/schema/PTable.java  |  2 +-
 .../org/apache/phoenix/schema/PTableImpl.java   | 22 ++---
 7 files changed, 110 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4fdf7082/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 25d4194..b5e4588 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,7 +17,6 @@
  */
 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,6 +33,7 @@ import java.util.List;
 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.query.BaseTest;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
@@ -352,7 +352,7 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 }
 
 @Test
-public void testSettingUseStatsForQueryPlanProperty() throws Exception {
+public void testSettingUseStatsForParallelizationProperty() throws 
Exception {
 try (Connection conn = DriverManager.getConnection(getUrl())) {
 String table = generateUniqueName();
 String ddl =
@@ -360,20 +360,31 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 
VARCHAR) USE_STATS_FOR_PARALLELIZATION = false";
 conn.createStatement().execute(ddl);
 assertUseStatsForQueryFlag(table, 
conn.unwrap(PhoenixConnection.class), false);
+
 ddl = "ALTER TABLE " + table + " SET USE_STATS_FOR_PARALLELIZATION 
= true";
 conn.createStatement().execute(ddl);
 assertUseStatsForQueryFlag(table, 
conn.unwrap(PhoenixConnection.class), true);
+
+table = generateUniqueName();
+ddl =
+"CREATE TABLE " + table
++ " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 
VARCHAR) USE_STATS_FOR_PARALLELIZATION = false";
+conn.createStatement().execute(ddl);
+assertUseStatsForQueryFlag(table, 
conn.unwrap(PhoenixConnection.class), false);
+
 table = generateUniqueName();
 ddl = "CREATE TABLE " + table + " (PK1 INTEGER NOT NULL PRIMARY 
KEY, KV1 VARCHAR)";
 conn.createStatement().execute(ddl);
-assertUseStatsForQueryFlag(table, 
conn.unwrap(PhoenixConnection.class),
-DEFAULT_USE_STATS_FOR_PARALLELIZATION);
+
+// because we didn't set the property, 
PTable.useStatsForParallelization() should return
+// null
+assertUseStatsForQueryFlag(table, 
conn.unwrap(PhoenixConnection.class), null);
 }
 }
 
 private static void assertUseStatsForQueryFlag(String tableName, 
PhoenixConnection conn,
-boolean flag) throws TableNotFoundException, SQLException {
-assertEquals(flag,
+Boolean expected) throws TableNotFoundException, SQLException {
+assertEquals(expected,
 conn.unwrap(PhoenixConnection.class).getMetaDataCache()
 .getTableRef(new PTableKey(null, 

[16/40] phoenix git commit: PHOENIX-4242 Fix Indexer post-compact hook logging of NPE and TableNotFound

2017-11-15 Thread jamestaylor
PHOENIX-4242 Fix Indexer post-compact hook logging of NPE and TableNotFound


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 632cbba8914ed541c89ba4930b1b549709a237b9
Parents: 3b536f4
Author: Vincent Poon 
Authored: Thu Oct 19 14:28:27 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../UngroupedAggregateRegionObserverIT.java | 171 +++
 .../UngroupedAggregateRegionObserver.java   | 103 ++-
 .../org/apache/phoenix/hbase/index/Indexer.java |  52 --
 .../apache/phoenix/schema/MetaDataClient.java   |   3 +
 4 files changed, 239 insertions(+), 90 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/632cbba8/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
new file mode 100644
index 000..3efd40e
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverIT.java
@@ -0,0 +1,171 @@
+/*
+ * 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.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.schema.PIndexState;
+import org.apache.phoenix.util.EnvironmentEdgeManager;
+import org.apache.phoenix.util.IndexUtil;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class UngroupedAggregateRegionObserverIT extends 
ParallelStatsDisabledIT {
+
+private String dataTableName;
+private String indexTableName;
+private String schemaName;
+private String dataTableFullName;
+private static String indexTableFullName;
+
+@Mock
+private Appender mockAppender;
+
+@Captor
+private ArgumentCaptor captorLoggingEvent;
+private UngroupedAggregateRegionObserver ungroupedObserver;
+
+@Before
+public void setup() {
+ungroupedObserver = new UngroupedAggregateRegionObserver();
+
ungroupedObserver.setCompactionConfig(PropertiesUtil.cloneConfig(config));
+}
+
+/**
+ * Tests the that post compact hook doesn't log any NPE for a System table
+ */
+@Test
+public void testPostCompactSystemSequence() throws Exception {
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+startCapturingIndexLog();
+// run the post-compact hook
+ungroupedObserver.clearTsOnDisabledIndexes("SYSTEM.SEQUENCE");
+stopCapturingIndexLog();
+// uneventful - nothing should be logged
+Mockito.verify(mockAppender, never())
+.doAppend((LoggingEvent) captorLoggingEvent.capture());
+}

[02/40] phoenix git commit: PHOENIX-4294 Allow scalar function to declare that it's not thread safe

2017-11-15 Thread jamestaylor
PHOENIX-4294 Allow scalar function to declare that it's not thread safe


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

Branch: refs/heads/4.x-HBase-1.2
Commit: b605c19e3f039407f79c0231c64cb602ddebc7ca
Parents: 1fc5b27
Author: James Taylor 
Authored: Wed Oct 18 09:28:31 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 09:54:15 2017 -0800

--
 .../apache/phoenix/expression/function/ScalarFunction.java  | 9 +
 .../phoenix/expression/visitor/CloneExpressionVisitor.java  | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b605c19e/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
index 4f44cde..2a5fe44 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ScalarFunction.java
@@ -87,4 +87,13 @@ public abstract class ScalarFunction extends 
FunctionExpression {
 public KeyPart newKeyPart(KeyPart childPart) {
 return null;
 }
+
+/**
+ * Used to determine if the same ScalarFunction instance may be
+ * used by multiple threads. 
+ * @return true if function is thread safe and false otherwise.
+ */
+public boolean isThreadSafe() {
+return true;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b605c19e/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
index e47fb64..c6d7c9e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneExpressionVisitor.java
@@ -110,7 +110,7 @@ public abstract class CloneExpressionVisitor extends 
TraverseAllExpressionVisito
 
 @Override
 public Expression visitLeave(ScalarFunction node, List l) {
-return isCloneNode(node, l) ? node.clone(l) : node;
+return isCloneNode(node, l) || !node.isThreadSafe() ? node.clone(l) : 
node;
 }
 
 public Expression visitLeave(UDFExpression node, List l) {



[10/40] phoenix git commit: PHOENIX-4269 IndexScrutinyToolIT is flapping

2017-11-15 Thread jamestaylor
PHOENIX-4269 IndexScrutinyToolIT is flapping


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 7649866e15780b4e3d1c8068fe4fcdd5ac83236f
Parents: 632cbba
Author: Vincent Poon 
Authored: Thu Oct 19 15:54:11 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../phoenix/end2end/IndexScrutinyToolIT.java| 61 ++--
 1 file changed, 30 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7649866e/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
index f2384ec..10595a7 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexScrutinyToolIT.java
@@ -56,6 +56,7 @@ import 
org.apache.phoenix.mapreduce.index.SourceTargetColumnNames;
 import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -107,7 +108,9 @@ public class IndexScrutinyToolIT extends BaseTest {
 public static Collection data() {
 return Arrays.asList(new Object[][] {
 { "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR)", "CREATE LOCAL INDEX %s 
ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" },
-{ "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR) SALT_BUCKETS=2", "CREATE 
INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" } });
+{ "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR) SALT_BUCKETS=2", "CREATE 
INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" },
+{ "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, 
ZIP INTEGER, EMPLOY_DATE TIMESTAMP, EMPLOYER VARCHAR) SALT_BUCKETS=2", "CREATE 
LOCAL INDEX %s ON %s (NAME, EMPLOY_DATE) INCLUDE (ZIP)" }
+});
 }
 
 public IndexScrutinyToolIT(String dataTableDdl, String indexTableDdl) {
@@ -137,7 +140,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 String indexTableUpsert = String.format(INDEX_UPSERT_SQL, 
indexTableFullName);
 indexTableUpsertStmt = conn.prepareStatement(indexTableUpsert);
 conn.setAutoCommit(false);
-testTime = System.currentTimeMillis();
+testTime = EnvironmentEdgeManager.currentTimeMillis() - 1000;
 }
 
 @After
@@ -257,8 +260,7 @@ public class IndexScrutinyToolIT extends BaseTest {
 
 // run scrutiny with batch size of 10
 List completedJobs =
-runScrutiny(schemaName, dataTableName, indexTableName, 
System.currentTimeMillis(),
-10L);
+runScrutiny(schemaName, dataTableName, indexTableName, 10L);
 Job job = completedJobs.get(0);
 assertTrue(job.isSuccessful());
 Counters counters = job.getCounters();
@@ -305,8 +307,8 @@ public class IndexScrutinyToolIT extends BaseTest {
 conn.commit();
 
 List completedJobs =
-runScrutiny(schemaName, dataTableName, indexTableName, 
System.currentTimeMillis(),
-10L, SourceTable.INDEX_TABLE_SOURCE);
+runScrutiny(schemaName, dataTableName, indexTableName, 10L,
+SourceTable.INDEX_TABLE_SOURCE);
 Job job = completedJobs.get(0);
 assertTrue(job.isSuccessful());
 Counters counters = job.getCounters();
@@ -334,8 +336,8 @@ public class IndexScrutinyToolIT extends BaseTest {
 conn.commit();
 
 List completedJobs =
-runScrutiny(schemaName, dataTableName, indexTableName, 
System.currentTimeMillis(),
-10L, SourceTable.BOTH);
+runScrutiny(schemaName, dataTableName, indexTableName, 10L,
+SourceTable.BOTH);
 assertEquals(2, completedJobs.size());
 for (Job job : completedJobs) {
 assertTrue(job.isSuccessful());
@@ -353,8 +355,8 @@ 

[37/40] phoenix git commit: PHOENIX-4351 Add i18n-util to bin LICENSE file and to dependencyManagement

2017-11-15 Thread jamestaylor
PHOENIX-4351 Add i18n-util to bin LICENSE file and to dependencyManagement


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 2c43068118f6606304f3575ff4bf18a393a1d25f
Parents: be8021b
Author: Josh Elser 
Authored: Mon Nov 6 15:21:35 2017 -0500
Committer: James Taylor 
Committed: Wed Nov 15 10:02:15 2017 -0800

--
 dev/release_files/LICENSE | 2 ++
 phoenix-core/pom.xml  | 3 +--
 pom.xml   | 5 +
 3 files changed, 8 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c430681/dev/release_files/LICENSE
--
diff --git a/dev/release_files/LICENSE b/dev/release_files/LICENSE
index a72ce86..0fd0255 100644
--- a/dev/release_files/LICENSE
+++ b/dev/release_files/LICENSE
@@ -254,6 +254,8 @@ Janino Compiler (https://github.com/janino-compiler/janino)
 
 Hamcrest-core 1.3 (http://www.hamcrest.org) Copyright (c) 2000-2006, 
www.hamcrest.org
 
+i18n-util 1.0.1 (https://github.com/salesforce/i18n-util) Copyright (c) 2017, 
Salesforce.com, Inc. All rights reserved.
+
 ---
 
 This product bundles the following products which are licensed with

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c430681/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 0bdcc07..93fc70b 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -471,10 +471,9 @@
   stream
   ${stream.version}
 
- 
+
   com.salesforce.i18n
   i18n-util
-  1.0.1
 
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c430681/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 07fe1b3..7d2295c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -927,6 +927,11 @@
 stream
 ${stream.version}
   
+  
+com.salesforce.i18n
+i18n-util
+1.0.1
+  
 
   
 



[38/40] phoenix git commit: PHOENIX-4291 Addendum - Merge release script for mac and linux

2017-11-15 Thread jamestaylor
PHOENIX-4291 Addendum - Merge release script for mac and linux


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

Branch: refs/heads/4.x-HBase-1.2
Commit: be8021b0e14085a10ad4431ed3c76594dbd85941
Parents: 83a4bc2
Author: Mujtaba 
Authored: Fri Nov 3 13:41:45 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:15 2017 -0800

--
 dev/make_rc.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/be8021b0/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index 31cb9f9..638968c 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -81,7 +81,7 @@ cp bin/* $DIR_BIN;
 cp -R $DIR_PHERF_CONF $DIR_BIN;
 
 # Copy release docs
-cp README $DIR_REL_BIN_PATH;
+cp README* $DIR_REL_BIN_PATH;
 cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 
 # Copy examples



[32/40] phoenix git commit: PHOENIX-4290 Full table scan performed for DELETE with table having immutable indexes

2017-11-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc955cca/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
index f88b34b..b5293bb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
@@ -17,8 +17,6 @@
  */
 package org.apache.phoenix.compile;
 
-import static 
org.apache.phoenix.schema.PTable.QualifierEncodingScheme.NON_ENCODED_QUALIFIERS;
-
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.util.ArrayList;
@@ -66,6 +64,7 @@ import org.apache.phoenix.schema.ColumnNotFoundException;
 import org.apache.phoenix.schema.ColumnRef;
 import org.apache.phoenix.schema.FunctionNotFoundException;
 import org.apache.phoenix.schema.MetaDataClient;
+import org.apache.phoenix.schema.MetaDataEntityNotFoundException;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PColumnFamily;
 import org.apache.phoenix.schema.PColumnFamilyImpl;
@@ -73,9 +72,9 @@ import org.apache.phoenix.schema.PColumnImpl;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PNameFactory;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.ImmutableStorageScheme;
 import org.apache.phoenix.schema.PTable.IndexType;
 import org.apache.phoenix.schema.PTable.QualifierEncodingScheme;
-import org.apache.phoenix.schema.PTable.ImmutableStorageScheme;
 import org.apache.phoenix.schema.PTableImpl;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.PTableType;
@@ -871,7 +870,9 @@ public class FromCompiler {
 TableRef tableRef = iterator.next();
 try {
 PColumnFamily columnFamily = 
tableRef.getTable().getColumnFamily(cfName);
-if (theColumnFamilyRef != null) { throw new 
TableNotFoundException(cfName); }
+if (columnFamily == null) { 
+throw new TableNotFoundException(cfName); 
+}
 theColumnFamilyRef = new ColumnFamilyRef(tableRef, 
columnFamily);
 } catch (ColumnFamilyNotFoundException e) {}
 }
@@ -914,10 +915,42 @@ public class FromCompiler {
 PColumn column = 
tableRef.getTable().getColumnForColumnName(colName);
 return new ColumnRef(tableRef, column.getPosition());
 } catch (TableNotFoundException e) {
-// Try using the tableName as a columnFamily reference 
instead
-ColumnFamilyRef cfRef = resolveColumnFamily(schemaName, 
tableName);
-PColumn column = 
cfRef.getFamily().getPColumnForColumnName(colName);
-return new ColumnRef(cfRef.getTableRef(), 
column.getPosition());
+TableRef theTableRef = null;
+PColumn theColumn = null;
+PColumnFamily theColumnFamily = null;
+if (schemaName != null) {
+try {
+// Try schemaName as the tableName and use 
tableName as column family name
+theTableRef = resolveTable(null, schemaName);
+theColumnFamily = 
theTableRef.getTable().getColumnFamily(tableName);
+theColumn = 
theColumnFamily.getPColumnForColumnName(colName);
+} catch (MetaDataEntityNotFoundException e2) {
+}
+} 
+if (theColumn == null) {
+// Try using the tableName as a columnFamily reference 
instead
+// and resolve column in each column family.
+Iterator iterator = tables.iterator();
+while (iterator.hasNext()) {
+TableRef tableRef = iterator.next();
+try {
+PColumnFamily columnFamily = 
tableRef.getTable().getColumnFamily(tableName);
+PColumn column = 
columnFamily.getPColumnForColumnName(colName);
+if (theColumn != null) {
+throw new 
AmbiguousColumnException(colName);
+}
+theTableRef = tableRef;
+theColumnFamily = columnFamily;
+theColumn = column;
+} catch (MetaDataEntityNotFoundException e1) {
+}
+}
+   

[30/40] phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view

2017-11-15 Thread jamestaylor
PHOENIX-4287 Make indexes inherit use stats property from their parent table or 
view


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 6ee2241ded748243ff3d0c7ed5a8fdb0b0528cdf
Parents: 204a7aa
Author: Samarth Jain 
Authored: Thu Nov 2 16:55:55 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 146 +--
 .../phoenix/iterate/BaseResultIterators.java|  41 +-
 2 files changed, 171 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6ee2241d/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 e76b147..bfc6819 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
@@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 private static void createIndex(String indexName, String table, long 
guidePostWidth)
 throws Exception {
 try (Connection conn = DriverManager.getConnection(getUrl())) {
-conn.createStatement().execute("CREATE INDEX " + indexName + " ON 
" + table
-+ " (c1.a) INCLUDE (c2.b) ");
+conn.createStatement().execute(
+"CREATE INDEX " + indexName + " ON " + table + " (c1.a) 
INCLUDE (c2.b) ");
 conn.createStatement().execute("UPDATE STATISTICS " + indexName);
 }
 }
@@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 Estimate info = getByteRowEstimates(conn, sql, binds);
 assertEquals((Long) 10l, info.getEstimatedRows());
 assertTrue(info.getEstimateInfoTs() > 0);
-
+
 // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table
-conn.createStatement().execute("ALTER TABLE " + tableName + " SET 
USE_STATS_FOR_PARALLELIZATION = " + false);
+conn.createStatement().execute(
+"ALTER TABLE " + tableName + " SET 
USE_STATS_FOR_PARALLELIZATION = " + false);
 rs = conn.createStatement().executeQuery(sql);
 // stats are not being used for parallelization. So number of 
scans is lower.
 assertEquals(4, 
rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan()
@@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 info = getByteRowEstimates(conn, sql, binds);
 assertEquals((Long) 10l, info.getEstimatedRows());
 assertTrue(info.getEstimateInfoTs() > 0);
-
+
 // assert that the aggregate query on view also works correctly
 String viewName = "V_" + generateUniqueName();
-conn.createStatement()
-.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " 
+ tableName + " USE_STATS_FOR_PARALLELIZATION = false");
+conn.createStatement().execute("CREATE VIEW " + viewName + " AS 
SELECT * FROM "
++ tableName + " USE_STATS_FOR_PARALLELIZATION = false");
 sql = "SELECT COUNT(*) FROM " + viewName;
 rs = conn.createStatement().executeQuery(sql);
 // stats are not being used for parallelization. So number of 
scans is lower.
@@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 rs = conn.createStatement().executeQuery(sql);
 // stats are being used for parallelization. So number of scans is 
higher.
 assertEquals(14, 
rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan()
-.getScans().get(0).size());
+.getScans().get(0).size());
 assertTrue(rs.next());
 assertEquals(10, rs.getInt(1));
 info = getByteRowEstimates(conn, sql, binds);
 assertEquals((Long) 10l, info.getEstimatedRows());
 assertTrue(info.getEstimateInfoTs() > 0);
 
-conn.createStatement().execute(
-"ALTER TABLE " + viewName + " SET 
USE_STATS_FOR_PARALLELIZATION=true");
+

[28/40] phoenix git commit: PHOENIX-4237 Allow sorting on (Java) collation keys for non-English locales (Shehzaad Nakhoda)

2017-11-15 Thread jamestaylor
PHOENIX-4237 Allow sorting on (Java) collation keys for non-English locales 
(Shehzaad Nakhoda)


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

Branch: refs/heads/4.x-HBase-1.2
Commit: c77f3ba2bcbb10ea4a4b3b65e6bd57c7a9cba750
Parents: 7062a48
Author: James Taylor 
Authored: Fri Nov 3 09:17:29 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 LICENSE |  43 ++--
 phoenix-core/pom.xml|   5 +
 .../phoenix/end2end/CollationKeyFunctionIT.java | 181 ++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../function/CollationKeyFunction.java  | 199 +++
 .../apache/phoenix/jdbc/PhoenixConnection.java  |   3 +
 .../apache/phoenix/util/VarBinaryFormatter.java |  52 
 .../function/CollationKeyFunctionTest.java  | 243 +++
 phoenix-server/pom.xml  |   1 +
 9 files changed, 713 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c77f3ba2/LICENSE
--
diff --git a/LICENSE b/LICENSE
index 08e5e10..7bd8ad1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -236,23 +236,32 @@ Font Awesome fonts (http://fontawesome.io/)
 
 3-Clause BSD License:
 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ---
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c77f3ba2/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 6f3adb4..f82cddc 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -471,5 +471,10 @@
   stream
   ${stream.version}
 
+ 
+  com.salesforce.i18n
+  i18n-util
+  1.0.1
+
   
 

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

[34/40] phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization

2017-11-15 Thread jamestaylor
PHOENIX-4287 Incorrect aggregate query results when stats are disable for 
parallelization


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

Branch: refs/heads/4.x-HBase-1.2
Commit: f8274c6688bfd0792a70cd4d03ea175318a29ac8
Parents: cc955cc
Author: Samarth Jain 
Authored: Tue Oct 31 10:12:22 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 209 ++-
 .../phoenix/iterate/BaseResultIterators.java|  55 +++--
 2 files changed, 246 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f8274c66/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 62538af..931c398 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
@@ -20,6 +20,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;
 import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
@@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 @Test
 public void testBytesRowsForSelectOnTenantViews() throws Exception {
 String tenant1View = generateUniqueName();
-;
 String tenant2View = generateUniqueName();
-;
 String tenant3View = generateUniqueName();
-;
 String multiTenantBaseTable = generateUniqueName();
 String tenant1 = "tenant1";
 String tenant2 = "tenant2";
@@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 }
 }
 
+@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287
+public void testEstimatesForAggregateQueries() throws Exception {
+String tableName = generateUniqueName();
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+int guidePostWidth = 20;
+String ddl =
+"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a 
bigint, b bigint)"
++ " GUIDE_POSTS_WIDTH=" + guidePostWidth
++ ", USE_STATS_FOR_PARALLELIZATION=false";
+byte[][] splits =
+new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), 
Bytes.toBytes(108) };
+BaseTest.createTestTable(getUrl(), ddl, splits, null);
+conn.createStatement().execute("upsert into " + tableName + " 
values (100,1,3)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (101,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (102,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (103,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (104,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (105,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (106,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (107,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (108,2,4)");
+conn.createStatement().execute("upsert into " + tableName + " 
values (109,2,4)");
+conn.commit();
+conn.createStatement().execute("UPDATE STATISTICS " + tableName + 
"");
+}
+List binds = Lists.newArrayList();
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+String sql = "SELECT COUNT(*) " + " FROM " + tableName;
+ResultSet rs = conn.createStatement().executeQuery(sql);
+assertTrue(rs.next());
+assertEquals(10, rs.getInt(1));
+Estimate info = getByteRowEstimates(conn, sql, binds);
+assertEquals((Long) 10l, info.getEstimatedRows());
+assertTrue(info.getEstimateInfoTs() > 0);
+
+   

[35/40] phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views

2017-11-15 Thread jamestaylor
PHOENIX-4333 Test to demonstrate partial stats information for tenant views


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 0e97de5ab44e28208f923cd3946602e5f755271c
Parents: f8274c6
Author: Samarth Jain 
Authored: Tue Oct 31 14:14:56 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 95 
 1 file changed, 95 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0e97de5a/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 931c398..25d4194 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
@@ -31,6 +31,7 @@ import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.BaseTest;
@@ -782,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 this.time += t;
 }
 }
+
+@Test
+public void testPartialStatsForTenantViews() throws Exception {
+String tenant1View = generateUniqueName();
+String tenant2View = generateUniqueName();
+String multiTenantTable = generateUniqueName();
+String tenantId1 = "00Dabcdetenant1";
+String tenantId2 = "00Dabcdetenant2";
+
+String ddl =
+"CREATE TABLE " + multiTenantTable
++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a 
bigint, b bigint CONSTRAINT PK PRIMARY KEY "
++ "(ORGID, PK2)) MULTI_TENANT=true, 
GUIDE_POSTS_WIDTH=20";
+createTestTable(getUrl(), ddl, null, null);
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+// split such that some data for view2 resides on region of view1
+try (HBaseAdmin admin =
+
conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) {
+byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B");
+admin.split(Bytes.toBytes(multiTenantTable), splitKey);
+}
+
+/**
+ * Insert 2 rows for tenant1 and 6 for tenant2
+ */
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId1 + 
"','00A',1,1)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId1 + 
"','00B',2,2)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00A',3,3)");
+// We split at tenant2 + 00B. So the following rows will reside in 
a different region
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00B',4,4)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00C',5,5)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00D',6,6)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00E',7,7)");
+conn.createStatement().execute(
+"upsert into " + multiTenantTable + " values ('" + tenantId2 + 
"','00F',8,8)");
+conn.commit();
+}
+try (Connection conn = getTenantConnection(tenantId1)) {
+conn.createStatement().execute(
+"CREATE VIEW " + tenant1View + " AS SELECT * FROM " + 
multiTenantTable);
+}
+try (Connection conn = getTenantConnection(tenantId2)) {
+conn.createStatement().execute(
+"CREATE VIEW " + tenant2View + " AS SELECT * FROM " + 
multiTenantTable);
+}
+String sql = "";
+List binds = Lists.newArrayList();
+try (Connection conn = 

[29/40] phoenix git commit: PHOENIX-4287 Add null check for parent name

2017-11-15 Thread jamestaylor
PHOENIX-4287 Add null check for parent name


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

Branch: refs/heads/4.x-HBase-1.2
Commit: cc604b7edf7deda8e916aecab0a09d9a25e7455b
Parents: 6ee2241
Author: Samarth Jain 
Authored: Thu Nov 2 17:52:32 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc604b7e/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 18f28e2..eb09813 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -1246,9 +1246,10 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
 }
 /*
  * For a view index, we use the property set on view. For indexes on 
base table, whether
- * global or local, we use the property set on the base table.
+ * global or local, we use the property set on the base table. Null 
check needed when
+ * dropping local indexes.
  */
-if (table.getType() == PTableType.INDEX) {
+if (table.getType() == PTableType.INDEX && table.getParentName() != 
null) {
 PhoenixConnection conn = context.getConnection();
 String parentTableName = table.getParentName().getString();
 try {



[15/40] phoenix git commit: PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter

2017-11-15 Thread jamestaylor
PHOENIX-4322 DESC primary key column with variable length does not work in 
SkipScanFilter


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 0c5dd68eeb903226c2469e9a93de22ddc0b22a94
Parents: 798ebb4
Author: maryannxue 
Authored: Mon Oct 30 11:49:40 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/SortOrderIT.java | 9 +
 .../src/main/java/org/apache/phoenix/util/ScanUtil.java | 7 +--
 2 files changed, 14 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c5dd68e/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
index 655dbb1..58bbabb 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
@@ -167,6 +167,15 @@ public class SortOrderIT extends ParallelStatsDisabledIT {
 runQueryTest(ddl, upsert("oid", "code"), insertedRows, new 
Object[][]{{"o2", 2}}, new WhereCondition("oid", "IN", "('o2')"),
 table);
 }
+
+@Test
+public void inDescCompositePK3() throws Exception {
+String table = generateUniqueName();
+String ddl = "CREATE table " + table + " (oid INTEGER NOT NULL, code 
VARCHAR NOT NULL constraint pk primary key (oid DESC, code DESC))";
+Object[][] insertedRows = new Object[][]{{1, "o1"}, {2, "o2"}, {3, 
"o3"}};
+runQueryTest(ddl, upsert("oid", "code"), insertedRows, new 
Object[][]{{2, "o2"}, {1, "o1"}},
+new WhereCondition("(oid, code)", "IN", "((1, 'o1'), (2, 'o2'))"), 
table);
+}
 
 @Test
 public void likeDescCompositePK1() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c5dd68e/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index a844226..8ab4f20 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -431,8 +431,11 @@ public class ScanUtil {
 anyInclusiveUpperRangeKey |= !range.isSingleKey() && 
inclusiveUpper;
 // A null or empty byte array is always represented as a zero byte
 byte sepByte = 
SchemaUtil.getSeparatorByte(schema.rowKeyOrderOptimizable(), bytes.length == 0, 
field);
-
-if ( !isFixedWidth && ( sepByte == 
QueryConstants.DESC_SEPARATOR_BYTE 
+// The result of an RVC evaluation can come with a trailing 
separator already, so we
+// should avoid adding another one.
+if ( !isFixedWidth
+&& ( bytes.length == 0 || key[offset - 1] != sepByte )
+&& ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {
 key[offset++] = sepByte;



[26/40] phoenix git commit: PHOENIX-4291 Merge release script for mac and linux

2017-11-15 Thread jamestaylor
PHOENIX-4291 Merge release script for mac and linux


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

Branch: refs/heads/4.x-HBase-1.2
Commit: d96b70711ff1d83b368e19d85a464565ee155454
Parents: a82ddc3
Author: Mujtaba 
Authored: Fri Nov 3 11:55:25 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 dev/make_rc.sh|  26 +++---
 dev/make_rc_on_mac.sh | 121 -
 2 files changed, 18 insertions(+), 129 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d96b7071/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index 29227b0..31cb9f9 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -43,7 +43,7 @@ DIR_DOCS=dev/release_files
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
-RESULT=$(find -iname target)
+RESULT=$(find . -iname target)
 
 if [ -z "$RESULT" ]
 then
@@ -73,7 +73,7 @@ mvn clean apache-rat:check package -DskipTests 
-Dcheckstyle.skip=true -q;
 rm -rf $(find . -type d -name archive-tmp);
 
 # Copy all phoenix-*.jars to release dir
-phx_jars=$(find -iwholename "./*/target/phoenix-*.jar")
+phx_jars=$(find . -iwholename "./*/target/phoenix-*.jar")
 cp $phx_jars $DIR_REL_BIN_PATH;
 
 # Copy bin
@@ -81,7 +81,7 @@ cp bin/* $DIR_BIN;
 cp -R $DIR_PHERF_CONF $DIR_BIN;
 
 # Copy release docs
-
+cp README $DIR_REL_BIN_PATH;
 cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 
 # Copy examples
@@ -97,10 +97,20 @@ echo "Now signing source and binary tars"
 # Sign
 function_sign() {
   phoenix_tar=$(find apache-phoenix-*.gz);
-  gpg --armor --output $phoenix_tar.asc --detach-sig $phoenix_tar;
-  md5sum -b $phoenix_tar > $phoenix_tar.md5;
-  sha512sum -b $phoenix_tar > $phoenix_tar.sha;
-  sha256sum -b $phoenix_tar >> $phoenix_tar.sha;
+
+  # if on MAC OS
+  if [[ "$OSTYPE" == "darwin"* ]]; then
+gpg2 --armor --output $phoenix_tar.asc --detach-sig $phoenix_tar;
+openssl md5 $phoenix_tar > $phoenix_tar.md5;
+openssl dgst -sha512 $phoenix_tar > $phoenix_tar.sha;
+openssl dgst -sha256 $phoenix_tar >> $phoenix_tar.sha;
+  # all other OS
+  else
+gpg --armor --output $phoenix_tar.asc --detach-sig $phoenix_tar;
+md5sum -b $phoenix_tar > $phoenix_tar.md5;
+sha512sum -b $phoenix_tar > $phoenix_tar.sha;
+sha256sum -b $phoenix_tar >> $phoenix_tar.sha;
+  fi
 }
 
 cd $DIR_REL_BIN_TAR_PATH; function_sign;
@@ -111,7 +121,7 @@ read -p "Do you want add tag for this RC in GIT? (Y for yes 
or any other key to
 if [[ $prompt =~ [yY](es)* ]]
 then
   echo "Tagging..."
-  read -p "Enter tag (Example 5.0.0-rc0):" prompt
+  read -p "Enter tag (Example 4.13.0-HBase-0.98-rc0):" prompt
   echo "Setting tag: $prompt";sleep 5s
   git tag -a $prompt -m "$prompt"; git push origin $prompt
   mv $DIR_REL_ROOT $DIR_REL_BASE/phoenix-$prompt

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d96b7071/dev/make_rc_on_mac.sh
--
diff --git a/dev/make_rc_on_mac.sh b/dev/make_rc_on_mac.sh
deleted file mode 100755
index 0b924f1..000
--- a/dev/make_rc_on_mac.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-set -e
-
-echo "Script that assembles all you need to make an RC."
-echo "It generates source and binary tar in release directory"
-echo "Presumes that you can sign a release as described at 
https://www.apache.org/dev/release-signing.html;
-echo "Starting...";sleep 2s
-
-# Set directory variables
-DIR_ROOT="$(cd $(dirname $0);pwd)/.."
-cd $DIR_ROOT
-PHOENIX="$(xmllint --xpath 
"//*[local-name()='project']/*[local-name()='version']/text()" 

[06/40] phoenix git commit: Revert "PHOENIX-4373 Local index variable length key can have trailing nulls while upserting"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4373 Local index variable length key can have trailing nulls 
while upserting"

This reverts commit f0af02259a0f68eb520004d4f42a7e65954037a7.


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 3b536f4feac802cb2458b4a02337b36c65ce68e5
Parents: fa3884a
Author: James Taylor 
Authored: Wed Nov 15 09:56:20 2017 -0800
Committer: James Taylor 
Committed: Wed Nov 15 09:56:20 2017 -0800

--
 .../org/apache/phoenix/end2end/IndexToolIT.java | 40 
 .../org/apache/phoenix/compile/ScanRanges.java  | 11 ++
 .../apache/phoenix/compile/UpsertCompiler.java  |  3 +-
 3 files changed, 4 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3b536f4f/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..913a147 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
@@ -209,46 +209,6 @@ public class IndexToolIT extends BaseTest {
 }
 }
 
-@Test
-public void testSaltedVariableLengthPK() throws Exception {
-String schemaName = generateUniqueName();
-String dataTableName = generateUniqueName();
-String dataTableFullName = SchemaUtil.getTableName(schemaName, 
dataTableName);
-String indexTableName = generateUniqueName();
-try (Connection conn =
-DriverManager.getConnection(getUrl(), 
PropertiesUtil.deepCopy(TEST_PROPERTIES))) {
-String dataDDL =
-"CREATE TABLE " + dataTableFullName + "(\n"
-+ "ID VARCHAR NOT NULL PRIMARY KEY,\n"
-+ "\"info\".CAR_NUM VARCHAR(18) NULL,\n"
-+ "\"info\".CAP_DATE VARCHAR NULL,\n" + 
"\"info\".ORG_ID BIGINT NULL,\n"
-+ "\"info\".ORG_NAME VARCHAR(255) NULL\n" + ") 
SALT_BUCKETS=3";
-conn.createStatement().execute(dataDDL);
-
-String upsert =
-"UPSERT INTO " + dataTableFullName
-+ "(ID,CAR_NUM,CAP_DATE,ORG_ID,ORG_NAME) 
VALUES('1','car1','2016-01-01 00:00:00',11,'orgname1')";
-conn.createStatement().execute(upsert);
-conn.commit();
-
-String indexDDL =
-String.format(
-"CREATE %s INDEX %s on %s 
(\"info\".CAR_NUM,\"info\".CAP_DATE) ASYNC",
-(localIndex ? "LOCAL" : ""), indexTableName, 
dataTableFullName);
-conn.createStatement().execute(indexDDL);
-
-runIndexTool(directApi, useSnapshot, schemaName, dataTableName, 
indexTableName);
-
-ResultSet rs =
-conn.createStatement().executeQuery(
-"SELECT ORG_ID,CAP_DATE,CAR_NUM,ORG_NAME FROM " + 
dataTableFullName
-+ " WHERE CAR_NUM='car1' AND 
CAP_DATE>='2016-01-01' AND CAP_DATE<='2016-05-02' LIMIT 10");
-assertTrue(rs.next());
-int orgId = rs.getInt(1);
-assertEquals(11, orgId);
-}
-}
-
 public static void assertExplainPlan(boolean localIndex, String 
actualExplainPlan,
 String dataTableFullName, String indexTableFullName) {
 String expectedExplainPlan;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3b536f4f/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
index 817c1bc..1b94cff 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
@@ -207,18 +207,13 @@ public class ScanRanges {
 }
 
 public static byte[] prefixKey(byte[] key, int keyOffset, byte[] 
prefixKey, int prefixKeyOffset) {
-return prefixKey(key, keyOffset, key.length, prefixKey, 
prefixKeyOffset);
-}
-
-public static byte[] prefixKey(byte[] key, int keyOffset, int keyLength, 
byte[] prefixKey,
-int prefixKeyOffset) {
-if (keyLength > 0) {
-byte[] newKey = new 

[09/40] phoenix git commit: PHOENIX-4280 Delete doesn't work when immutable indexes are in building state

2017-11-15 Thread jamestaylor
PHOENIX-4280 Delete doesn't work when immutable indexes are in building state


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

Branch: refs/heads/4.x-HBase-1.2
Commit: e1a81cb56721338f990838dc35087dd74c576dfd
Parents: 7649866
Author: James Taylor 
Authored: Thu Oct 19 17:52:29 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../phoenix/end2end/index/DropColumnIT.java |   3 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java | 105 -
 .../end2end/index/IndexMaintenanceIT.java   |   7 +-
 .../apache/phoenix/compile/DeleteCompiler.java  |  18 ++-
 .../hbase/index/builder/BaseIndexCodec.java |  33 +++---
 .../hbase/index/covered/IndexMetaData.java  |  13 ++-
 .../hbase/index/covered/LocalTableState.java|  69 ++-
 .../hbase/index/covered/NonTxIndexBuilder.java  | 115 +--
 .../hbase/index/scanner/ScannerBuilder.java |   2 +-
 .../hbase/index/util/IndexManagementUtil.java   |   2 -
 .../apache/phoenix/index/IndexMaintainer.java   |  29 -
 .../phoenix/index/PhoenixIndexMetaData.java |  14 ++-
 .../index/PhoenixTransactionalIndexer.java  |  34 ++
 .../index/covered/LocalTableStateTest.java  |  31 ++---
 .../index/covered/NonTxIndexBuilderTest.java|   2 +-
 15 files changed, 255 insertions(+), 222 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e1a81cb5/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
index 4f6c37e..badb2a6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropColumnIT.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
@@ -294,7 +295,7 @@ public class DropColumnIT extends ParallelStatsDisabledIT {
 if (!mutable && columnEncoded) {
 KeyValueColumnExpression colExpression = new 
SingleCellColumnExpression(localIndexCol, "0:V2", 
localIndexTable.getEncodingScheme());
 ImmutableBytesPtr ptr = new ImmutableBytesPtr();
-colExpression.evaluate(new ResultTuple(result), ptr);
+assertTrue(colExpression.evaluate(new ResultTuple(result), ptr));
 colValue = ptr.copyBytesIfNecessary();
 }
 else {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e1a81cb5/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
index 4c43068..9eb5440 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
@@ -29,6 +29,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -40,6 +41,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.hbase.HBaseIOException;
+import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@@ -47,12 +49,15 @@ import 
org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.end2end.BaseUniqueNamesOwnClusterIT;
 import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.query.QueryServices;
 import 

[17/40] phoenix git commit: PHOENIX-4335 System catalog snapshot created each time a new connection is created

2017-11-15 Thread jamestaylor
PHOENIX-4335 System catalog snapshot created each time a new connection is 
created


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 2dab4f606c2eb164c2595ae6acffb5f7d8a5b38d
Parents: 0e97de5
Author: James Taylor 
Authored: Tue Oct 31 15:55:03 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../phoenix/end2end/SystemCatalogUpgradeIT.java | 121 +++
 .../phoenix/coprocessor/MetaDataProtocol.java   |  12 +-
 .../query/ConnectionQueryServicesImpl.java  |  39 --
 .../java/org/apache/phoenix/query/BaseTest.java |  35 --
 4 files changed, 190 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2dab4f60/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
new file mode 100644
index 000..e5b1d6e
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogUpgradeIT.java
@@ -0,0 +1,121 @@
+/*
+ * 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.assertTrue;
+
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.query.ConnectionQueryServicesImpl;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesTestImpl;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+
+public class SystemCatalogUpgradeIT extends BaseTest {
+private static boolean reinitialize;
+private static int countUpgradeAttempts;
+private static long systemTableVersion = 
MetaDataProtocol.getPriorVersion();
+
+private static class PhoenixUpgradeCountingServices extends 
ConnectionQueryServicesImpl {
+public PhoenixUpgradeCountingServices(QueryServices services, 
ConnectionInfo connectionInfo, Properties info) {
+super(services, connectionInfo, info);
+}
+
+@Override
+protected void setUpgradeRequired() {
+super.setUpgradeRequired();
+countUpgradeAttempts++;
+}
+
+@Override
+protected long getSystemTableVersion() {
+return systemTableVersion;
+}
+
+@Override
+protected boolean isInitialized() {
+return !reinitialize && super.isInitialized();
+}
+}
+
+public static class PhoenixUpgradeCountingDriver extends PhoenixTestDriver 
{
+private ConnectionQueryServices cqs;
+private final ReadOnlyProps overrideProps;
+
+public PhoenixUpgradeCountingDriver(ReadOnlyProps props) {
+overrideProps = props;
+}
+
+@Override
+public boolean acceptsURL(String url) throws SQLException {
+return true;
+}
+
+@Override // public for testing
+public synchronized ConnectionQueryServices 
getConnectionQueryServices(String url, Properties info) throws SQLException {
+if (cqs == null) {
+cqs = new 

[19/40] phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables

2017-11-15 Thread jamestaylor
PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data 
tables


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 32beb7073ec9147391a6591afdafdc304426384d
Parents: 4fdf708
Author: Samarth Jain 
Authored: Wed Nov 1 23:21:01 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../apache/phoenix/end2end/CreateTableIT.java   | 73 
 .../end2end/ExplainPlanWithStatsEnabledIT.java  |  2 +-
 .../phoenix/exception/SQLExceptionCode.java |  2 +-
 .../apache/phoenix/schema/MetaDataClient.java   |  7 ++
 4 files changed, 82 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/32beb707/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
index 93bb02b..1abc653 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -35,6 +36,7 @@ import java.util.Properties;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import 
org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder;
 import org.apache.hadoop.hbase.regionserver.BloomType;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT 
{
 }
 conn2.close();
 }
+
+@Test
+public void testSettingGuidePostWidth() throws Exception {
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+String dataTable = generateUniqueName();
+int guidePostWidth = 20;
+String ddl =
+"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a 
bigint, b bigint)"
++ " GUIDE_POSTS_WIDTH=" + guidePostWidth;
+conn.createStatement().execute(ddl);
+assertEquals(20, checkGuidePostWidth(dataTable));
+String viewName = "V_" + generateUniqueName();
+ddl =
+"CREATE VIEW " + viewName + " AS SELECT * FROM " + 
dataTable
++ " GUIDE_POSTS_WIDTH=" + guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+
assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(),
+e.getErrorCode());
+}
+
+// let the view creation go through
+ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable;
+conn.createStatement().execute(ddl);
+
+String globalIndex = "GI_" + generateUniqueName();
+ddl =
+"CREATE INDEX " + globalIndex + " ON " + dataTable
++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + 
guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+
assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(),
+e.getErrorCode());
+}
+String localIndex = "LI_" + generateUniqueName();
+ddl =
+"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable
++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + 
guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+
assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(),
+e.getErrorCode());
+}
+String viewIndex = "VI_" + generateUniqueName();
+ddl =
+"CREATE LOCAL INDEX " + viewIndex + " ON " + dataTable
++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + 
guidePostWidth;
+try {
+conn.createStatement().execute(ddl);
+} catch (SQLException e) {
+ 

[04/40] phoenix git commit: Revert "PHOENIX-4198 Remove the need for users to have access to the Phoenix SYSTEM tables to create tables"

2017-11-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/fa3884a0/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
deleted file mode 100644
index 8437b37..000
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java
+++ /dev/null
@@ -1,628 +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.coprocessor;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.AuthUtil;
-import org.apache.hadoop.hbase.CoprocessorEnvironment;
-import org.apache.hadoop.hbase.DoNotRetryIOException;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.NamespaceDescriptor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.ClusterConnection;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.coprocessor.BaseMasterAndRegionObserver;
-import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController;
-import org.apache.hadoop.hbase.ipc.RpcServer;
-import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
-import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
-import 
org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService;
-import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
-import org.apache.hadoop.hbase.security.AccessDeniedException;
-import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.security.UserProvider;
-import org.apache.hadoop.hbase.security.access.AccessControlClient;
-import org.apache.hadoop.hbase.security.access.AuthResult;
-import org.apache.hadoop.hbase.security.access.Permission;
-import org.apache.hadoop.hbase.security.access.Permission.Action;
-import org.apache.hadoop.hbase.security.access.UserPermission;
-import org.apache.hadoop.hbase.util.Bytes;
-import 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.PhoenixMetaDataControllerEnvironment;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.query.QueryServicesOptions;
-import org.apache.phoenix.schema.PIndexState;
-import org.apache.phoenix.schema.PTable;
-import org.apache.phoenix.schema.PTableType;
-import org.apache.phoenix.util.MetaDataUtil;
-
-import com.google.common.collect.Lists;
-import com.google.protobuf.RpcCallback;
-
-public class PhoenixAccessController extends BaseMetaDataEndpointObserver {
-
-private PhoenixMetaDataControllerEnvironment env;
-private ArrayList accessControllers;
-private boolean accessCheckEnabled;
-private UserProvider userProvider;
-private boolean isAutomaticGrantEnabled;
-private boolean isStrictMode;
-public static final Log LOG = 
LogFactory.getLog(PhoenixAccessController.class);
-private static final Log AUDITLOG =
-
LogFactory.getLog("SecurityLogger."+PhoenixAccessController.class.getName());
-
-private List getAccessControllers() throws 
IOException {
-if (accessControllers == null) {
-synchronized (this) {
-if (accessControllers == null) {
-accessControllers = new 
ArrayList();
-RegionCoprocessorHost cpHost = 
this.env.getCoprocessorHost();
-List coprocessors = cpHost
-

[08/40] phoenix git commit: PHOENIX-4292 Filters on Tables and Views with composite PK of VARCHAR fields with sort direction DESC do not work (addendum)

2017-11-15 Thread jamestaylor
PHOENIX-4292 Filters on Tables and Views with composite PK of VARCHAR fields 
with sort direction DESC do not work (addendum)


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

Branch: refs/heads/4.x-HBase-1.2
Commit: a8a1abc34c8a3040419cbc6720808408d9e7ad9f
Parents: a4b0d25
Author: Thomas D'Silva 
Authored: Mon Oct 23 20:19:15 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../java/org/apache/phoenix/end2end/ViewIT.java | 202 ---
 1 file changed, 129 insertions(+), 73 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a8a1abc3/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 66e2430..5c0d100 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
@@ -791,77 +791,133 @@ public class ViewIT extends BaseViewIT {
 assertArrayEquals(expectedPKs, actualPKs);
 }
 
-   @Test
-   public void testCompositeDescPK() throws SQLException {
-   Properties props = new Properties();
-   try (Connection globalConn = 
DriverManager.getConnection(getUrl(), props)) {
-   String tableName = generateUniqueName();
-   String viewName = generateUniqueName();
-
-   // create global base table
-   globalConn.createStatement().execute("CREATE TABLE " + 
tableName
-   + " (TENANT_ID CHAR(15) NOT NULL, 
KEY_PREFIX CHAR(3) NOT NULL, CREATED_DATE DATE, CREATED_BY CHAR(15), 
SYSTEM_MODSTAMP DATE CONSTRAINT PK PRIMARY KEY (TENANT_ID, KEY_PREFIX)) 
VERSIONS=1, MULTI_TENANT=true, IMMUTABLE_ROWS=TRUE, REPLICATION_SCOPE=1");
-
-   // create various tenant specific views
-   globalConn.createStatement()
-   .execute("CREATE VIEW " + viewName
-   + " (pk1 VARCHAR(10) 
NOT NULL, pk2 VARCHAR(10) NOT NULL, col1 DATE, col3 DECIMAL CONSTRAINT PK 
PRIMARY KEY (pk1 DESC, pk2 DESC)) AS SELECT * FROM "
-   + tableName + " WHERE 
KEY_PREFIX = 'abc' ");
-
-   String tenantId = "tenantId";
-   Properties tenantProps = new Properties();
-   
tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
-   // create a tenant specific view
-   try (Connection tenantConn = 
DriverManager.getConnection(getUrl(), tenantProps)) {
-   // upsert rows
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'testb', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'testc', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'testd', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testa', 'teste', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.createStatement().execute("UPSERT 
INTO " + viewName
-   + " (pk1, pk2, col1, col3) 
VALUES ('testb', 'testa', TO_DATE('2017-10-16 22:00:00', '-MM-dd 
HH:mm:ss'), 10)");
-   tenantConn.commit();
-
-   // run queries
-   ResultSet rs = tenantConn.createStatement()
-   .executeQuery("SELECT count(*) 
FROM " + viewName + " WHERE pk1 = 'testa'");
-   assertTrue(rs.next());
-   

[25/40] phoenix git commit: PHOENIX-3460 Namespace separator : should not be allowed in table or schema name

2017-11-15 Thread jamestaylor
PHOENIX-3460 Namespace separator : should not be allowed in table or schema name


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 204a7aab140bfd00b30c7be5852d54903b7bef1c
Parents: 7bea88d
Author: Thomas D'Silva 
Authored: Thu Nov 2 12:08:07 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 15 ++
 .../apache/phoenix/parse/QueryParserTest.java   | 21 
 2 files changed, 32 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/204a7aab/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 721b514..93e0ede 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -1071,14 +1071,21 @@ cursor_name returns [CursorName ret]
 
 // TODO: figure out how not repeat this two times
 table_name returns [TableName ret]
-:   t=identifier {$ret = factory.table(null, t); }
-|   s=identifier DOT t=identifier {$ret = factory.table(s, t); }
+:   t=table_identifier {$ret = factory.table(null, t); }
+|   s=table_identifier DOT t=table_identifier {$ret = factory.table(s, t); 
}
 ;
 
 // TODO: figure out how not repeat this two times
 from_table_name returns [TableName ret]
-:   t=identifier {$ret = factory.table(null, t); }
-|   s=identifier DOT t=identifier {$ret = factory.table(s, t); }
+:   t=table_identifier {$ret = factory.table(null, t); }
+|   s=table_identifier DOT t=table_identifier {$ret = factory.table(s, t); 
}
+;
+
+table_identifier returns [String ret]
+:   c=identifier {
+   if (c.contains(QueryConstants.NAMESPACE_SEPARATOR) ) { throw new 
RuntimeException("Table or schema name cannot contain colon"); }
+   $ret = c;
+}
 ;
 
 // The lowest level function, which includes literals, binds, but also 
parenthesized expressions, functions, and case statements.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/204a7aab/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
index e7127b7..431f60b 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
@@ -29,6 +29,7 @@ import java.sql.SQLFeatureNotSupportedException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.exception.PhoenixParserException;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixStatement.Operation;
 import org.apache.phoenix.schema.SortOrder;
@@ -56,6 +57,15 @@ public class QueryParserTest {
 assertEquals("Expected equality:\n" + sql + "\n" + newSQL, stmt, 
newStmt);
 }
 
+private void parseQueryThatShouldFail(String sql) throws Exception {
+try {
+parseQuery(sql);
+fail("Query should throw a PhoenixParserException \n " + sql);
+}
+catch (PhoenixParserException e){
+}
+}
+
 @Test
 public void testParsePreQuery0() throws Exception {
 String sql = ((
@@ -782,4 +792,15 @@ public class QueryParserTest {
 String sql = Joiner.on(unicodeEnSpace).join(new String[] {"SELECT", 
"*", "FROM", "T"});
 parseQuery(sql);
 }
+
+@Test
+public void testInvalidTableOrSchemaName() throws Exception {
+// namespace separator (:) cannot be used
+parseQueryThatShouldFail("create table a:b (id varchar not null 
primary key)");
+parseQueryThatShouldFail("create table \"a:b\" (id varchar not null 
primary key)");
+// name separator (.) cannot be used without double quotes
+parseQueryThatShouldFail("create table a.b.c.d (id varchar not null 
primary key)");
+parseQuery("create table \"a.b\".\"c.d\" (id varchar not null primary 
key)");
+parseQuery("create table \"a.b.c.d\" (id varchar not null primary 
key)");
+}
 }



[22/40] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table

2017-11-15 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7bea88dd/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
index daf7c70..788e2dd 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
@@ -18,6 +18,8 @@
 package org.apache.phoenix.schema.stats;
 
 import java.io.IOException;
+import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -45,15 +47,22 @@ import 
org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.schema.PName;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTable.IndexType;
+import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PLong;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.MetaDataUtil;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Maps;
 
 /**
@@ -75,6 +84,7 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 private ImmutableBytesWritable currentRow;
 private final long clientTimeStamp;
 private final String tableName;
+private final boolean isViewIndexTable;
 
 DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String 
tableName, long clientTimeStamp, byte[] family,
 byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws 
IOException {
@@ -95,6 +105,9 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 // since there's no row representing those in SYSTEM.CATALOG.
 if (MetaDataUtil.isViewIndex(tableName)) {
 pName = MetaDataUtil.getViewIndexUserTableName(tableName);
+isViewIndexTable = true;
+} else {
+isViewIndexTable = false;
 }
 ptableKey = SchemaUtil.getTableKeyFromFullName(pName);
 this.clientTimeStamp = clientTimeStamp;
@@ -109,7 +122,7 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 }
 }
 
-private void initGuidepostDepth() throws IOException {
+private void initGuidepostDepth() throws IOException, 
ClassNotFoundException, SQLException {
 // First check is if guidepost info set on statement itself
 if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) {
 int guidepostPerRegion = 0;
@@ -135,6 +148,38 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
 if (!result.isEmpty()) {
 Cell cell = result.listCells().get(0);
 guidepostWidth = 
PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), 
cell.getValueOffset(), SortOrder.getDefault());
+} else if (!isViewIndexTable) {
+/*
+ * The table we are collecting stats for is potentially a 
base table, or local
+ * index or a global index. For view indexes, we rely on 
the the guide post
+ * width column in the parent data table's metadata which 
we already tried
+ * retrieving above.
+ */
+try (Connection conn =
+
QueryUtil.getConnectionOnServer(env.getConfiguration())) {
+PTable table = PhoenixRuntime.getTable(conn, 
tableName);
+if (table.getType() == PTableType.INDEX
+&& table.getIndexType() == IndexType.GLOBAL) {
+/*
+ * For global indexes, we need to get the 
parentName first and then
+ * fetch guide post width configured for the 
parent table.
+ */
+PName parentName = table.getParentName();
+byte[] parentKey =
+
SchemaUtil.getTableKeyFromFullName(parentName.getString());
+get = new Get(parentKey);
+

[13/40] phoenix git commit: PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes

2017-11-15 Thread jamestaylor
PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 21352071b143a6c2df6722b1ee7e3f147c4b07e5
Parents: 7111d31
Author: Samarth Jain 
Authored: Sun Oct 29 22:59:03 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:13 2017 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 13 
 .../phoenix/end2end/index/BaseLocalIndexIT.java |  3 +
 .../phoenix/end2end/index/LocalIndexIT.java | 46 ++-
 .../phoenix/iterate/BaseResultIterators.java|  4 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 80 +---
 5 files changed, 115 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/21352071/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 cd4555c..62538af 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
@@ -32,6 +32,7 @@ import java.util.List;
 
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -306,6 +307,18 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 final Long estimatedRows;
 final Long estimateInfoTs;
 
+public Long getEstimatedBytes() {
+return estimatedBytes;
+}
+
+public Long getEstimatedRows() {
+return estimatedRows;
+}
+
+public Long getEstimateInfoTs() {
+return estimateInfoTs;
+}
+
 Estimate(Long rows, Long bytes, Long ts) {
 this.estimatedBytes = bytes;
 this.estimatedRows = rows;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/21352071/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
index 30baec4..1659d73 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java
@@ -59,6 +59,9 @@ public abstract class BaseLocalIndexIT extends 
BaseUniqueNamesOwnClusterIT {
 serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
 Map clientProps = Maps.newHashMapWithExpectedSize(1);
 clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
+// setting update frequency to a large value to test out that we are
+// generating stats for local indexes
+clientProps.put(QueryServices.MIN_STATS_UPDATE_FREQ_MS_ATTRIB, 
"12");
 setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/21352071/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
index 48221ab..0dcf1d5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end.index;
 
+import static 
org.apache.phoenix.end2end.ExplainPlanWithStatsEnabledIT.getByteRowEstimates;
 import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceName;
 import static 
org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceSchemaName;
 import static org.junit.Assert.assertArrayEquals;
@@ -55,8 +56,10 @@ import org.apache.hadoop.hbase.util.FSUtils;
 import 

[27/40] phoenix git commit: PHOENIX-4348 Point deletes do not work when there are immutable indexes with only row key columns

2017-11-15 Thread jamestaylor
PHOENIX-4348 Point deletes do not work when there are immutable indexes with 
only row key columns


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 7062a48b48d8d59e1e53f4e6f7dae40b849b8064
Parents: cc604b7
Author: James Taylor 
Authored: Thu Nov 2 18:47:01 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../org/apache/phoenix/end2end/DeleteIT.java| 96 +++-
 .../apache/phoenix/compile/DeleteCompiler.java  |  5 +-
 2 files changed, 94 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7062a48b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
index aa4d36e..9eac0af 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
@@ -18,6 +18,7 @@
 package org.apache.phoenix.end2end;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
@@ -32,10 +33,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
 
 
@@ -339,8 +337,6 @@ public class DeleteIT extends ParallelStatsDisabledIT {
 con.commit();
 }
 
-
TestUtil.dumpTable(con.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
-
 ResultSet rs = con.createStatement().executeQuery("SELECT /*+ 
NO_INDEX */ count(*) FROM " + tableName);
 assertTrue(rs.next());
 assertEquals(0, rs.getLong(1));
@@ -370,6 +366,96 @@ public class DeleteIT extends ParallelStatsDisabledIT {
 testDeleteRowFromTableWithImmutableIndex(true, false);
 }
 
+@Test
+public void testPointDeleteRowFromTableWithImmutableIndex() throws 
Exception {
+testPointDeleteRowFromTableWithImmutableIndex(false, false);
+}
+
+@Test
+public void testPointDeleteRowFromTableWithLocalImmutableIndex() throws 
Exception {
+testPointDeleteRowFromTableWithImmutableIndex(true, false);
+}
+
+@Test
+public void testPointDeleteRowFromTableWithImmutableIndex2() throws 
Exception {
+testPointDeleteRowFromTableWithImmutableIndex(false, true);
+}
+
+public void testPointDeleteRowFromTableWithImmutableIndex(boolean 
localIndex, boolean addNonPKIndex) throws Exception {
+Connection con = null;
+try {
+boolean autoCommit = false;
+con = DriverManager.getConnection(getUrl());
+con.setAutoCommit(autoCommit);
+
+Statement stm = con.createStatement();
+
+String tableName = generateUniqueName();
+String indexName1 = generateUniqueName();
+String indexName2 = generateUniqueName();
+String indexName3 = addNonPKIndex? generateUniqueName() : null;
+
+stm.execute("CREATE TABLE IF NOT EXISTS " + tableName + " (" +
+"HOST CHAR(2) NOT NULL," +
+"DOMAIN VARCHAR NOT NULL, " +
+"FEATURE VARCHAR NOT NULL, " +
+"\"DATE\" DATE NOT NULL, \n" + 
+"USAGE.CORE BIGINT," +
+"USAGE.DB BIGINT," +
+"STATS.ACTIVE_VISITOR INTEGER " +
+"CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, 
\"DATE\")) IMMUTABLE_ROWS=true");
+stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + 
indexName1 + " ON " + tableName + " (\"DATE\", FEATURE)");
+stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + 
indexName2 + " ON " + tableName + " (FEATURE, DOMAIN)");
+if (addNonPKIndex) {
+stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX 
" + indexName3 + " ON " + tableName + " (\"DATE\", FEATURE, USAGE.DB)");
+}
+
+Date date = new Date(0);
+PreparedStatement psInsert = con
+.prepareStatement("UPSERT INTO " + tableName + "(HOST, 

[01/40] phoenix git commit: PHOENIX-4283 fix a coearceByte issue which causes nested group by big int incorrect

2017-11-15 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 f0af02259 -> a3bebbeb5


PHOENIX-4283 fix a coearceByte issue which causes nested group by big int 
incorrect

Signed-off-by: aertoria 


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 1fc5b2703b0f01cfca3abacabf20656485d651df
Parents: f0af022
Author: aertoria 
Authored: Sun Oct 15 18:36:44 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 09:53:44 2017 -0800

--
 .../apache/phoenix/end2end/GroupByCaseIT.java   | 63 
 .../org/apache/phoenix/schema/types/PLong.java  |  3 +-
 2 files changed, 65 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1fc5b270/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java
index 6a0ac27..cc850b7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByCaseIT.java
@@ -928,6 +928,69 @@ public class GroupByCaseIT extends ParallelStatsDisabledIT 
{
 }
 }
 
+@Test
+public void testCountNullInEncodedNonEmptyKeyValueCF() throws Exception {
+testCountNullInNonEmptyKeyValueCF(1);
+}
+
+@Test
+public void testCountNullInNonEncodedNonEmptyKeyValueCF() throws Exception 
{
+testCountNullInNonEmptyKeyValueCF(0);
+}
+
+@Test
+public void testNestedGroupedAggregationWithBigInt() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+String tableName = generateUniqueName();
+try(Connection conn = DriverManager.getConnection(getUrl(), props);) {
+String createQuery="CREATE TABLE "+tableName+" (a BIGINT NOT 
NULL,c BIGINT NOT NULL CONSTRAINT PK PRIMARY KEY (a, c))";
+String updateQuery="UPSERT INTO "+tableName+"(a,c) 
VALUES(444, 555)";
+String query="SELECT a FROM (SELECT a, c FROM "+tableName+" GROUP 
BY a, c) GROUP BY a, c";
+conn.prepareStatement(createQuery).execute();
+conn.prepareStatement(updateQuery).execute();
+conn.commit();
+PreparedStatement statement = conn.prepareStatement(query);
+ResultSet rs = statement.executeQuery();
+assertTrue(rs.next());
+assertEquals(444L,rs.getLong(1));
+assertFalse(rs.next());
+}
+}
+
+private void testCountNullInNonEmptyKeyValueCF(int columnEncodedBytes) 
throws Exception {
+try (Connection conn = DriverManager.getConnection(getUrl())) {
+//Type is INT
+String intTableName=generateUniqueName();
+String sql="create table " + intTableName + " (mykey integer not 
null primary key, A.COLA integer, B.COLB integer) "
++ "IMMUTABLE_ROWS=true, IMMUTABLE_STORAGE_SCHEME = 
ONE_CELL_PER_COLUMN, COLUMN_ENCODED_BYTES = " + columnEncodedBytes + ", 
DISABLE_WAL=true";
+
+conn.createStatement().execute(sql);
+conn.createStatement().execute("UPSERT INTO "+intTableName+" 
VALUES (1,1)");
+conn.createStatement().execute("UPSERT INTO "+intTableName+" 
VALUES (2,1)");
+conn.createStatement().execute("UPSERT INTO "+intTableName+" 
VALUES (3,1,2)");
+conn.createStatement().execute("UPSERT INTO "+intTableName+" 
VALUES (4,1)");
+conn.createStatement().execute("UPSERT INTO "+intTableName+" 
VALUES (5,1)");
+conn.commit();
+
+
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(intTableName)));
+
+sql="select count(*) from "+intTableName;
+ResultSet rs=conn.createStatement().executeQuery(sql);
+assertTrue(rs.next());
+assertEquals(5, rs.getInt(1));
+
+sql="select count(*) from "+intTableName + " where b.colb is not 
null";
+rs=conn.createStatement().executeQuery(sql);
+assertTrue(rs.next());
+assertEquals(1, rs.getInt(1));
+
+sql="select count(*) from "+intTableName + " where b.colb is null";
+rs=conn.createStatement().executeQuery(sql);
+assertTrue(rs.next());
+assertEquals(4, rs.getInt(1));
+}
+ 

[31/40] phoenix git commit: Revert "PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter"

2017-11-15 Thread jamestaylor
Revert "PHOENIX-4322 DESC primary key column with variable length does not work 
in SkipScanFilter"

This reverts commit b0220fa7522fd7e1848ad428a47121b205dec504.


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 6abef7da02d18aa3217a24aa933c01a7b0077a0f
Parents: 1b46b60
Author: James Taylor 
Authored: Mon Oct 30 19:24:51 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

--
 .../src/it/java/org/apache/phoenix/end2end/SortOrderIT.java | 9 -
 .../src/main/java/org/apache/phoenix/util/ScanUtil.java | 7 ++-
 2 files changed, 2 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6abef7da/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
index 58bbabb..655dbb1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderIT.java
@@ -167,15 +167,6 @@ public class SortOrderIT extends ParallelStatsDisabledIT {
 runQueryTest(ddl, upsert("oid", "code"), insertedRows, new 
Object[][]{{"o2", 2}}, new WhereCondition("oid", "IN", "('o2')"),
 table);
 }
-
-@Test
-public void inDescCompositePK3() throws Exception {
-String table = generateUniqueName();
-String ddl = "CREATE table " + table + " (oid INTEGER NOT NULL, code 
VARCHAR NOT NULL constraint pk primary key (oid DESC, code DESC))";
-Object[][] insertedRows = new Object[][]{{1, "o1"}, {2, "o2"}, {3, 
"o3"}};
-runQueryTest(ddl, upsert("oid", "code"), insertedRows, new 
Object[][]{{2, "o2"}, {1, "o1"}},
-new WhereCondition("(oid, code)", "IN", "((1, 'o1'), (2, 'o2'))"), 
table);
-}
 
 @Test
 public void likeDescCompositePK1() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6abef7da/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 8ab4f20..a844226 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -431,11 +431,8 @@ public class ScanUtil {
 anyInclusiveUpperRangeKey |= !range.isSingleKey() && 
inclusiveUpper;
 // A null or empty byte array is always represented as a zero byte
 byte sepByte = 
SchemaUtil.getSeparatorByte(schema.rowKeyOrderOptimizable(), bytes.length == 0, 
field);
-// The result of an RVC evaluation can come with a trailing 
separator already, so we
-// should avoid adding another one.
-if ( !isFixedWidth
-&& ( bytes.length == 0 || key[offset - 1] != sepByte )
-&& ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
+
+if ( !isFixedWidth && ( sepByte == 
QueryConstants.DESC_SEPARATOR_BYTE 
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {
 key[offset++] = sepByte;



[20/40] phoenix git commit: PHOENIX-4322 DESC primary key column with variable length does not work in SkipScanFilter (fix test failures)

2017-11-15 Thread jamestaylor
PHOENIX-4322 DESC primary key column with variable length does not work in 
SkipScanFilter (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/698b074d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/698b074d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/698b074d

Branch: refs/heads/4.x-HBase-1.2
Commit: 698b074d0de4657fcf9edf9e707927435a6a0ba6
Parents: 0c5dd68
Author: maryannxue 
Authored: Mon Oct 30 15:13:43 2017 -0700
Committer: James Taylor 
Committed: Wed Nov 15 10:02:14 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/698b074d/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 8ab4f20..3fe8ad3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -434,7 +434,7 @@ public class ScanUtil {
 // The result of an RVC evaluation can come with a trailing 
separator already, so we
 // should avoid adding another one.
 if ( !isFixedWidth
-&& ( bytes.length == 0 || key[offset - 1] != sepByte )
+&& ( bytes.length == 0 || slotSpan[i] == 0 || key[offset - 
1] != sepByte )
 && ( sepByte == QueryConstants.DESC_SEPARATOR_BYTE
 || ( !exclusiveUpper 
  && (fieldIndex < 
schema.getMaxFields() || inclusiveUpper || exclusiveLower) ) ) ) {



Build failed in Jenkins: Phoenix Compile Compatibility with HBase #460

2017-11-15 Thread Apache Jenkins Server
See 


--
Started by timer
[EnvInject] - Loading node environment variables.
Building remotely on H25 (ubuntu xenial) in workspace 

[Phoenix_Compile_Compat_wHBase] $ /bin/bash /tmp/jenkins1079654649330353591.sh
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
scheduling priority (-e) 0
file size   (blocks, -f) unlimited
pending signals (-i) 386417
max locked memory   (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files  (-n) 6
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority  (-r) 0
stack size  (kbytes, -s) 8192
cpu time   (seconds, -t) unlimited
max user processes  (-u) 10240
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited
core id : 0
core id : 1
core id : 2
core id : 3
core id : 4
core id : 5
physical id : 0
physical id : 1
MemTotal:   98958120 kB
MemFree:20461796 kB
Filesystem  Size  Used Avail Use% Mounted on
udev 48G 0   48G   0% /dev
tmpfs   9.5G  978M  8.5G  11% /run
/dev/sda1   364G  223G  123G  65% /
tmpfs48G  516K   48G   1% /dev/shm
tmpfs   5.0M 0  5.0M   0% /run/lock
tmpfs48G 0   48G   0% /sys/fs/cgroup
tmpfs   9.5G 0  9.5G   0% /run/user/910
apache-maven-2.2.1
apache-maven-3.0.4
apache-maven-3.0.5
apache-maven-3.2.1
apache-maven-3.2.5
apache-maven-3.3.3
apache-maven-3.3.9
apache-maven-3.5.0
apache-maven-3.5.2
latest
latest2
latest3


===
Verifying compile level compatibility with HBase 0.98 with Phoenix 
4.x-HBase-0.98
===

Cloning into 'hbase'...
Switched to a new branch '0.98'
Branch 0.98 set up to track remote branch 0.98 from origin.

main:
 [exec] 
~/jenkins-slave/workspace/Phoenix_Compile_Compat_wHBase/hbase/hbase-common 
~/jenkins-slave/workspace/Phoenix_Compile_Compat_wHBase/hbase/hbase-common
 [exec] 
~/jenkins-slave/workspace/Phoenix_Compile_Compat_wHBase/hbase/hbase-common

main:
[mkdir] Created dir: 

 [exec] tar: hadoop-snappy-nativelibs.tar: Cannot open: No such file or 
directory
 [exec] tar: Error is not recoverable: exiting now
 [exec] Result: 2

main:
[mkdir] Created dir: 

 [copy] Copying 20 files to 

[mkdir] Created dir: 

[mkdir] Created dir: 


main:
[mkdir] Created dir: 

 [copy] Copying 17 files to 

[mkdir] Created dir: 


main:
[mkdir] Created dir: 

 [copy] Copying 1 file to 

[mkdir] Created dir: 


HBase pom.xml:

Got HBase version as 0.98.25-SNAPSHOT
Cloning into 'phoenix'...
Switched to a new branch '4.x-HBase-0.98'
Branch 4.x-HBase-0.98 set up to track remote branch 4.x-HBase-0.98 from origin.
ANTLR Parser Generator  Version 3.5.2
Output file 

 does not exist: must build 

PhoenixSQL.g


===
Verifying compile level compatibility with HBase branch-1.3 with Phoenix master