phoenix git commit: PHOENIX-2952 Addendum to fix test case failure (Ram)

2016-06-20 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 eedfb63cf -> 615fc0243


PHOENIX-2952 Addendum to fix test case failure (Ram)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 615fc02431800d8f5388b7215cf499e6ab89adde
Parents: eedfb63
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 14:00:43 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 14:02:52 2016 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java   | 2 +-
 .../main/java/org/apache/phoenix/schema/types/PArrayDataType.java | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/615fc024/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 242ca0f..3f7fe22 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -53,7 +53,7 @@ public class ArrayLengthFunction extends ScalarFunction {
PDataType baseType = 
PDataType.fromTypeId(children.get(0).getDataType()
.getSqlType()
- PDataType.ARRAY_TYPE_BASE);
-   int length = PArrayDataType.getArrayLength(ptr, baseType, 
arrayExpr.getMaxLength());
+   int length = Math.abs(PArrayDataType.getArrayLength(ptr, 
baseType, arrayExpr.getMaxLength()));
byte[] lengthBuf = new byte[PInteger.INSTANCE.getByteSize()];
 PInteger.INSTANCE.getCodec().encodeInt(length, lengthBuf, 0);
ptr.set(lengthBuf);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/615fc024/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index e666a7a..eb1a7ff 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1185,8 +1185,7 @@ public abstract class PArrayDataType extends 
PDataType {
 }
 // In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
 // elements. So it is always better to return the absolute value
-   return Math
-   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
+   return (Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 Addendum to fix test case failure (Ram)

2016-06-20 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 42503cb75 -> b07feccdc


PHOENIX-2952 Addendum to fix test case failure (Ram)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: b07feccdcccf5504d2a31c31d54f6819814053f7
Parents: 42503cb
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 14:00:43 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 14:02:31 2016 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java   | 2 +-
 .../main/java/org/apache/phoenix/schema/types/PArrayDataType.java | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07feccd/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 242ca0f..3f7fe22 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -53,7 +53,7 @@ public class ArrayLengthFunction extends ScalarFunction {
PDataType baseType = 
PDataType.fromTypeId(children.get(0).getDataType()
.getSqlType()
- PDataType.ARRAY_TYPE_BASE);
-   int length = PArrayDataType.getArrayLength(ptr, baseType, 
arrayExpr.getMaxLength());
+   int length = Math.abs(PArrayDataType.getArrayLength(ptr, 
baseType, arrayExpr.getMaxLength()));
byte[] lengthBuf = new byte[PInteger.INSTANCE.getByteSize()];
 PInteger.INSTANCE.getCodec().encodeInt(length, lengthBuf, 0);
ptr.set(lengthBuf);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07feccd/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index e666a7a..eb1a7ff 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1185,8 +1185,7 @@ public abstract class PArrayDataType extends 
PDataType {
 }
 // In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
 // elements. So it is always better to return the absolute value
-   return Math
-   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
+   return (Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 Addendum to fix test case failure (Ram)

2016-06-20 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 0c86c7e3d -> 49c7bd494


PHOENIX-2952 Addendum to fix test case failure (Ram)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 49c7bd49467c2923be204cca87b407a25b656cca
Parents: 0c86c7e
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 14:00:43 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 14:02:06 2016 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java   | 2 +-
 .../main/java/org/apache/phoenix/schema/types/PArrayDataType.java | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/49c7bd49/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 242ca0f..3f7fe22 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -53,7 +53,7 @@ public class ArrayLengthFunction extends ScalarFunction {
PDataType baseType = 
PDataType.fromTypeId(children.get(0).getDataType()
.getSqlType()
- PDataType.ARRAY_TYPE_BASE);
-   int length = PArrayDataType.getArrayLength(ptr, baseType, 
arrayExpr.getMaxLength());
+   int length = Math.abs(PArrayDataType.getArrayLength(ptr, 
baseType, arrayExpr.getMaxLength()));
byte[] lengthBuf = new byte[PInteger.INSTANCE.getByteSize()];
 PInteger.INSTANCE.getCodec().encodeInt(length, lengthBuf, 0);
ptr.set(lengthBuf);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/49c7bd49/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index e666a7a..eb1a7ff 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1185,8 +1185,7 @@ public abstract class PArrayDataType extends 
PDataType {
 }
 // In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
 // elements. So it is always better to return the absolute value
-   return Math
-   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
+   return (Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 Addendum to fix test case failure (Ram)

2016-06-20 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master 5e64eb3b9 -> 743da6ee8


PHOENIX-2952 Addendum to fix test case failure (Ram)


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

Branch: refs/heads/master
Commit: 743da6ee8d3b0e18047c24ae19f679f89fe3eb8c
Parents: 5e64eb3
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 14:00:43 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 14:00:43 2016 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java   | 2 +-
 .../main/java/org/apache/phoenix/schema/types/PArrayDataType.java | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/743da6ee/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 242ca0f..3f7fe22 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -53,7 +53,7 @@ public class ArrayLengthFunction extends ScalarFunction {
PDataType baseType = 
PDataType.fromTypeId(children.get(0).getDataType()
.getSqlType()
- PDataType.ARRAY_TYPE_BASE);
-   int length = PArrayDataType.getArrayLength(ptr, baseType, 
arrayExpr.getMaxLength());
+   int length = Math.abs(PArrayDataType.getArrayLength(ptr, 
baseType, arrayExpr.getMaxLength()));
byte[] lengthBuf = new byte[PInteger.INSTANCE.getByteSize()];
 PInteger.INSTANCE.getCodec().encodeInt(length, lengthBuf, 0);
ptr.set(lengthBuf);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/743da6ee/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index e666a7a..eb1a7ff 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1185,8 +1185,7 @@ public abstract class PArrayDataType extends 
PDataType {
 }
 // In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
 // elements. So it is always better to return the absolute value
-   return Math
-   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
+   return (Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 array_length return negative value (Joseph Sun)

2016-06-19 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 72af14732 -> eedfb63cf


PHOENIX-2952 array_length return negative value (Joseph Sun)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: eedfb63cfbd59cf23a7df37951086ecda07177e1
Parents: 72af147
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 09:57:24 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 10:01:34 2016 +0530

--
 .../phoenix/end2end/RegexpSplitFunctionIT.java | 17 +
 .../phoenix/schema/types/PArrayDataType.java   |  5 -
 2 files changed, 21 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/eedfb63c/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
index 50b7a80..6df4829 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
@@ -86,6 +86,23 @@ public class RegexpSplitFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 }
 
 @Test
+public void testArrayLenWithRegExpSplit() throws SQLException {
+   Connection conn = DriverManager.getConnection(getUrl());
+   String val = "T";
+   for(int i = 1; i < Short.MAX_VALUE + 500; i++) {
+   val += ",T";
+   }
+   
+initTable(conn, val);
+
+ResultSet rs = conn.createStatement().executeQuery(
+"SELECT array_length(REGEXP_SPLIT(VAL, ',')) FROM " + SPLIT_TEST);
+assertTrue(rs.next());
+assertEquals(33267, rs.getInt(1));
+assertFalse(rs.next());
+}
+
+@Test
 public void testSplit_InFilter() throws SQLException {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ONE,TWO,THREE");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/eedfb63c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index 29af86e..e666a7a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1183,7 +1183,10 @@ public abstract class PArrayDataType extends 
PDataType {
 int elemLength = maxLength == null ? baseType.getByteSize() : 
maxLength;
 return (ptr.getLength() / elemLength);
 }
-return Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT)));
+// In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
+// elements. So it is always better to return the absolute value
+   return Math
+   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 array_length return negative value (Joseph Sun)

2016-06-19 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 0636eeb6f -> 42503cb75


PHOENIX-2952 array_length return negative value (Joseph Sun)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 42503cb7597aee182f70a4e63348dc60838796b8
Parents: 0636eeb
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 09:57:24 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 10:00:59 2016 +0530

--
 .../phoenix/end2end/RegexpSplitFunctionIT.java | 17 +
 .../phoenix/schema/types/PArrayDataType.java   |  5 -
 2 files changed, 21 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/42503cb7/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
index 50b7a80..6df4829 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
@@ -86,6 +86,23 @@ public class RegexpSplitFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 }
 
 @Test
+public void testArrayLenWithRegExpSplit() throws SQLException {
+   Connection conn = DriverManager.getConnection(getUrl());
+   String val = "T";
+   for(int i = 1; i < Short.MAX_VALUE + 500; i++) {
+   val += ",T";
+   }
+   
+initTable(conn, val);
+
+ResultSet rs = conn.createStatement().executeQuery(
+"SELECT array_length(REGEXP_SPLIT(VAL, ',')) FROM " + SPLIT_TEST);
+assertTrue(rs.next());
+assertEquals(33267, rs.getInt(1));
+assertFalse(rs.next());
+}
+
+@Test
 public void testSplit_InFilter() throws SQLException {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ONE,TWO,THREE");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/42503cb7/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index 29af86e..e666a7a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1183,7 +1183,10 @@ public abstract class PArrayDataType extends 
PDataType {
 int elemLength = maxLength == null ? baseType.getByteSize() : 
maxLength;
 return (ptr.getLength() / elemLength);
 }
-return Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT)));
+// In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
+// elements. So it is always better to return the absolute value
+   return Math
+   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 array_length return negative value (Joseph Sun)

2016-06-19 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 4d344b347 -> 0c86c7e3d


PHOENIX-2952 array_length return negative value (Joseph Sun)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 0c86c7e3d63431aa100df87ee6731eb744b2be21
Parents: 4d344b3
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 09:57:24 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 10:00:28 2016 +0530

--
 .../phoenix/end2end/RegexpSplitFunctionIT.java | 17 +
 .../phoenix/schema/types/PArrayDataType.java   |  5 -
 2 files changed, 21 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c86c7e3/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
index 50b7a80..6df4829 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
@@ -86,6 +86,23 @@ public class RegexpSplitFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 }
 
 @Test
+public void testArrayLenWithRegExpSplit() throws SQLException {
+   Connection conn = DriverManager.getConnection(getUrl());
+   String val = "T";
+   for(int i = 1; i < Short.MAX_VALUE + 500; i++) {
+   val += ",T";
+   }
+   
+initTable(conn, val);
+
+ResultSet rs = conn.createStatement().executeQuery(
+"SELECT array_length(REGEXP_SPLIT(VAL, ',')) FROM " + SPLIT_TEST);
+assertTrue(rs.next());
+assertEquals(33267, rs.getInt(1));
+assertFalse(rs.next());
+}
+
+@Test
 public void testSplit_InFilter() throws SQLException {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ONE,TWO,THREE");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c86c7e3/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index 29af86e..e666a7a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1183,7 +1183,10 @@ public abstract class PArrayDataType extends 
PDataType {
 int elemLength = maxLength == null ? baseType.getByteSize() : 
maxLength;
 return (ptr.getLength() / elemLength);
 }
-return Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT)));
+// In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
+// elements. So it is always better to return the absolute value
+   return Math
+   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2952 array_length return negative value (Joseph Sun)

2016-06-19 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master f840d558c -> 5e64eb3b9


PHOENIX-2952 array_length return negative value (Joseph Sun)


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

Branch: refs/heads/master
Commit: 5e64eb3b9d8a77f18a770b37fc3d089d249bba33
Parents: f840d55
Author: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Authored: Mon Jun 20 09:57:24 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasude...@intel.com>
Committed: Mon Jun 20 09:58:51 2016 +0530

--
 .../phoenix/end2end/RegexpSplitFunctionIT.java | 17 +
 .../phoenix/schema/types/PArrayDataType.java   |  5 -
 2 files changed, 21 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5e64eb3b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
index 50b7a80..6df4829 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RegexpSplitFunctionIT.java
@@ -86,6 +86,23 @@ public class RegexpSplitFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 }
 
 @Test
+public void testArrayLenWithRegExpSplit() throws SQLException {
+   Connection conn = DriverManager.getConnection(getUrl());
+   String val = "T";
+   for(int i = 1; i < Short.MAX_VALUE + 500; i++) {
+   val += ",T";
+   }
+   
+initTable(conn, val);
+
+ResultSet rs = conn.createStatement().executeQuery(
+"SELECT array_length(REGEXP_SPLIT(VAL, ',')) FROM " + SPLIT_TEST);
+assertTrue(rs.next());
+assertEquals(33267, rs.getInt(1));
+assertFalse(rs.next());
+}
+
+@Test
 public void testSplit_InFilter() throws SQLException {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ONE,TWO,THREE");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5e64eb3b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index 29af86e..e666a7a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1183,7 +1183,10 @@ public abstract class PArrayDataType extends 
PDataType {
 int elemLength = maxLength == null ? baseType.getByteSize() : 
maxLength;
 return (ptr.getLength() / elemLength);
 }
-return Bytes.toInt(bytes, (ptr.getOffset() + ptr.getLength() - 
(Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT)));
+// In case where the number of elements is greater than 
SHORT.MAX_VALUE we do negate the number of
+// elements. So it is always better to return the absolute value
+   return Math
+   .abs(Bytes.toInt(bytes, (ptr.getOffset() + 
ptr.getLength() - (Bytes.SIZEOF_BYTE + Bytes.SIZEOF_INT;
 }
 
 public static int estimateSize(int size, PDataType baseType) {



phoenix git commit: PHOENIX-2368 Call Driver.accept() in Driver.getConnection and return null if false (Ram)

2016-01-11 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 073ed20c1 -> cc134fe15


PHOENIX-2368 Call Driver.accept() in Driver.getConnection and return null
if false (Ram)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: cc134fe151891e88338590baa98030ff5e44bfac
Parents: 073ed20
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jan 12 08:16:32 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jan 12 08:18:47 2016 +0530

--
 .../java/org/apache/phoenix/jdbc/PhoenixDriver.java   |  5 -
 .../apache/phoenix/jdbc/PhoenixEmbeddedDriver.java| 14 +-
 .../org/apache/phoenix/jdbc/PhoenixDriverTest.java| 12 
 3 files changed, 25 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc134fe1/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
index 0f5d4aa..9dafbbf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
@@ -183,10 +183,13 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
 
 @Override
 public Connection connect(String url, Properties info) throws SQLException 
{
+if (!acceptsURL(url)) {
+  return null;
+}
 try {
 closeLock.readLock().lock();
 checkClosed();
-return super.connect(url, info);
+return createConnection(url, info);
 } finally {
 closeLock.readLock().unlock();
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc134fe1/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index c49bf37..486a6d7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -126,11 +126,15 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, SQLCloseable {
 return null;
 }
 
-Properties augmentedInfo = PropertiesUtil.deepCopy(info);
-augmentedInfo.putAll(getDefaultProps().asMap());
-ConnectionQueryServices connectionServices = 
getConnectionQueryServices(url, augmentedInfo);
-PhoenixConnection connection = connectionServices.connect(url, 
augmentedInfo);
-return connection;
+return createConnection(url, info);
+}
+
+protected final Connection createConnection(String url, Properties info) 
throws SQLException {
+  Properties augmentedInfo = PropertiesUtil.deepCopy(info);
+  augmentedInfo.putAll(getDefaultProps().asMap());
+  ConnectionQueryServices connectionServices = 
getConnectionQueryServices(url, augmentedInfo);
+  PhoenixConnection connection = connectionServices.connect(url, 
augmentedInfo);
+  return connection;
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc134fe1/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
index b70ea71..02af191 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
@@ -114,4 +114,16 @@ public class PhoenixDriverTest extends 
BaseConnectionlessQueryTest {
 conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
 conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
 }
+
+@Test
+public void testInvalidURL() throws Exception {
+  Class.forName(PhoenixDriver.class.getName());
+  PhoenixDriver d = (PhoenixDriver) 
DriverManager.getDriver("jdbc:phoenix");
+  d.close();
+  try {
+  DriverManager.getConnection("any text whatever you want to put here");
+  fail("Should have failed due to invalid driver");
+  } catch(Exception e) {
+  }
+}
 }



phoenix git commit: PHOENIX-2368 Call Driver.accept() in Driver.getConnection and return null if false (Ram)

2016-01-11 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 af23e6711 -> 7fc2b2f33


PHOENIX-2368 Call Driver.accept() in Driver.getConnection and return null
if false (Ram)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 7fc2b2f33ed11666341937043b5011b8bce514fc
Parents: af23e67
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jan 12 08:16:32 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jan 12 08:18:03 2016 +0530

--
 .../java/org/apache/phoenix/jdbc/PhoenixDriver.java   |  5 -
 .../apache/phoenix/jdbc/PhoenixEmbeddedDriver.java| 14 +-
 .../org/apache/phoenix/jdbc/PhoenixDriverTest.java| 12 
 3 files changed, 25 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fc2b2f3/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
index 0f5d4aa..9dafbbf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
@@ -183,10 +183,13 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
 
 @Override
 public Connection connect(String url, Properties info) throws SQLException 
{
+if (!acceptsURL(url)) {
+  return null;
+}
 try {
 closeLock.readLock().lock();
 checkClosed();
-return super.connect(url, info);
+return createConnection(url, info);
 } finally {
 closeLock.readLock().unlock();
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fc2b2f3/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index c49bf37..486a6d7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -126,11 +126,15 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, SQLCloseable {
 return null;
 }
 
-Properties augmentedInfo = PropertiesUtil.deepCopy(info);
-augmentedInfo.putAll(getDefaultProps().asMap());
-ConnectionQueryServices connectionServices = 
getConnectionQueryServices(url, augmentedInfo);
-PhoenixConnection connection = connectionServices.connect(url, 
augmentedInfo);
-return connection;
+return createConnection(url, info);
+}
+
+protected final Connection createConnection(String url, Properties info) 
throws SQLException {
+  Properties augmentedInfo = PropertiesUtil.deepCopy(info);
+  augmentedInfo.putAll(getDefaultProps().asMap());
+  ConnectionQueryServices connectionServices = 
getConnectionQueryServices(url, augmentedInfo);
+  PhoenixConnection connection = connectionServices.connect(url, 
augmentedInfo);
+  return connection;
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fc2b2f3/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
index b70ea71..02af191 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
@@ -114,4 +114,16 @@ public class PhoenixDriverTest extends 
BaseConnectionlessQueryTest {
 conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
 conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
 }
+
+@Test
+public void testInvalidURL() throws Exception {
+  Class.forName(PhoenixDriver.class.getName());
+  PhoenixDriver d = (PhoenixDriver) 
DriverManager.getDriver("jdbc:phoenix");
+  d.close();
+  try {
+  DriverManager.getConnection("any text whatever you want to put here");
+  fail("Should have failed due to invalid driver");
+  } catch(Exception e) {
+  }
+}
 }



phoenix git commit: PHOENIX-2364 timestamp type primary key desc error (freakyzoidberg)

2016-01-07 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 db63efe30 -> 63830ef4e


PHOENIX-2364 timestamp type primary key desc error (freakyzoidberg)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 63830ef4e4c678da0c61b2449cfcbd00e17c856c
Parents: db63efe
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Thu Jan 7 21:52:19 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Thu Jan 7 21:55:13 2016 +0530

--
 .../phoenix/schema/types/PArrayDataType.java   |  2 ++
 .../org/apache/phoenix/schema/types/PDataType.java |  1 +
 .../phoenix/schema/types/PUnsignedDouble.java  |  1 +
 .../phoenix/schema/types/PUnsignedFloat.java   |  1 +
 .../apache/phoenix/schema/types/PUnsignedInt.java  |  1 +
 .../phoenix/schema/types/PUnsignedSmallint.java|  1 +
 .../java/org/apache/phoenix/query/OrderByTest.java | 17 +
 7 files changed, 24 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/63830ef4/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index a1759a4..29af86e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1269,6 +1269,7 @@ public abstract class PArrayDataType extends 
PDataType {
 offsetPos.add(byteStream.size());
 if (sortOrder == SortOrder.DESC) {
 SortOrder.invert(bytes, offset, bytes, offset, 
len);
+offset = 0;
 }
 oStream.write(bytes, offset, len);
 oStream.write(getSeparatorByte(true, sortOrder));
@@ -1276,6 +1277,7 @@ public abstract class PArrayDataType extends 
PDataType {
 } else {
 if (sortOrder == SortOrder.DESC) {
 SortOrder.invert(bytes, offset, bytes, offset, len);
+offset = 0;
 }
 oStream.write(bytes, offset, len);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/63830ef4/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
index 5d8852c..7bf54ce 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
@@ -170,6 +170,7 @@ public abstract class PDataType implements DataType, 
Comparable<PDataType<
 }
 if (lhsSortOrder == SortOrder.DESC) {
 lhs = SortOrder.invert(lhs, lhsOffset, new 
byte[lhsLength], 0, lhsLength);
+lhsOffset = 0;
 }
 }
 return Bytes.compareTo(lhs, lhsOffset, lhsLength, rhsConverted, 0, 
rhsConverted.length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/63830ef4/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
index 39e0d47..14e41e1 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
@@ -148,6 +148,7 @@ public class PUnsignedDouble extends PRealNumber {
   checkForSufficientLength(b, o, Bytes.SIZEOF_DOUBLE);
   if (sortOrder == SortOrder.DESC) {
 b = SortOrder.invert(b, o, new byte[Bytes.SIZEOF_DOUBLE], 0, 
Bytes.SIZEOF_DOUBLE);
+o = 0;
   }
   double v = Bytes.toDouble(b, o);
   if (v < 0) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/63830ef4/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloat.java
--
diff --git 
a/phoenix-core/src/main

phoenix git commit: PHOENIX-2364 timestamp type primary key desc error (freakyzoidberg)

2016-01-07 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 94c3546f2 -> 8d679084f


PHOENIX-2364 timestamp type primary key desc error (freakyzoidberg)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 8d679084f506e9298f32cb0078391813f1c3c287
Parents: 94c3546
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Thu Jan 7 21:52:19 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Thu Jan 7 21:55:49 2016 +0530

--
 .../phoenix/schema/types/PArrayDataType.java   |  2 ++
 .../org/apache/phoenix/schema/types/PDataType.java |  1 +
 .../phoenix/schema/types/PUnsignedDouble.java  |  1 +
 .../phoenix/schema/types/PUnsignedFloat.java   |  1 +
 .../apache/phoenix/schema/types/PUnsignedInt.java  |  1 +
 .../phoenix/schema/types/PUnsignedSmallint.java|  1 +
 .../java/org/apache/phoenix/query/OrderByTest.java | 17 +
 7 files changed, 24 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8d679084/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index a1759a4..29af86e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -1269,6 +1269,7 @@ public abstract class PArrayDataType extends 
PDataType {
 offsetPos.add(byteStream.size());
 if (sortOrder == SortOrder.DESC) {
 SortOrder.invert(bytes, offset, bytes, offset, 
len);
+offset = 0;
 }
 oStream.write(bytes, offset, len);
 oStream.write(getSeparatorByte(true, sortOrder));
@@ -1276,6 +1277,7 @@ public abstract class PArrayDataType extends 
PDataType {
 } else {
 if (sortOrder == SortOrder.DESC) {
 SortOrder.invert(bytes, offset, bytes, offset, len);
+offset = 0;
 }
 oStream.write(bytes, offset, len);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8d679084/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
index 5d8852c..7bf54ce 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java
@@ -170,6 +170,7 @@ public abstract class PDataType implements DataType, 
Comparable<PDataType<
 }
 if (lhsSortOrder == SortOrder.DESC) {
 lhs = SortOrder.invert(lhs, lhsOffset, new 
byte[lhsLength], 0, lhsLength);
+lhsOffset = 0;
 }
 }
 return Bytes.compareTo(lhs, lhsOffset, lhsLength, rhsConverted, 0, 
rhsConverted.length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8d679084/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
index 39e0d47..14e41e1 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDouble.java
@@ -148,6 +148,7 @@ public class PUnsignedDouble extends PRealNumber {
   checkForSufficientLength(b, o, Bytes.SIZEOF_DOUBLE);
   if (sortOrder == SortOrder.DESC) {
 b = SortOrder.invert(b, o, new byte[Bytes.SIZEOF_DOUBLE], 0, 
Bytes.SIZEOF_DOUBLE);
+o = 0;
   }
   double v = Bytes.toDouble(b, o);
   if (v < 0) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8d679084/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloat.java
--
diff --git 
a/phoenix-core/src/main

phoenix git commit: PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram

2016-01-05 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 29435eef2 -> b76c076c0


PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase
only)-Ram


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

Branch: refs/heads/4.x-HBase-0.98
Commit: b76c076c0d9b5a349b8300dbb8a84ab0529cbc6d
Parents: 29435ee
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jan 5 17:48:06 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jan 5 22:13:36 2016 +0530

--
 .../RoundFloorCeilFunctionsEnd2EndIT.java   | 38 
 1 file changed, 38 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b76c076c/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
index 42635c6..cd00354 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.apache.phoenix.util.TestUtil.closeStmtAndConn;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -27,6 +28,7 @@ import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Properties;
@@ -36,6 +38,8 @@ import org.apache.phoenix.expression.function.FloorFunction;
 import org.apache.phoenix.expression.function.RoundFunction;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.DateUtil;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -554,4 +558,38 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends 
BaseHBaseManagedTimeIT {
}
}
 
+  @Test
+  public void testRoundOffFunction() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "create table round_test(k bigint primary key)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("upsert into round_test 
values(1380603308885)");
+stmt.execute();
+conn.commit();
+conn.close();
+
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("select round(k/100,0) from round_test");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(1380603, rs.getLong(1));
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
40));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("select round(k/100,0) x from round_test 
group by x");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(1380603, rs.getLong(1));
+  }
+
 }



phoenix git commit: PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram

2016-01-05 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master 3e41fe397 -> ab8fa5ef4


PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase
only)-Ram


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

Branch: refs/heads/master
Commit: ab8fa5ef436588d8f285f6e8c4bf8e79edbd71ed
Parents: 3e41fe3
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jan 5 17:48:06 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jan 5 17:49:23 2016 +0530

--
 .../RoundFloorCeilFunctionsEnd2EndIT.java   | 38 
 1 file changed, 38 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ab8fa5ef/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
index 42635c6..cd00354 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.apache.phoenix.util.TestUtil.closeStmtAndConn;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -27,6 +28,7 @@ import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Properties;
@@ -36,6 +38,8 @@ import org.apache.phoenix.expression.function.FloorFunction;
 import org.apache.phoenix.expression.function.RoundFunction;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.DateUtil;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -554,4 +558,38 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends 
BaseHBaseManagedTimeIT {
}
}
 
+  @Test
+  public void testRoundOffFunction() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "create table round_test(k bigint primary key)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("upsert into round_test 
values(1380603308885)");
+stmt.execute();
+conn.commit();
+conn.close();
+
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("select round(k/100,0) from round_test");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(1380603, rs.getLong(1));
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
40));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("select round(k/100,0) x from round_test 
group by x");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(1380603, rs.getLong(1));
+  }
+
 }



phoenix git commit: PHOENIX-2475 Date arithmetic broken for time and timestamp (Ram)

2015-12-27 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 012db0a0b -> a7da7e387


PHOENIX-2475 Date arithmetic broken for time and timestamp (Ram)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: a7da7e38769dd8f6daf11229c35c62bb00ca14a2
Parents: 012db0a
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Dec 28 13:12:21 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Dec 28 13:14:18 2015 +0530

--
 .../end2end/ClientTimeArithmeticQueryIT.java| 169 +++
 .../phoenix/expression/DateAddExpression.java   |   2 +-
 .../expression/DateSubtractExpression.java  |   2 +-
 .../expression/TimestampAddExpression.java  |   2 +-
 .../expression/TimestampSubtractExpression.java |   2 +-
 5 files changed, 173 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7da7e38/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index 00d835c..e617673 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -42,6 +42,8 @@ import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -638,5 +640,172 @@ public class ClientTimeArithmeticQueryIT extends 
BaseQueryIT {
 conn.close();
 }
 }
+ 
+@Test
+public void testAddTimeStamp() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "create table timestamp_table (ts timestamp primary 
key)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("upsert into timestamp_table values (?)");
+  stmt.setTimestamp(1, new Timestamp(1995 - 1900, 4, 2, 1, 1, 1, 1));
+  stmt.execute();
+  conn.commit();
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
60));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = conn.createStatement().executeQuery("SELECT ts FROM 
timestamp_table");
+  assertTrue(rs.next());
+  assertEquals("1995-05-02 
01:01:01.1",rs.getTimestamp(1).toString());
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
70));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = conn.createStatement().executeQuery("SELECT ts + 1 FROM 
timestamp_table");
+  assertTrue(rs.next());
+  assertEquals("1995-05-03 
01:01:01.1",rs.getTimestamp(1).toString());
+}
+ 
+@Test
+public void testSubtractTimeStamp() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "create table timestamp_table (ts timestamp primary 
key)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("upsert into timestamp_table values (?)");
+  stmt.setTimestamp(1, new Timestamp(1995 - 1900, 4, 2, 1, 1, 1, 1));
+  stmt.execute();
+  conn.commit();
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
60));
+  conn = DriverManager.getConnection(getUrl(), props);
+ 

phoenix git commit: PHOENIX-2475 Date arithmetic broken for time and timestamp (Ram)

2015-12-27 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master 230c966bd -> a7fb22255


PHOENIX-2475 Date arithmetic broken for time and timestamp (Ram)


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

Branch: refs/heads/master
Commit: a7fb222555be601b0f3e2bd10a4185c487e1e32d
Parents: 230c966
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Dec 28 13:12:21 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Dec 28 13:12:21 2015 +0530

--
 .../end2end/ClientTimeArithmeticQueryIT.java| 169 +++
 .../phoenix/expression/DateAddExpression.java   |   2 +-
 .../expression/DateSubtractExpression.java  |   2 +-
 .../expression/TimestampAddExpression.java  |   2 +-
 .../expression/TimestampSubtractExpression.java |   2 +-
 5 files changed, 173 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7fb2225/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index 00d835c..e617673 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -42,6 +42,8 @@ import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -638,5 +640,172 @@ public class ClientTimeArithmeticQueryIT extends 
BaseQueryIT {
 conn.close();
 }
 }
+ 
+@Test
+public void testAddTimeStamp() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "create table timestamp_table (ts timestamp primary 
key)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("upsert into timestamp_table values (?)");
+  stmt.setTimestamp(1, new Timestamp(1995 - 1900, 4, 2, 1, 1, 1, 1));
+  stmt.execute();
+  conn.commit();
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
60));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = conn.createStatement().executeQuery("SELECT ts FROM 
timestamp_table");
+  assertTrue(rs.next());
+  assertEquals("1995-05-02 
01:01:01.1",rs.getTimestamp(1).toString());
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
70));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = conn.createStatement().executeQuery("SELECT ts + 1 FROM 
timestamp_table");
+  assertTrue(rs.next());
+  assertEquals("1995-05-03 
01:01:01.1",rs.getTimestamp(1).toString());
+}
+ 
+@Test
+public void testSubtractTimeStamp() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "create table timestamp_table (ts timestamp primary 
key)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("upsert into timestamp_table values (?)");
+  stmt.setTimestamp(1, new Timestamp(1995 - 1900, 4, 2, 1, 1, 1, 1));
+  stmt.execute();
+  conn.commit();
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
60));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = co

phoenix git commit: PHOENIX-2475 Date arithmetic broken for time and timestamp (Ram)

2015-12-27 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 276069a45 -> 1b3a4ca41


PHOENIX-2475 Date arithmetic broken for time and timestamp (Ram)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 1b3a4ca41b104e64d7b9b4dd8cc10133d9458fba
Parents: 276069a
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Dec 28 13:12:21 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Dec 28 13:15:07 2015 +0530

--
 .../end2end/ClientTimeArithmeticQueryIT.java| 169 +++
 .../phoenix/expression/DateAddExpression.java   |   2 +-
 .../expression/DateSubtractExpression.java  |   2 +-
 .../expression/TimestampAddExpression.java  |   2 +-
 .../expression/TimestampSubtractExpression.java |   2 +-
 5 files changed, 173 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b3a4ca4/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index 00d835c..e617673 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -42,6 +42,8 @@ import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -638,5 +640,172 @@ public class ClientTimeArithmeticQueryIT extends 
BaseQueryIT {
 conn.close();
 }
 }
+ 
+@Test
+public void testAddTimeStamp() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "create table timestamp_table (ts timestamp primary 
key)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("upsert into timestamp_table values (?)");
+  stmt.setTimestamp(1, new Timestamp(1995 - 1900, 4, 2, 1, 1, 1, 1));
+  stmt.execute();
+  conn.commit();
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
60));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = conn.createStatement().executeQuery("SELECT ts FROM 
timestamp_table");
+  assertTrue(rs.next());
+  assertEquals("1995-05-02 
01:01:01.1",rs.getTimestamp(1).toString());
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
70));
+  conn = DriverManager.getConnection(getUrl(), props);
+  rs = conn.createStatement().executeQuery("SELECT ts + 1 FROM 
timestamp_table");
+  assertTrue(rs.next());
+  assertEquals("1995-05-03 
01:01:01.1",rs.getTimestamp(1).toString());
+}
+ 
+@Test
+public void testSubtractTimeStamp() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "create table timestamp_table (ts timestamp primary 
key)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("upsert into timestamp_table values (?)");
+  stmt.setTimestamp(1, new Timestamp(1995 - 1900, 4, 2, 1, 1, 1, 1));
+  stmt.execute();
+  conn.commit();
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
60));
+  conn = DriverManager.getConnection(getUrl(), props);
+ 

phoenix git commit: PHOENIX-1312 Do not always project the empty column family (Ram)

2015-12-21 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master 5d485faef -> 83344f1c5


PHOENIX-1312 Do not always project the empty column family (Ram)


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

Branch: refs/heads/master
Commit: 83344f1c5181027a8b6d033cd86af480e2574c4e
Parents: 5d485fa
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Dec 21 13:35:40 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Dec 21 13:37:15 2015 +0530

--
 .../phoenix/end2end/MultiCfQueryExecIT.java | 69 +++-
 .../phoenix/compile/ProjectionCompiler.java | 16 ++--
 .../apache/phoenix/compile/QueryCompiler.java   |  2 +-
 .../apache/phoenix/compile/RowProjector.java| 18 +++--
 .../phoenix/compile/StatementContext.java   |  2 +-
 .../phoenix/iterate/BaseResultIterators.java| 84 
 .../phoenix/compile/QueryCompilerTest.java  | 33 +++-
 .../java/org/apache/phoenix/util/TestUtil.java  | 12 +--
 8 files changed, 179 insertions(+), 57 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/83344f1c/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
index 2edf189..f5566ce 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
@@ -172,17 +172,80 @@ public class MultiCfQueryExecIT extends 
BaseOwnClusterClientManagedTimeIT {
 assertFalse(rs.next());
 // Use E column family. Since the column family with the empty key 
value (the first one, A)
 // is always added to the scan, we never really use other 
guideposts (but this may change).
-List splits = getAllSplits(conn, "MULTI_CF", 
"e.cpu_utilization IS NOT NULL");
+List splits = getAllSplits(conn, "MULTI_CF", 
"e.cpu_utilization IS NOT NULL", "COUNT(*)");
 // Since the E column family is not populated, it won't have as 
many splits
 assertEquals(3, splits.size());
 // Same as above for G column family.
-splits = getAllSplits(conn, "MULTI_CF", "g.response_time IS NOT 
NULL");
+splits = getAllSplits(conn, "MULTI_CF", "g.response_time IS NOT 
NULL", "COUNT(*)");
 assertEquals(3, splits.size());
 } finally {
 conn.close();
 }
 }
-
+
+@Test
+public void testGuidePostsRetrievedForMultiCF() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "CREATE TABLE T (  k INTEGER PRIMARY KEY, A.V1 VARCHAR, 
B.V2 VARCHAR, C.V3 VARCHAR)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("UPSERT INTO T VALUES(?,?,?,?)");
+  stmt.setInt(1, 1);
+  stmt.setString(2, "A");
+  stmt.setString(3, "B");
+  stmt.setString(4, "C");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T VALUES(?,?,?,?)");
+  stmt.setInt(1, 2);
+  stmt.setString(2, "D");
+  stmt.setString(3, "E");
+  stmt.setString(4, "F");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T(k, A.V1, C.V3) 
VALUES(?,?,?)");
+  stmt.setInt(1, 3);
+  stmt.setString(2, "E");
+  stmt.setString(3, "X");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T(k, A.V1, C.V3) 
VALUES(?,?,?)");
+  stmt.setInt(1, 4);
+  stmt.setString(2, "F");
+  stmt.setString(3, "F");
+  stmt.execute();
+  conn.commit();
+ 
+  conn.close();
+ 
+  analy

phoenix git commit: PHOENIX-1312 Do not always project the empty column family (Ram)

2015-12-21 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 c4930a249 -> 3fdaecdaa


PHOENIX-1312 Do not always project the empty column family (Ram)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 3fdaecdaaa2a2f07070df67f861252fd44e338c3
Parents: c4930a2
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Dec 21 13:35:40 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Dec 21 13:39:07 2015 +0530

--
 .../phoenix/end2end/MultiCfQueryExecIT.java | 69 +++-
 .../phoenix/compile/ProjectionCompiler.java | 16 ++--
 .../apache/phoenix/compile/QueryCompiler.java   |  2 +-
 .../apache/phoenix/compile/RowProjector.java| 18 +++--
 .../phoenix/compile/StatementContext.java   |  2 +-
 .../phoenix/iterate/BaseResultIterators.java| 84 
 .../phoenix/compile/QueryCompilerTest.java  | 33 +++-
 .../java/org/apache/phoenix/util/TestUtil.java  | 12 +--
 8 files changed, 179 insertions(+), 57 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3fdaecda/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
index 2edf189..f5566ce 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
@@ -172,17 +172,80 @@ public class MultiCfQueryExecIT extends 
BaseOwnClusterClientManagedTimeIT {
 assertFalse(rs.next());
 // Use E column family. Since the column family with the empty key 
value (the first one, A)
 // is always added to the scan, we never really use other 
guideposts (but this may change).
-List splits = getAllSplits(conn, "MULTI_CF", 
"e.cpu_utilization IS NOT NULL");
+List splits = getAllSplits(conn, "MULTI_CF", 
"e.cpu_utilization IS NOT NULL", "COUNT(*)");
 // Since the E column family is not populated, it won't have as 
many splits
 assertEquals(3, splits.size());
 // Same as above for G column family.
-splits = getAllSplits(conn, "MULTI_CF", "g.response_time IS NOT 
NULL");
+splits = getAllSplits(conn, "MULTI_CF", "g.response_time IS NOT 
NULL", "COUNT(*)");
 assertEquals(3, splits.size());
 } finally {
 conn.close();
 }
 }
-
+
+@Test
+public void testGuidePostsRetrievedForMultiCF() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "CREATE TABLE T (  k INTEGER PRIMARY KEY, A.V1 VARCHAR, 
B.V2 VARCHAR, C.V3 VARCHAR)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("UPSERT INTO T VALUES(?,?,?,?)");
+  stmt.setInt(1, 1);
+  stmt.setString(2, "A");
+  stmt.setString(3, "B");
+  stmt.setString(4, "C");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T VALUES(?,?,?,?)");
+  stmt.setInt(1, 2);
+  stmt.setString(2, "D");
+  stmt.setString(3, "E");
+  stmt.setString(4, "F");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T(k, A.V1, C.V3) 
VALUES(?,?,?)");
+  stmt.setInt(1, 3);
+  stmt.setString(2, "E");
+  stmt.setString(3, "X");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T(k, A.V1, C.V3) 
VALUES(?,?,?)");
+  stmt.setInt(1, 4);
+  stmt.setString(2, "F");
+  stmt.setString(3, "F");
+  stmt.execute();
+  conn.commit();
+ 
+  conn.close();
+ 
+ 

phoenix git commit: PHOENIX-1312 Do not always project the empty column family (Ram)

2015-12-21 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 95cff2d49 -> b35cb98ca


PHOENIX-1312 Do not always project the empty column family (Ram)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: b35cb98caece0183ce4dc29fcae4bfc80dbdc504
Parents: 95cff2d
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Dec 21 13:35:40 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Dec 21 13:40:05 2015 +0530

--
 .../phoenix/end2end/MultiCfQueryExecIT.java | 69 +++-
 .../phoenix/compile/ProjectionCompiler.java | 16 ++--
 .../apache/phoenix/compile/QueryCompiler.java   |  2 +-
 .../apache/phoenix/compile/RowProjector.java| 18 +++--
 .../phoenix/compile/StatementContext.java   |  2 +-
 .../phoenix/iterate/BaseResultIterators.java| 84 
 .../phoenix/compile/QueryCompilerTest.java  | 33 +++-
 .../java/org/apache/phoenix/util/TestUtil.java  | 12 +--
 8 files changed, 179 insertions(+), 57 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b35cb98c/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
index 2edf189..f5566ce 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java
@@ -172,17 +172,80 @@ public class MultiCfQueryExecIT extends 
BaseOwnClusterClientManagedTimeIT {
 assertFalse(rs.next());
 // Use E column family. Since the column family with the empty key 
value (the first one, A)
 // is always added to the scan, we never really use other 
guideposts (but this may change).
-List splits = getAllSplits(conn, "MULTI_CF", 
"e.cpu_utilization IS NOT NULL");
+List splits = getAllSplits(conn, "MULTI_CF", 
"e.cpu_utilization IS NOT NULL", "COUNT(*)");
 // Since the E column family is not populated, it won't have as 
many splits
 assertEquals(3, splits.size());
 // Same as above for G column family.
-splits = getAllSplits(conn, "MULTI_CF", "g.response_time IS NOT 
NULL");
+splits = getAllSplits(conn, "MULTI_CF", "g.response_time IS NOT 
NULL", "COUNT(*)");
 assertEquals(3, splits.size());
 } finally {
 conn.close();
 }
 }
-
+
+@Test
+public void testGuidePostsRetrievedForMultiCF() throws Exception {
+  Connection conn;
+  PreparedStatement stmt;
+  ResultSet rs;
+
+  long ts = nextTimestamp();
+  Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
+  conn = DriverManager.getConnection(getUrl(), props);
+  conn.createStatement()
+  .execute(
+  "CREATE TABLE T (  k INTEGER PRIMARY KEY, A.V1 VARCHAR, 
B.V2 VARCHAR, C.V3 VARCHAR)");
+  conn.close();
+
+  props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
+  conn = DriverManager.getConnection(getUrl(), props);
+  stmt = conn.prepareStatement("UPSERT INTO T VALUES(?,?,?,?)");
+  stmt.setInt(1, 1);
+  stmt.setString(2, "A");
+  stmt.setString(3, "B");
+  stmt.setString(4, "C");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T VALUES(?,?,?,?)");
+  stmt.setInt(1, 2);
+  stmt.setString(2, "D");
+  stmt.setString(3, "E");
+  stmt.setString(4, "F");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T(k, A.V1, C.V3) 
VALUES(?,?,?)");
+  stmt.setInt(1, 3);
+  stmt.setString(2, "E");
+  stmt.setString(3, "X");
+  stmt.execute();
+  conn.commit();
+  
+  stmt = conn.prepareStatement("UPSERT INTO T(k, A.V1, C.V3) 
VALUES(?,?,?)");
+  stmt.setInt(1, 4);
+  stmt.setString(2, "F");
+  stmt.setString(3, "F");
+  stmt.execute();
+  conn.commit();
+ 
+  conn.close();
+ 
+  analy

phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.6-HBase-0.98 231c3f469 -> 3ef3b4360


PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/4.6-HBase-0.98
Commit: 3ef3b436036e95258dabad8a6a0cca53b9c4255e
Parents: 231c3f4
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:54:01 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3ef3b436/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index b7a2ad2..80396a6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3ef3b436/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 6b26197..4170253 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -104,12 +104,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3ef3b436/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/P

phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-1.1 18026e4df -> 853828fe2


PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/4.5-HBase-1.1
Commit: 853828fe213f0da746c23a5c3500643ff395821a
Parents: 18026e4
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:54:43 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/853828fe/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 800a7b4..989b000 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/853828fe/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 6b26197..4170253 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -104,12 +104,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/853828fe/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/P

phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master bf0661775 -> c2a1f7445


PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/master
Commit: c2a1f7445f3882464a58d07cb9fd15a914e13d36
Parents: bf06617
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:45:01 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2a1f744/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 7400127..846507b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2a1f744/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 6b26197..4170253 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -104,12 +104,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2a1f744/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
@@ -

[06/44] phoenix git commit: Changing version to 4.5.0-HBase-1.1-SNAPSHOT

2015-12-08 Thread ramkrishna
Changing version to 4.5.0-HBase-1.1-SNAPSHOT


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 3cdc3230c570ee8c22bb6c1bab975699fd02e94c
Parents: 56e1c0a
Author: Rajeshbabu Chintaguntla 
Authored: Mon May 25 17:46:18 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon May 25 17:46:18 2015 +0530

--
 phoenix-assembly/pom.xml  | 2 +-
 phoenix-core/pom.xml  | 2 +-
 phoenix-flume/pom.xml | 2 +-
 phoenix-pherf/pom.xml | 2 +-
 phoenix-pig/pom.xml   | 2 +-
 phoenix-server-client/pom.xml | 2 +-
 phoenix-server/pom.xml| 2 +-
 phoenix-spark/pom.xml | 2 +-
 pom.xml   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 8d9a965..04d9335 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -26,7 +26,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-assembly
   Phoenix Assembly

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 22e6b60..951e969 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -4,7 +4,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-core
   Phoenix Core

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index b2b9a47..ea87ab0 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -26,7 +26,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-flume
   Phoenix - Flume

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-pherf/pom.xml
--
diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml
index 0901f71..e751d73 100644
--- a/phoenix-pherf/pom.xml
+++ b/phoenix-pherf/pom.xml
@@ -22,7 +22,7 @@
 
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
 
 
 phoenix-pherf

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-pig/pom.xml
--
diff --git a/phoenix-pig/pom.xml b/phoenix-pig/pom.xml
index 015a660..957c06f 100644
--- a/phoenix-pig/pom.xml
+++ b/phoenix-pig/pom.xml
@@ -26,7 +26,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-pig
   Phoenix - Pig

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-server-client/pom.xml
--
diff --git a/phoenix-server-client/pom.xml b/phoenix-server-client/pom.xml
index 4d6fd45..748e57c 100644
--- a/phoenix-server-client/pom.xml
+++ b/phoenix-server-client/pom.xml
@@ -4,7 +4,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-server-client
   Phoenix Query Server Client

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-server/pom.xml
--
diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml
index 9f6289f..ab9a472 100644
--- a/phoenix-server/pom.xml
+++ b/phoenix-server/pom.xml
@@ -4,7 +4,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-server
   Phoenix Query Server

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index a232cf4..e42a7ec 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -28,7 +28,7 @@
   
 org.apache.phoenix
 phoenix
-4.4.0-SNAPSHOT
+4.5.0-HBase-1.1-SNAPSHOT
   
   phoenix-spark
   Phoenix - Spark

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cdc3230/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 

[16/44] phoenix git commit: PHOENIX-2016 Some Phoenix tests failed with NPE(Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-2016 Some Phoenix tests failed with NPE(Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: dc46b144aa9eaf315c3969669dab7f0a50d94281
Parents: eb9452d
Author: Rajeshbabu Chintaguntla 
Authored: Mon Jun 1 21:34:16 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon Jun 1 21:34:16 2015 +0530

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dc46b144/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index b0574c3..fa78656 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -1627,6 +1627,7 @@ public abstract class BaseTest {
  * Disable and drop all the tables except SYSTEM.CATALOG and 
SYSTEM.SEQUENCE
  */
 private static void disableAndDropNonSystemTables() throws Exception {
+if (driver == null) return;
 HBaseAdmin admin = driver.getConnectionQueryServices(null, 
null).getAdmin();
 try {
 HTableDescriptor[] tables = admin.listTables();



[09/44] phoenix git commit: Revert "PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because HBASE-13756(Rajeshbabu)"

2015-12-08 Thread ramkrishna
Revert "PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because 
HBASE-13756(Rajeshbabu)"

This reverts commit 56e1c0a1f348572fb73e9d0b8bbfb053df7f8710.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 1a2f2dc1ea6dd75c224b78a0dc2b312b0e6f5bce
Parents: 5546a42
Author: Rajeshbabu Chintaguntla 
Authored: Wed May 27 14:52:25 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Wed May 27 14:52:25 2015 +0530

--
 phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java | 2 --
 1 file changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a2f2dc1/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 4aa28c4..54ae670 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -620,8 +620,6 @@ public abstract class BaseTest {
 }
 //no point doing sanity checks when running tests.
 conf.setBoolean("hbase.table.sanity.checks", false);
-// Remove this configuration once hbase has HBASE-13756 fix.
-conf.set("hbase.regionserver.msginterval", "30");
 // set the server rpc controller and rpc scheduler factory, used to 
configure the cluster
 conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY, 
DEFAULT_SERVER_RPC_CONTROLLER_FACTORY);
 conf.set(RSRpcServices.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS, 
DEFAULT_RPC_SCHEDULER_FACTORY);



[02/44] phoenix git commit: PHOENIX-1681 Use the new Region Interface (Andrew Purtell)

2015-12-08 Thread ramkrishna
PHOENIX-1681 Use the new Region Interface (Andrew Purtell)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: ea622d5f7ab5c37d2ecf8be6054e5ed42f36a035
Parents: 98271b8
Author: Enis Soztutar 
Authored: Thu May 21 23:22:54 2015 -0700
Committer: Enis Soztutar 
Committed: Fri May 22 00:30:56 2015 -0700

--
 ...ReplayWithIndexWritesAndCompressedWALIT.java |  4 +-
 .../EndToEndCoveredColumnsIndexBuilderIT.java   |  4 +-
 .../IndexHalfStoreFileReaderGenerator.java  |  9 +-
 .../regionserver/IndexSplitTransaction.java | 65 +-
 .../hbase/regionserver/LocalIndexMerger.java| 16 ++--
 .../hbase/regionserver/LocalIndexSplitter.java  | 11 +--
 .../coprocessor/BaseScannerRegionObserver.java  | 26 +++---
 .../GroupedAggregateRegionObserver.java | 13 +--
 .../coprocessor/MetaDataEndpointImpl.java   | 94 ++--
 .../phoenix/coprocessor/ScanRegionObserver.java | 17 ++--
 .../coprocessor/SequenceRegionObserver.java | 16 ++--
 .../UngroupedAggregateRegionObserver.java   | 29 +++---
 .../hbase/index/covered/data/LocalTable.java|  5 +-
 .../write/ParallelWriterIndexCommitter.java |  8 +-
 .../recovery/PerRegionIndexWriteCache.java  | 10 +--
 .../recovery/StoreFailuresInCachePolicy.java|  4 +-
 .../TrackingParallelWriterIndexCommitter.java   |  8 +-
 .../phoenix/index/PhoenixIndexBuilder.java  |  4 +-
 .../apache/phoenix/index/PhoenixIndexCodec.java | 14 ++-
 .../schema/stats/StatisticsCollector.java   | 14 +--
 .../phoenix/schema/stats/StatisticsScanner.java | 16 ++--
 .../phoenix/schema/stats/StatisticsWriter.java  | 16 ++--
 .../java/org/apache/phoenix/util/IndexUtil.java | 38 
 .../index/covered/TestLocalTableState.java  |  8 +-
 .../index/write/TestWALRecoveryCaching.java | 17 ++--
 .../recovery/TestPerRegionIndexWriteCache.java  |  6 +-
 26 files changed, 230 insertions(+), 242 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea622d5f/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
index 3b8ff29..611ba68 100644
--- 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
@@ -159,7 +159,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
   }
 
   /**
-   * Test writing edits into an HRegion, closing it, splitting logs, opening 
Region again. Verify
+   * Test writing edits into an region, closing it, splitting logs, opening 
Region again. Verify
* seqids.
* @throws Exception on failure
*/
@@ -183,7 +183,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
 builder.build(htd);
 
 // create the region + its WAL
-HRegion region0 = HRegion.createHRegion(hri, hbaseRootDir, this.conf, htd);
+HRegion region0 = HRegion.createHRegion(hri, hbaseRootDir, this.conf, 
htd); // FIXME: Uses private type
 region0.close();
 region0.getWAL().close();
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea622d5f/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
index d90733f..6b2309e 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
@@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.util.EnvironmentEdge;
 import 

[20/44] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)

2015-12-08 Thread ramkrishna
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af
Parents: 9c5f111
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jun 2 11:18:51 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 2 11:18:51 2015 +0530

--
 .../phoenix/end2end/ArraysWithNullsIT.java  | 300 +++
 .../phoenix/compile/ExpressionCompiler.java |   9 +-
 .../apache/phoenix/schema/types/PBinary.java|   2 +-
 .../org/apache/phoenix/schema/types/PChar.java  |   5 +-
 .../org/apache/phoenix/schema/types/PDate.java  |   6 +-
 .../apache/phoenix/schema/types/PDecimal.java   |   3 +
 .../apache/phoenix/schema/types/PTimestamp.java |  17 +-
 .../phoenix/schema/types/PhoenixArray.java  |  51 ++--
 8 files changed, 358 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
new file mode 100644
index 000..b034193
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
@@ -0,0 +1,300 @@
+/*
+ * 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 java.sql.*;
+
+import org.apache.phoenix.schema.types.PTimestamp;
+import org.apache.phoenix.schema.types.PhoenixArray;
+import org.junit.Test;
+
+public class ArraysWithNullsIT extends BaseClientManagedTimeIT {
+
+@Test
+public void testArrayUpsertIntWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t1 ( k VARCHAR PRIMARY 
KEY, a INTEGER[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t1 
VALUES('a',ARRAY[null,3,null])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t1 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("INTEGER",new Object[]{null,3,null});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+
+
+@Test
+public void testArrayUpsertVarcharWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t2 ( k VARCHAR PRIMARY 
KEY, a VARCHAR[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t2 
VALUES('a',ARRAY['10',null])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t2 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("VARCHAR",new Object[]{"10",null});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+@Test
+public void testArrayUpsertBigIntWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t3 ( k VARCHAR PRIMARY 
KEY, a BIGINT[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t3 
VALUES('a',ARRAY[2,null,32335,4])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t3 
where k = 'a'");
+   

[36/44] phoenix git commit: PHOENIX-978: allow views to extend parent's PK

2015-12-08 Thread ramkrishna
PHOENIX-978: allow views to extend parent's PK


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 9db70f56326d380857bf71b4be82d29276920a82
Parents: b0786f5
Author: Eli Levine 
Authored: Mon Jun 29 16:54:37 2015 -0700
Committer: Eli Levine 
Committed: Mon Jun 29 16:54:37 2015 -0700

--
 .../end2end/TenantSpecificTablesDDLIT.java  | 23 +
 .../java/org/apache/phoenix/end2end/ViewIT.java | 96 
 .../phoenix/exception/SQLExceptionCode.java |  2 -
 .../apache/phoenix/schema/MetaDataClient.java   | 21 +
 4 files changed, 102 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9db70f56/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
index a7c7291..88f91e2 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
@@ -17,9 +17,7 @@
  */
 package org.apache.phoenix.end2end;
 
-import static 
org.apache.phoenix.exception.SQLExceptionCode.CANNOT_DEFINE_PK_FOR_VIEW;
 import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_DROP_PK;
-import static 
org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MODIFY_VIEW_PK;
 import static 
org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MUTATE_TABLE;
 import static org.apache.phoenix.exception.SQLExceptionCode.TABLE_UNDEFINED;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.KEY_SEQ;
@@ -158,16 +156,10 @@ public class TenantSpecificTablesDDLIT extends 
BaseTenantSpecificTablesIT {
 }
 
 @Test
-public void testTenantSpecificTableCannotDeclarePK() throws SQLException {
-try {
-createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL, "CREATE VIEW 
TENANT_TABLE2 ( \n" + 
+public void testTenantSpecificTableCanDeclarePK() throws SQLException {
+createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL, "CREATE VIEW 
TENANT_TABLE2 ( \n" + 
 "tenant_col VARCHAR PRIMARY KEY) AS SELECT 
*\n" + 
 "FROM PARENT_TABLE", null, 
nextTimestamp());
-fail();
-}
-catch (SQLException expected) {
-assertEquals(CANNOT_DEFINE_PK_FOR_VIEW.getErrorCode(), 
expected.getErrorCode());
-}
 }
 
 @Test(expected=ColumnAlreadyExistsException.class)
@@ -259,19 +251,12 @@ public class TenantSpecificTablesDDLIT extends 
BaseTenantSpecificTablesIT {
 }
 
 @Test
-public void testMutationOfPKInTenantTablesNotAllowed() throws Exception {
+public void testDropOfPKInTenantTablesNotAllowed() throws Exception {
 Properties props = new Properties();
 props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
 Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
 try {
-try {
-conn.createStatement().execute("alter table " + 
TENANT_TABLE_NAME + " add new_tenant_pk char(1) primary key");
-fail();
-}
-catch (SQLException expected) {
-assertEquals(CANNOT_MODIFY_VIEW_PK.getErrorCode(), 
expected.getErrorCode());
-}
-
+// try removing a PK col
 try {
 conn.createStatement().execute("alter table " + 
TENANT_TABLE_NAME + " drop column id");
 fail();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9db70f56/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 fb58a8f..db38ab3 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
@@ -17,8 +17,11 @@
  */
 package org.apache.phoenix.end2end;
 
+import static com.google.common.collect.Lists.newArrayListWithExpectedSize;
+import static 
org.apache.phoenix.exception.SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY;
 import static org.apache.phoenix.util.TestUtil.analyzeTable;
 import static 

[18/44] phoenix git commit: PHOENIX-1962 Apply check style to the build

2015-12-08 Thread ramkrishna
PHOENIX-1962 Apply check style to the build


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 29ea503546265a619ce501c477a109b69f940a00
Parents: f2be913
Author: Nick Dimiduk 
Authored: Sat May 9 11:10:54 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon Jun 1 12:21:48 2015 -0700

--
 phoenix-assembly/pom.xml|   4 +
 phoenix-core/pom.xml|   4 +
 phoenix-flume/pom.xml   |   4 +
 phoenix-pherf/pom.xml   |   1 +
 phoenix-pig/pom.xml |   4 +
 phoenix-server-client/pom.xml   |   4 +
 phoenix-server/pom.xml  |   4 +
 phoenix-spark/pom.xml   |   1 +
 pom.xml |  23 ++
 src/main/config/checkstyle/checker.xml  | 281 +++
 src/main/config/checkstyle/header.txt   |  16 ++
 src/main/config/checkstyle/suppressions.xml |  46 
 12 files changed, 392 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 04d9335..d275d03 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -33,6 +33,10 @@
   Assemble Phoenix artifacts
   pom
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 951e969..6302441 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -24,6 +24,10 @@
   http://www.apache.org
   
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index ea87ab0..c7f0650 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -31,6 +31,10 @@
   phoenix-flume
   Phoenix - Flume
 
+  
+${project.basedir}/..
+  
+
   

   org.apache.phoenix

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-pherf/pom.xml
--
diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml
index e751d73..dd45075 100644
--- a/phoenix-pherf/pom.xml
+++ b/phoenix-pherf/pom.xml
@@ -30,6 +30,7 @@
 Phoenix - Pherf
 
 
+  ${project.basedir}/..
 
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-pig/pom.xml
--
diff --git a/phoenix-pig/pom.xml b/phoenix-pig/pom.xml
index 957c06f..55b34d3 100644
--- a/phoenix-pig/pom.xml
+++ b/phoenix-pig/pom.xml
@@ -31,6 +31,10 @@
   phoenix-pig
   Phoenix - Pig
 
+  
+${project.basedir}/..
+  
+
   
 
   org.apache.phoenix

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-server-client/pom.xml
--
diff --git a/phoenix-server-client/pom.xml b/phoenix-server-client/pom.xml
index 748e57c..3e54a07 100644
--- a/phoenix-server-client/pom.xml
+++ b/phoenix-server-client/pom.xml
@@ -24,6 +24,10 @@
 http://www.apache.org
   
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-server/pom.xml
--
diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml
index ab9a472..86b2525 100644
--- a/phoenix-server/pom.xml
+++ b/phoenix-server/pom.xml
@@ -24,6 +24,10 @@
 http://www.apache.org
   
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index e42a7ec..1747573 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -37,6 +37,7 @@
 1.3.0
 2.10.4
 2.10
+${project.basedir}/..
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ea5035/pom.xml
--
diff --git a/pom.xml b/pom.xml
index f6708cc..be44399 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
 

[35/44] phoenix git commit: PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column

2015-12-08 Thread ramkrishna
PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column

Followup commit to adjust the COLUMN_FAMILY_POSITION in QueryUtil as well.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: b0786f5d1082509da9ca2d9f20e651328f025069
Parents: 4c70522
Author: Josh Mahonin 
Authored: Mon Jun 29 15:27:01 2015 -0400
Committer: Josh Mahonin 
Committed: Mon Jun 29 17:00:41 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b0786f5d/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index a2d4a91..bc2141c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -59,7 +59,7 @@ public final class QueryUtil {
 /**
  *  Column family name index within ResultSet resulting from {@link 
DatabaseMetaData#getColumns(String, String, String, String)}
  */
-public static final int COLUMN_FAMILY_POSITION = 24;
+public static final int COLUMN_FAMILY_POSITION = 25;
 
 /**
  *  Column name index within ResultSet resulting from {@link 
DatabaseMetaData#getColumns(String, String, String, String)}



[23/44] phoenix git commit: PHOENIX-2027 Subqueries with no data are raising IllegalStateException(Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-2027 Subqueries with no data are raising IllegalStateException(Alicia 
Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: bfd860ffec62a784f1229997cf98892ea3c0592d
Parents: 18b9e72
Author: Rajeshbabu Chintaguntla 
Authored: Wed Jun 10 01:01:29 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Wed Jun 10 01:01:29 2015 +0530

--
 .../apache/phoenix/end2end/SortMergeJoinIT.java | 54 
 .../phoenix/execute/SortMergeJoinPlan.java  |  4 +-
 2 files changed, 56 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfd860ff/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
index 6f14a45..8b65ab3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
@@ -2658,5 +2658,59 @@ public class SortMergeJoinIT extends 
BaseHBaseManagedTimeIT {
 }
 }
 
+@Test
+public void testSubqueryWithoutData() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+
+try {
+String GRAMMAR_TABLE = "CREATE TABLE IF NOT EXISTS GRAMMAR_TABLE 
(ID INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String LARGE_TABLE = "CREATE TABLE IF NOT EXISTS LARGE_TABLE (ID 
INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String SECONDARY_LARGE_TABLE = "CREATE TABLE IF NOT EXISTS 
SECONDARY_LARGE_TABLE (SEC_ID INTEGER PRIMARY KEY," +
+"sec_unsig_id UNSIGNED_INT, sec_big_id BIGINT, 
sec_usnig_long_id UNSIGNED_LONG, sec_tiny_id TINYINT," + 
+"sec_unsig_tiny_id UNSIGNED_TINYINT, sec_small_id 
SMALLINT, sec_unsig_small_id UNSIGNED_SMALLINT," + 
+"sec_float_id FLOAT, sec_unsig_float_id UNSIGNED_FLOAT, 
sec_double_id DOUBLE, sec_unsig_double_id UNSIGNED_DOUBLE," +
+"sec_decimal_id DECIMAL, sec_boolean_id BOOLEAN, 
sec_time_id TIME, sec_date_id DATE," +
+"sec_timestamp_id TIMESTAMP, sec_unsig_time_id TIME, 
sec_unsig_date_id DATE, sec_unsig_timestamp_id TIMESTAMP," +
+"sec_varchar_id VARCHAR (30), sec_char_id CHAR (30), 
sec_binary_id BINARY (100), sec_varbinary_id VARBINARY (100))";
+createTestTable(getUrl(), GRAMMAR_TABLE);
+createTestTable(getUrl(), LARGE_TABLE);
+createTestTable(getUrl(), SECONDARY_LARGE_TABLE);
+
+String ddl = "SELECT /*+USE_SORT_MERGE_JOIN*/ * FROM (SELECT ID, 
BIG_ID, DATE_ID FROM LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A " +
+"INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, 
SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS 
B " + 
+"ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT 
SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 

[42/44] phoenix git commit: PHOENIX-1875 implement ARRAY_PREPEND built in function (Dumindu)

2015-12-08 Thread ramkrishna
PHOENIX-1875 implement ARRAY_PREPEND built in function (Dumindu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 7b448cc24c48f695836c72a2dd08c7454ae928bc
Parents: 13ddda2
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed May 13 10:46:19 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Jul 1 09:50:26 2015 +0530

--
 .../phoenix/end2end/ArrayPrependFunctionIT.java | 652 +++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../function/ArrayAppendFunction.java   |  35 +-
 .../function/ArrayModifierFunction.java |  75 +++
 .../function/ArrayPrependFunction.java  |  96 +++
 .../phoenix/schema/types/PArrayDataType.java| 161 -
 .../expression/ArrayPrependFunctionTest.java| 552 
 7 files changed, 1541 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b448cc2/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
new file mode 100644
index 000..3145d95
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
@@ -0,0 +1,652 @@
+/*
+ * 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.assertFalse;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.*;
+
+import org.apache.phoenix.schema.TypeMismatchException;
+import org.apache.phoenix.schema.types.PhoenixArray;
+import org.junit.Test;
+
+public class ArrayPrependFunctionIT extends BaseHBaseManagedTimeIT {
+
+private void initTableWithVarArray(Connection conn, String type, Object[] 
objectArray, String value) throws SQLException {
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a " + type + "[],b " + type + ")");
+conn.commit();
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t 
VALUES(?,?," + value + ")");
+PhoenixArray array = (PhoenixArray) conn.createArrayOf(type, 
objectArray);
+stmt.setString(1, "a");
+stmt.setArray(2, array);
+stmt.execute();
+conn.commit();
+
+}
+
+private void initTables(Connection conn) throws Exception {
+String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY 
KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints 
BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck 
INTEGER,chars2 CHAR(15)[])";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO 
regions(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2)
 VALUES('SF Bay Area'," +
+"ARRAY['2345','46345','23234']," +
+"ARRAY[2345,46345,23234,456]," +
+"ARRAY[23.45,46.345,23.234,45.6,5.78]," +
+"ARRAY[12,34,56,78,910]," +
+"ARRAY['a','','c','ddd','e']," +
+"23.45," +
+"'wert'," +
+"NULL," +
+"ARRAY['foo','a','','c','ddd','e']" +
+")";
+PreparedStatement stmt = conn.prepareStatement(dml);
+stmt.execute();
+conn.commit();
+}
+
+private void initTablesDesc(Connection conn, String type, String val) 
throws E

[11/44] phoenix git commit: PHOENIX-1964 - porting from master

2015-12-08 Thread ramkrishna
PHOENIX-1964 - porting from master


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c95e28df94241f47d5cfe9a1515b21960c93adf2
Parents: 0e0b4dd
Author: cmarcel 
Authored: Wed May 27 13:58:45 2015 -0700
Committer: cmarcel 
Committed: Wed May 27 13:58:45 2015 -0700

--
 phoenix-pherf/config/pherf.properties   |  3 ++
 .../org/apache/phoenix/pherf/DataIngestIT.java  |  3 +-
 .../apache/phoenix/pherf/ResultBaseTestIT.java  | 45 ++
 .../java/org/apache/phoenix/pherf/Pherf.java|  7 +--
 .../apache/phoenix/pherf/PherfConstants.java| 50 +++-
 .../phoenix/pherf/loaddata/DataLoader.java  |  2 +-
 .../apache/phoenix/pherf/result/ResultUtil.java |  4 +-
 .../pherf/result/impl/CSVResultHandler.java |  5 +-
 .../pherf/result/impl/ImageResultHandler.java   |  5 +-
 .../pherf/result/impl/XMLResultHandler.java |  6 ++-
 .../apache/phoenix/pherf/util/ResourceList.java | 26 --
 .../pherf/workload/WorkloadExecutor.java|  2 +-
 .../phoenix/pherf/ConfigurationParserTest.java  |  2 +-
 .../org/apache/phoenix/pherf/ResourceTest.java  |  8 ++--
 .../apache/phoenix/pherf/ResultBaseTest.java| 44 +
 .../org/apache/phoenix/pherf/ResultTest.java|  5 +-
 16 files changed, 168 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c95e28df/phoenix-pherf/config/pherf.properties
--
diff --git a/phoenix-pherf/config/pherf.properties 
b/phoenix-pherf/config/pherf.properties
index 354707a..1142f9b5 100644
--- a/phoenix-pherf/config/pherf.properties
+++ b/phoenix-pherf/config/pherf.properties
@@ -29,3 +29,6 @@ pherf.default.dataloader.threadpool=0
 # When upserting, this is the max # of rows that will be inserted in a single 
commit
 pherf.default.dataloader.batchsize=1000
 
+# Directory where results from a scenario run will be written
+pherf.default.results.dir=RESULTS
+

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c95e28df/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
--
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
index b29656d..2b56f43 100644
--- a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
@@ -18,7 +18,6 @@
 
 package org.apache.phoenix.pherf;
 
-import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT;
 import org.apache.phoenix.pherf.configuration.Column;
 import org.apache.phoenix.pherf.configuration.DataTypeMapping;
 import org.apache.phoenix.pherf.configuration.Scenario;
@@ -39,7 +38,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-public class DataIngestIT extends BaseHBaseManagedTimeIT {
+public class DataIngestIT extends ResultBaseTestIT {
 protected static PhoenixUtil util = new PhoenixUtil(true);
 static final String matcherScenario = ".*scenario/.*test.*xml";
 static final String matcherSchema = ".*datamodel/.*test.*sql";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c95e28df/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
--
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
new file mode 100644
index 000..6e103b8
--- /dev/null
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
@@ -0,0 +1,45 @@
+/*
+ * 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 

[19/44] phoenix git commit: PHOENIX-2012 RowKeyComparisonFilter logs unencoded data at DEBUG level

2015-12-08 Thread ramkrishna
PHOENIX-2012 RowKeyComparisonFilter logs unencoded data at DEBUG level


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 9c5fae456f3a0934e43e02af0ef5188b9337
Parents: 29ea503
Author: Nick Dimiduk 
Authored: Wed May 27 15:58:32 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon Jun 1 15:57:15 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9c5f/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
index 2e2037b..b7de7ac 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
@@ -73,8 +73,9 @@ public class RowKeyComparisonFilter extends 
BooleanExpressionFilter {
 if (evaluate) {
 inputTuple.setKey(v.getRowArray(), v.getRowOffset(), 
v.getRowLength());
 this.keepRow = Boolean.TRUE.equals(evaluate(inputTuple));
-if (logger.isDebugEnabled()) {
-logger.debug("RowKeyComparisonFilter: " + (this.keepRow ? 
"KEEP" : "FILTER")  + " row " + inputTuple);
+if (logger.isTraceEnabled()) {
+logger.trace("RowKeyComparisonFilter: " + (this.keepRow ? 
"KEEP" : "FILTER")
++ " row " + inputTuple);
 }
 evaluate = false;
 }



[41/44] phoenix git commit: minor changes based on jesses feedback

2015-12-08 Thread ramkrishna
minor changes based on jesses feedback


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 13ddda22e82f9016b9e46544f659a03c8e7d1e5c
Parents: 6a96bd2
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon Jun 15 16:18:47 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:56 2015 +0530

--
 .../src/main/java/org/apache/phoenix/pig/util/TypeUtil.java   | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/13ddda22/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index 6e32fb5..5820ec6 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -76,9 +76,7 @@ public final class TypeUtil {
 private TypeUtil() {}
 
 /**
- * A map of Phoenix to Pig data types.
- * 
- * @return
+ * @return map of Phoenix to Pig data types.
  */
 private static ImmutableMap<PDataType, Byte> init() {
 final ImmutableMap.Builder<PDataType, Byte> builder = new 
Builder<PDataType, Byte>();
@@ -160,7 +158,8 @@ public final class TypeUtil {
 
 /**
  * This method encodes a value with Phoenix data type. It begins with 
checking whether an object is BINARY and makes
- * a call to {@link #castBytes(Object, PDataType)} to convery bytes to 
targetPhoenixType
+ * a call to {@link #castBytes(Object, PDataType)} to convert bytes to 
targetPhoenixType. It returns a {@link RuntimeException}
+ * when object can not be coerced.
  * 
  * @param o
  * @param targetPhoenixType



[26/44] phoenix git commit: PHOENIX-2032 psql.py is broken after PHOENIX-2013

2015-12-08 Thread ramkrishna
PHOENIX-2032 psql.py is broken after PHOENIX-2013


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

Branch: refs/heads/4.x-HBase-1.1
Commit: d0bcb7b2304133031b945d50e01f0f1d5fd023d4
Parents: e64f61b
Author: Nick Dimiduk 
Authored: Fri Jun 12 10:23:05 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri Jun 12 17:01:27 2015 -0700

--
 phoenix-assembly/pom.xml  |  4 
 phoenix-assembly/src/build/client.xml | 27 +++
 2 files changed, 23 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d0bcb7b2/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index d275d03..ebc5d71 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -152,10 +152,6 @@
 
 
   org.apache.phoenix
-  phoenix-spark
-
-
-  org.apache.phoenix
   phoenix-server
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d0bcb7b2/phoenix-assembly/src/build/client.xml
--
diff --git a/phoenix-assembly/src/build/client.xml 
b/phoenix-assembly/src/build/client.xml
index 101ccd6..e99bb19 100644
--- a/phoenix-assembly/src/build/client.xml
+++ b/phoenix-assembly/src/build/client.xml
@@ -53,13 +53,32 @@
 
 
 
+  phoenix-flume, phoenix-pig, etc). We should exclude phoenix-server and
+  phoenix-server-client in the future, see PHOENIX-2032, PHOENIX-2038 -->
 
   /
   true
-  
-org.apache.phoenix:phoenix-*
-  
+  
+  
+
+  *license*
+  *LICENSE*
+  **/license/**
+  **/LICENSE/**
+
+  
+  
+  true
+  
+  
 
   
 



[04/44] phoenix git commit: PHOENIX-1763 Support building with HBase-1.1.0

2015-12-08 Thread ramkrishna
PHOENIX-1763 Support building with HBase-1.1.0


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 98271b888c113f10e174205434e05d3b36b7eb67
Parents: bf01eb2
Author: Enis Soztutar 
Authored: Thu May 21 23:08:26 2015 -0700
Committer: Enis Soztutar 
Committed: Fri May 22 00:30:56 2015 -0700

--
 phoenix-core/pom.xml| 17 +++--
 .../regionserver/IndexHalfStoreFileReader.java  | 31 ++--
 .../regionserver/IndexSplitTransaction.java | 39 --
 .../hbase/regionserver/LocalIndexMerger.java|  3 +-
 .../cache/aggcache/SpillableGroupByCache.java   | 13 +++-
 .../phoenix/coprocessor/BaseRegionScanner.java  | 12 +--
 .../coprocessor/BaseScannerRegionObserver.java  | 77 +++-
 .../coprocessor/DelegateRegionScanner.java  | 23 --
 .../GroupedAggregateRegionObserver.java | 53 --
 .../coprocessor/HashJoinRegionScanner.java  | 60 ---
 .../coprocessor/MetaDataRegionObserver.java | 23 +++---
 .../phoenix/coprocessor/ScanRegionObserver.java | 11 ++-
 .../UngroupedAggregateRegionObserver.java   | 55 +++---
 .../hbase/index/covered/data/LocalTable.java|  2 +-
 .../index/covered/filter/FamilyOnlyFilter.java  |  6 +-
 .../index/scanner/FilteredKeyValueScanner.java  |  2 +-
 .../phoenix/index/PhoenixIndexBuilder.java  |  6 +-
 .../iterate/RegionScannerResultIterator.java|  9 ++-
 .../phoenix/schema/stats/StatisticsScanner.java | 10 ++-
 .../hbase/ipc/PhoenixIndexRpcSchedulerTest.java |  6 +-
 .../index/covered/TestLocalTableState.java  |  1 -
 .../covered/filter/TestFamilyOnlyFilter.java| 12 +--
 .../index/write/TestWALRecoveryCaching.java |  4 +-
 phoenix-flume/pom.xml   |  9 ---
 phoenix-pig/pom.xml | 31 +---
 phoenix-spark/pom.xml   |  7 ++
 pom.xml | 41 ++-
 27 files changed, 361 insertions(+), 202 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 45b8d73..22e6b60 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -350,16 +350,25 @@
 
   org.apache.hbase
   hbase-it
-  ${hbase.version}
   test-jar
   test
 
 
   org.apache.hbase
+  hbase-annotations
+
+
+  org.apache.hbase
   hbase-common
 
 
   org.apache.hbase
+  hbase-common
+  test
+  test-jar
+
+
+  org.apache.hbase
   hbase-protocol
 
 
@@ -369,18 +378,16 @@
 
   org.apache.hbase
   hbase-server
-  ${hbase.version}
 
 
   org.apache.hbase
   hbase-server
-  ${hbase.version}
   test-jar
+  test
 
 
   org.apache.hbase
   hbase-hadoop-compat
-  test
 
 
   org.apache.hbase
@@ -391,13 +398,11 @@
 
   org.apache.hbase
   hbase-hadoop2-compat
-  ${hbase.version}
   test
 
 
   org.apache.hbase
   hbase-hadoop2-compat
-  ${hbase.version}
   test-jar
   test
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
index 49e2022..9befc8c 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
@@ -47,11 +47,11 @@ import org.apache.phoenix.index.IndexMaintainer;
  * that sort lowest and 'top' is the second half of the file with keys that 
sort greater than those
  * of the bottom half. The top includes the split files midkey, of the key 
that follows if it does
  * not exist in the file.
- * 
+ *
  * 
  * This type works in tandem with the {@link Reference} type. This class is 
used reading while
  * Reference is used writing.
- * 
+ *
  * 
  * This file is not splitable. Calls to {@link #midkey()} return null.
  */
@@ -64,7 +64,7 @@ public class IndexHalfStoreFileReader extends 
StoreFile.Reader {
 private final byte[] splitkey;
 private final 

[07/44] phoenix git commit: PHOENIX-2005 Connection utilities omit zk client port, parent znode

2015-12-08 Thread ramkrishna
PHOENIX-2005 Connection utilities omit zk client port, parent znode


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c6b37b979da1b514bcb9257c7e095e39b0c2c215
Parents: 3cdc323
Author: Nick Dimiduk 
Authored: Tue May 26 11:11:48 2015 -0700
Committer: Nick Dimiduk 
Committed: Tue May 26 13:27:03 2015 -0700

--
 .../phoenix/jdbc/PhoenixEmbeddedDriver.java | 28 --
 .../phoenix/mapreduce/CsvBulkLoadTool.java  | 93 ++--
 .../phoenix/mapreduce/CsvToKeyValueMapper.java  | 26 +-
 .../query/ConnectionQueryServicesImpl.java  |  4 +-
 .../java/org/apache/phoenix/util/QueryUtil.java | 45 --
 .../phoenix/jdbc/PhoenixEmbeddedDriverTest.java | 14 ++-
 .../phoenix/mapreduce/CsvBulkLoadToolTest.java  | 11 ---
 .../mapreduce/CsvToKeyValueMapperTest.java  | 15 
 .../org/apache/phoenix/util/QueryUtilTest.java  | 33 ---
 9 files changed, 139 insertions(+), 130 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c6b37b97/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index 9e95667..2451603 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -31,6 +31,7 @@ import java.util.logging.Logger;
 
 import javax.annotation.concurrent.Immutable;
 
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
@@ -174,10 +175,10 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 }
 
 /**
- * 
+ *
  * Class to encapsulate connection info for HBase
  *
- * 
+ *
  * @since 0.1.1
  */
 public static class ConnectionInfo {
@@ -204,12 +205,18 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 return false;
 }
 
-protected static ConnectionInfo create(String url) throws SQLException 
{
-StringTokenizer tokenizer = new StringTokenizer(url == null ? "" : 
url.substring(PhoenixRuntime.JDBC_PROTOCOL.length()),DELIMITERS, true);
+public static ConnectionInfo create(String url) throws SQLException {
+url = url == null ? "" : url;
+url = url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)
+? url.substring(PhoenixRuntime.JDBC_PROTOCOL.length())
+: url;
+StringTokenizer tokenizer = new StringTokenizer(url, DELIMITERS, 
true);
 int nTokens = 0;
 String[] tokens = new String[5];
 String token = null;
-while (tokenizer.hasMoreTokens() && 
!(token=tokenizer.nextToken()).equals(TERMINATOR) && tokenizer.hasMoreTokens() 
&& nTokens < tokens.length) {
+while (tokenizer.hasMoreTokens() &&
+!(token=tokenizer.nextToken()).equals(TERMINATOR) &&
+tokenizer.hasMoreTokens() && nTokens < tokens.length) {
 token = tokenizer.nextToken();
 // This would mean we have an empty string for a token which 
is illegal
 if (DELIMITERS.contains(token)) {
@@ -316,8 +323,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 private final String principal;
 private final String keytab;
 
-// used for testing
-ConnectionInfo(String zookeeperQuorum, Integer port, String rootNode, 
String principal, String keytab) {
+public ConnectionInfo(String zookeeperQuorum, Integer port, String 
rootNode, String principal, String keytab) {
 this.zookeeperQuorum = zookeeperQuorum;
 this.port = port;
 this.rootNode = rootNode;
@@ -326,8 +332,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 this.keytab = keytab;
 }
 
-// used for testing
-ConnectionInfo(String zookeeperQuorum, Integer port, String rootNode) {
+public ConnectionInfo(String zookeeperQuorum, Integer port, String 
rootNode) {
this(zookeeperQuorum, port, rootNode, null, null);
 }
 
@@ 

[15/44] phoenix git commit: PHOENIX-2007 java.sql.SQLException: Encountered exception in sub plan [0] execution(Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-2007 java.sql.SQLException: Encountered exception in sub plan [0] 
execution(Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: eb9452d55068ff4574b48938aebba765c28caaaf
Parents: c1882ee
Author: Rajeshbabu Chintaguntla 
Authored: Mon Jun 1 21:05:24 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon Jun 1 21:05:24 2015 +0530

--
 .../org/apache/phoenix/end2end/HashJoinIT.java  | 54 
 .../apache/phoenix/execute/HashJoinPlan.java|  7 +--
 2 files changed, 58 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/eb9452d5/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index a03204a..88e03ca 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -3813,6 +3813,60 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
 }
 }
 
+@Test
+public void testSubqueryWithoutData() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+
+try {
+String GRAMMAR_TABLE = "CREATE TABLE IF NOT EXISTS GRAMMAR_TABLE 
(ID INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String LARGE_TABLE = "CREATE TABLE IF NOT EXISTS LARGE_TABLE (ID 
INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String SECONDARY_LARGE_TABLE = "CREATE TABLE IF NOT EXISTS 
SECONDARY_LARGE_TABLE (SEC_ID INTEGER PRIMARY KEY," +
+"sec_unsig_id UNSIGNED_INT, sec_big_id BIGINT, 
sec_usnig_long_id UNSIGNED_LONG, sec_tiny_id TINYINT," + 
+"sec_unsig_tiny_id UNSIGNED_TINYINT, sec_small_id 
SMALLINT, sec_unsig_small_id UNSIGNED_SMALLINT," + 
+"sec_float_id FLOAT, sec_unsig_float_id UNSIGNED_FLOAT, 
sec_double_id DOUBLE, sec_unsig_double_id UNSIGNED_DOUBLE," +
+"sec_decimal_id DECIMAL, sec_boolean_id BOOLEAN, 
sec_time_id TIME, sec_date_id DATE," +
+"sec_timestamp_id TIMESTAMP, sec_unsig_time_id TIME, 
sec_unsig_date_id DATE, sec_unsig_timestamp_id TIMESTAMP," +
+"sec_varchar_id VARCHAR (30), sec_char_id CHAR (30), 
sec_binary_id BINARY (100), sec_varbinary_id VARBINARY (100))";
+createTestTable(getUrl(), GRAMMAR_TABLE);
+createTestTable(getUrl(), LARGE_TABLE);
+createTestTable(getUrl(), SECONDARY_LARGE_TABLE);
+
+String ddl = "SELECT * FROM (SELECT ID, BIG_ID, DATE_ID FROM 
LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A " +
+"INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, 
SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS 
B " + 
+"ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT 
SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 100) " +  
+"AND 

[22/44] phoenix git commit: PHOENIX-1978 UDF ArgumentTypeMismatchException(Rajeshbabu)

2015-12-08 Thread ramkrishna
PHOENIX-1978 UDF ArgumentTypeMismatchException(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 18b9e72756642e127b2e227ea46a4f70401e6187
Parents: 58ee706
Author: Rajeshbabu Chintaguntla 
Authored: Fri Jun 5 09:04:17 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Fri Jun 5 09:04:17 2015 +0530

--
 .../phoenix/end2end/UserDefinedFunctionsIT.java | 58 ++--
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 17 +++---
 2 files changed, 61 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/18b9e727/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
index 868e19d..c6bd62f 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
@@ -58,6 +58,8 @@ import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.FunctionAlreadyExistsException;
 import org.apache.phoenix.schema.FunctionNotFoundException;
 import org.apache.phoenix.schema.ValueRangeExcpetion;
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -121,11 +123,31 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
 .append("
ptr.set(PInteger.INSTANCE.toBytes((Integer)sum));\n")
 .append("return true;\n")
 .append("}\n").toString();
-
+private static String ARRAY_INDEX_EVALUATE_METHOD =
+new StringBuffer()
+.append("public boolean evaluate(Tuple tuple, 
ImmutableBytesWritable ptr) {\n")
+.append("Expression indexExpr = 
children.get(1);\n")
+.append("if (!indexExpr.evaluate(tuple, ptr)) {\n")
+.append("   return false;\n")
+.append("} else if (ptr.getLength() == 0) {\n")
+.append("   return true;\n")
+.append("}\n")
+.append("// Use Codec to prevent Integer object 
allocation\n")
+.append("int index = 
PInteger.INSTANCE.getCodec().decodeInt(ptr, indexExpr.getSortOrder());\n")
+.append("if(index < 0) {\n")
+.append("   throw new ParseException(\"Index 
cannot be negative :\" + index);\n")
+.append("}\n")
+.append("Expression arrayExpr = 
children.get(0);\n")
+.append("return 
PArrayDataType.positionAtArrayElement(tuple, ptr, index, arrayExpr, 
getDataType(),getMaxLength());\n")
+.append("}\n").toString();
+
+
 private static String MY_REVERSE_CLASS_NAME = "MyReverse";
 private static String MY_SUM_CLASS_NAME = "MySum";
-private static String MY_REVERSE_PROGRAM = 
getProgram(MY_REVERSE_CLASS_NAME, STRING_REVERSE_EVALUATE_METHOD, "PVarchar");
-private static String MY_SUM_PROGRAM = getProgram(MY_SUM_CLASS_NAME, 
SUM_COLUMN_VALUES_EVALUATE_METHOD, "PInteger");
+private static String MY_ARRAY_INDEX_CLASS_NAME = "MyArrayIndex";
+private static String MY_REVERSE_PROGRAM = 
getProgram(MY_REVERSE_CLASS_NAME, STRING_REVERSE_EVALUATE_METHOD, "return 
PVarchar.INSTANCE;");
+private static String MY_SUM_PROGRAM = getProgram(MY_SUM_CLASS_NAME, 
SUM_COLUMN_VALUES_EVALUATE_METHOD, "return PInteger.INSTANCE;");
+private static String MY_ARRAY_INDEX_PROGRAM = 
getProgram(MY_ARRAY_INDEX_CLASS_NAME, ARRAY_INDEX_EVALUATE_METHOD, "return 
PDataType.fromTypeId(children.get(0).getDataType().getSqlType()- 
PDataType.ARRAY_TYPE_BASE);");
 private static Properties EMPTY_PROPS = new Properties();
 
 
@@ -144,6 +166,8 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
 .append("import org.apache.phoenix.schema.types.PInteger;\n")
 .append("import org.apache.phoenix.schema.types.PVarchar;\n")
 .append("import org.apache.phoenix.util.StringUtil;\n")
+   

[39/44] phoenix git commit: PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data types

2015-12-08 Thread ramkrishna
PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data 
types


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 76a478661bcf67340a4f2e0e0a784e2b03e981f4
Parents: 7b04ce4
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon May 18 19:47:01 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:54 2015 +0530

--
 .../org/apache/phoenix/pig/util/TypeUtil.java   | 24 ++--
 .../apache/phoenix/pig/util/TypeUtilTest.java   | 20 
 2 files changed, 37 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/76a47866/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index 6549445..c8bc9d8 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -1,11 +1,21 @@
 /*
- * 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.
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * 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 maynot 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 applicablelaw 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.pig.util;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/76a47866/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
--
diff --git 
a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java 
b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
index 25d9f48..56167f6 100644
--- a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
+++ b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
@@ -1,3 +1,23 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * 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 maynot 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 applicablelaw 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.pig.util;
 
 import static org.junit.Assert.assertEquals;



[10/44] phoenix git commit: PHOENIX-2013 Apply PHOENIX-1995 to runnable uberjar as well

2015-12-08 Thread ramkrishna
PHOENIX-2013 Apply PHOENIX-1995 to runnable uberjar as well


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 0e0b4ddb4d130b38c7aa28d2e31b0a9552087256
Parents: 1a2f2dc
Author: Nick Dimiduk 
Authored: Wed May 27 11:27:04 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed May 27 13:20:32 2015 -0700

--
 phoenix-server/src/build/query-server-runnable.xml | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0e0b4ddb/phoenix-server/src/build/query-server-runnable.xml
--
diff --git a/phoenix-server/src/build/query-server-runnable.xml 
b/phoenix-server/src/build/query-server-runnable.xml
index e2a3dc4..ef22b14 100644
--- a/phoenix-server/src/build/query-server-runnable.xml
+++ b/phoenix-server/src/build/query-server-runnable.xml
@@ -28,6 +28,15 @@
 jar
   
   false
+  
+
+  
+  metaInf-services
+
+  
   
 
   /



[03/44] phoenix git commit: PHOENIX-1763 Support building with HBase-1.1.0

2015-12-08 Thread ramkrishna
http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/phoenix-pig/pom.xml
--
diff --git a/phoenix-pig/pom.xml b/phoenix-pig/pom.xml
index 2db1af6..015a660 100644
--- a/phoenix-pig/pom.xml
+++ b/phoenix-pig/pom.xml
@@ -54,7 +54,6 @@
 
   org.apache.hbase
   hbase-testing-util
-  ${hbase.version}
   test
   true
   
@@ -67,7 +66,6 @@
 
   org.apache.hbase
   hbase-it
-  ${hbase.version}
   test-jar
   test
   
@@ -80,41 +78,56 @@
 
   org.apache.hbase
   hbase-common
-  ${hbase.version}
+
+
+  org.apache.hbase
+  hbase-common
+  test
+  test-jar
 
 
   org.apache.hbase
   hbase-protocol
-  ${hbase.version}
 
 
   org.apache.hbase
   hbase-client
-  ${hbase.version}
+
+   
+  org.apache.hbase
+  hbase-server
+
+
+  org.apache.hbase
+  hbase-server
+  test-jar
+  test
+
+
+  org.apache.hbase
+  hbase-client
+  test-jar
+  test
 
 
   org.apache.hbase
   hbase-hadoop-compat
-  ${hbase.version}
   test
 
 
   org.apache.hbase
   hbase-hadoop-compat
-  ${hbase.version}
   test-jar
   test
 
 
   org.apache.hbase
   hbase-hadoop2-compat
-  ${hbase.version}
   test
 
 
   org.apache.hbase
   hbase-hadoop2-compat
-  ${hbase.version}
   test-jar
   test
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index adeed88..a232cf4 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -460,6 +460,13 @@
 
 
   org.apache.hbase
+  hbase-server
+  ${hbase.version}
+  test
+  test-jar
+
+
+  org.apache.hbase
   hbase-it
   ${hbase.version}
   test-jar

http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/pom.xml
--
diff --git a/pom.xml b/pom.xml
index d310c37..4361e54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,7 +78,7 @@
 true
 
 
-1.0.1
+1.1.0
 2.5.1
 
 
@@ -452,6 +452,11 @@
   
   
 org.apache.hbase
+hbase-annotations
+${hbase.version}
+  
+  
+org.apache.hbase
 hbase-testing-util
 ${hbase.version}
 test
@@ -488,13 +493,34 @@
   
   
 org.apache.hbase
+hbase-common
+${hbase.version}
+test-jar
+test
+  
+  
+org.apache.hbase
 hbase-client
 ${hbase.version}
   
   
 org.apache.hbase
+hbase-client
+${hbase.version}
+test-jar
+test
+  
+  
+org.apache.hbase
+hbase-server
+${hbase.version}
+  
+  
+org.apache.hbase
 hbase-server
 ${hbase.version}
+test-jar
+test
   
   
 org.apache.hbase
@@ -508,6 +534,19 @@
 test-jar
 test
   
+  
+org.apache.hbase
+hbase-hadoop2-compat
+${hbase.version}
+test
+  
+  
+org.apache.hbase
+hbase-hadoop2-compat
+${hbase.version}
+test-jar
+test
+  
 
   
   



[14/44] phoenix git commit: PHOENIX-2022 Make BaseRegionScanner.next abstract

2015-12-08 Thread ramkrishna
PHOENIX-2022 Make BaseRegionScanner.next abstract

Avoid infinite recursion by removing a recursive call within
BaseRegionScanner.next, which was already being used as an
abstract method.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c1882ee279293b560fda9beb10ac50b8d3ead589
Parents: b2c0cb9
Author: Gabriel Reid 
Authored: Mon Jun 1 08:57:22 2015 +0200
Committer: Gabriel Reid 
Committed: Mon Jun 1 17:22:49 2015 +0200

--
 .../java/org/apache/phoenix/coprocessor/BaseRegionScanner.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1882ee2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
index 828f776..3f73048 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
@@ -33,9 +33,7 @@ public abstract class BaseRegionScanner implements 
RegionScanner {
 }
 
 @Override
-public boolean next(List results) throws IOException {
-return next(results);
-}
+public abstract boolean next(List results) throws IOException;
 
 @Override
 public boolean next(List result, ScannerContext scannerContext) 
throws IOException {



[01/44] phoenix git commit: PHOENIX-1681 Use the new Region Interface (Andrew Purtell)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 [created] a9e1997ed


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea622d5f/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
index 272cac6..e7e1dd7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
@@ -31,8 +31,8 @@ import org.apache.hadoop.hbase.KeyValueUtil;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
@@ -111,7 +111,7 @@ public class StatisticsCollector {
 this.statsTable.close();
 }
 
-public void updateStatistic(HRegion region) {
+public void updateStatistic(Region region) {
 try {
 ArrayList mutations = new ArrayList();
 writeStatsToStatsTable(region, true, mutations, 
TimeKeeper.SYSTEM.getCurrentTime());
@@ -126,7 +126,7 @@ public class StatisticsCollector {
 }
 }
 
-private void writeStatsToStatsTable(final HRegion region,
+private void writeStatsToStatsTable(final Region region,
 boolean delete, List mutations, long currentTime) throws 
IOException {
 try {
 // update the statistics table
@@ -215,7 +215,7 @@ public class StatisticsCollector {
 }
 }
 
-public InternalScanner createCompactionScanner(HRegion region, Store 
store, InternalScanner s) throws IOException {
+public InternalScanner createCompactionScanner(Region region, Store store, 
InternalScanner s) throws IOException {
 // See if this is for Major compaction
 if (logger.isDebugEnabled()) {
 logger.debug("Compaction scanner created for stats");
@@ -224,13 +224,13 @@ public class StatisticsCollector {
 return getInternalScanner(region, store, s, cfKey);
 }
 
-public void splitStats(HRegion parent, HRegion left, HRegion right) {
+public void splitStats(Region parent, Region left, Region right) {
 try {
 if (logger.isDebugEnabled()) {
 logger.debug("Collecting stats for split of " + 
parent.getRegionInfo() + " into " + left.getRegionInfo() + " and " + 
right.getRegionInfo());
 }
 List mutations = Lists.newArrayListWithExpectedSize(3);
-for (byte[] fam : parent.getStores().keySet()) {
+for (byte[] fam : parent.getTableDesc().getFamiliesKeys()) {
statsTable.splitStats(parent, left, right, this, new 
ImmutableBytesPtr(fam), mutations);
 }
 if (logger.isDebugEnabled()) {
@@ -243,7 +243,7 @@ public class StatisticsCollector {
 }
 }
 
-protected InternalScanner getInternalScanner(HRegion region, Store store,
+protected InternalScanner getInternalScanner(Region region, Store store,
 InternalScanner internalScan, ImmutableBytesPtr family) {
 return new StatisticsScanner(this, statsTable, region, internalScan, 
family);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea622d5f/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
index 0e50923..582c4de 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
@@ -26,9 +26,9 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 
 /**
@@ -38,11 +38,11 @@ public class StatisticsScanner implements InternalScanner {
 private static final Log LOG = LogFactory.getLog(StatisticsScanner.class);
 

[08/44] phoenix git commit: PHOENIX-2005 Connection utilities omit zk client port, parent znode (addendum)

2015-12-08 Thread ramkrishna
PHOENIX-2005 Connection utilities omit zk client port, parent znode (addendum)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 5546a42226e3f0fdf0cc89f1c175ff3da7a75d8c
Parents: c6b37b9
Author: Nick Dimiduk 
Authored: Tue May 26 17:41:04 2015 -0700
Committer: Nick Dimiduk 
Committed: Tue May 26 17:52:24 2015 -0700

--
 .../phoenix/jdbc/PhoenixEmbeddedDriver.java |  2 +-
 .../java/org/apache/phoenix/util/QueryUtil.java |  2 +-
 .../phoenix/jdbc/PhoenixEmbeddedDriverTest.java | 20 
 3 files changed, 22 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5546a422/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index 2451603..3cfaacc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -209,7 +209,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 url = url == null ? "" : url;
 url = url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)
 ? url.substring(PhoenixRuntime.JDBC_PROTOCOL.length())
-: url;
+: PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + url;
 StringTokenizer tokenizer = new StringTokenizer(url, DELIMITERS, 
true);
 int nTokens = 0;
 String[] tokens = new String[5];

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5546a422/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index bd38983..a2d4a91 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -290,7 +290,7 @@ public final class QueryUtil {
 throws ClassNotFoundException,
 SQLException {
 String url = getConnectionUrl(props, conf);
-LOG.info("Creating connection with the jdbc url:" + url);
+LOG.info("Creating connection with the jdbc url: " + url);
 PropertiesUtil.extractProperties(props, conf);
 return DriverManager.getConnection(url, props);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5546a422/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
index 083b205..4eda825 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
@@ -34,23 +34,33 @@ public class PhoenixEmbeddedDriverTest {
 @Test
 public void testGetConnectionInfo() throws SQLException {
 String[] urls = new String[] {
+null,
+"",
 "jdbc:phoenix",
 "jdbc:phoenix;test=true",
 "jdbc:phoenix:localhost",
+"localhost",
+"localhost;",
 "jdbc:phoenix:localhost:123",
 "jdbc:phoenix:localhost:123;foo=bar",
+"localhost:123",
 "jdbc:phoenix:localhost:123:/hbase",
 "jdbc:phoenix:localhost:123:/foo-bar",
 "jdbc:phoenix:localhost:123:/foo-bar;foo=bas",
+"localhost:123:/foo-bar",
 "jdbc:phoenix:localhost:/hbase",
 "jdbc:phoenix:localhost:/foo-bar",
 "jdbc:phoenix:localhost:/foo-bar;test=true",
+"localhost:/foo-bar",
 "jdbc:phoenix:v1,v2,v3",
 "jdbc:phoenix:v1,v2,v3;",
 "jdbc:phoenix:v1,v2,v3;test=true",
+"v1,v2,v3",
 "jdbc:phoenix:v1,v2,v3:/hbase",
 "jdbc:phoenix:v1,v2,v3:/hbase;test=true",
+"v1,v2,v3:/foo-bar",
 "jdbc:phoenix:v1,v2,v3:123:/hbase",
+"v1,v2,v3:123:/hbase",
 

[32/44] phoenix git commit: PHOENIX-2073 Two bytes character in LIKE expression is not allowed (Yuhao Bi)

2015-12-08 Thread ramkrishna
PHOENIX-2073 Two bytes character in LIKE expression is not allowed (Yuhao Bi)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c40d64b3bbc793ec920a8a8032c7a93bd015380a
Parents: 980d29c
Author: Yuhao Bi 
Authored: Thu Jun 25 15:41:06 2015 +0800
Committer: Thomas D'Silva 
Committed: Fri Jun 26 11:04:34 2015 -0700

--
 .../apache/phoenix/compile/WhereOptimizer.java|  3 ++-
 .../phoenix/compile/WhereOptimizerTest.java   | 18 ++
 2 files changed, 20 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c40d64b3/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
index a5aef02..32de712 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
@@ -65,6 +65,7 @@ import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PChar;
 import org.apache.phoenix.schema.types.PDataType;
 import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarchar;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.ScanUtil;
@@ -945,7 +946,7 @@ public class WhereOptimizer {
 KeySlots childSlots = childParts.get(0);
 KeySlot childSlot = childSlots.iterator().next();
 final String startsWith = node.getLiteralPrefix();
-byte[] key = PChar.INSTANCE.toBytes(startsWith, 
node.getChildren().get(0).getSortOrder());
+byte[] key = PVarchar.INSTANCE.toBytes(startsWith, 
node.getChildren().get(0).getSortOrder());
 // If the expression is an equality expression against a fixed 
length column
 // and the key length doesn't match the column length, the 
expression can
 // never be true.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c40d64b3/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
index f40afc3..2d4763f 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
@@ -688,6 +688,24 @@ public class WhereOptimizerTest extends 
BaseConnectionlessQueryTest {
 }
 
 @Test
+public void testLikeExtractAllKeyExpression2() throws SQLException {
+String tenantId = "001";
+String keyPrefix = "中文";
+String query = "select * from atable where organization_id = ? and 
entity_id  LIKE '" + keyPrefix + "%'";
+List binds = Arrays.asList(tenantId);
+StatementContext context = compileStatement(query, binds);
+Scan scan = context.getScan();
+
+assertNull(scan.getFilter());
+byte[] startRow = ByteUtil.concat(
+
PVarchar.INSTANCE.toBytes(tenantId),StringUtil.padChar(PVarchar.INSTANCE.toBytes(keyPrefix),15));
+assertArrayEquals(startRow, scan.getStartRow());
+byte[] stopRow = ByteUtil.concat(
+
PVarchar.INSTANCE.toBytes(tenantId),StringUtil.padChar(ByteUtil.nextKey(PVarchar.INSTANCE.toBytes(keyPrefix)),15));
+assertArrayEquals(stopRow, scan.getStopRow());
+}
+
+@Test
 public void testLikeExtractAllAsEqKeyExpression() throws SQLException {
 String tenantId = "001";
 String keyPrefix = "002";



[33/44] phoenix git commit: LP-1277 Support nulls in CHAR fields in CSV loader

2015-12-08 Thread ramkrishna
LP-1277 Support nulls in CHAR fields in CSV loader


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 89ab41c1c22a3b34c2571fd950c0936440b6f822
Parents: c40d64b
Author: Gabriel Reid 
Authored: Thu Jun 25 21:36:51 2015 +0200
Committer: Gabriel Reid 
Committed: Mon Jun 29 08:35:10 2015 +0200

--
 .../phoenix/end2end/CSVCommonsLoaderIT.java   | 18 +++---
 .../org/apache/phoenix/schema/types/PChar.java|  3 ---
 .../phoenix/util/csv/CsvUpsertExecutor.java   |  5 -
 3 files changed, 15 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/89ab41c1/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
index d07ed8d..c7287ea 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
@@ -46,9 +46,10 @@ import org.junit.Test;
 public class CSVCommonsLoaderIT extends BaseHBaseManagedTimeIT {
 
 private static final String DATATYPE_TABLE = "DATATYPE";
-private static final String DATATYPES_CSV_VALUES = "CKEY, CVARCHAR, 
CINTEGER, CDECIMAL, CUNSIGNED_INT, CBOOLEAN, CBIGINT, CUNSIGNED_LONG, CTIME, 
CDATE\n"
-+ "KEY1,A,2147483647,1.1,0,TRUE,9223372036854775807,0,1990-12-31 
10:59:59,1999-12-31 23:59:59\n"
-+ 
"KEY2,B,-2147483648,-1.1,2147483647,FALSE,-9223372036854775808,9223372036854775807,2000-01-01
 00:00:01,2012-02-29 23:59:59\n";
+private static final String DATATYPES_CSV_VALUES = "CKEY, CVARCHAR, CCHAR, 
CINTEGER, CDECIMAL, CUNSIGNED_INT, CBOOLEAN, CBIGINT, CUNSIGNED_LONG, CTIME, 
CDATE\n"
++ "KEY1,A,A,2147483647,1.1,0,TRUE,9223372036854775807,0,1990-12-31 
10:59:59,1999-12-31 23:59:59\n"
++ 
"KEY2,B,B,-2147483648,-1.1,2147483647,FALSE,-9223372036854775808,9223372036854775807,2000-01-01
 00:00:01,2012-02-29 23:59:59\n"
++ "KEY3,,\n";
 private static final String STOCK_TABLE = "STOCK_SYMBOL";
 private static final String STOCK_TABLE_MULTI = "STOCK_SYMBOL_MULTI";
 private static final String STOCK_CSV_VALUES = "AAPL,APPLE Inc.\n"
@@ -480,7 +481,7 @@ public class CSVCommonsLoaderIT extends 
BaseHBaseManagedTimeIT {
 String statements = "CREATE TABLE IF NOT EXISTS "
 + DATATYPE_TABLE
 + " (CKEY VARCHAR NOT NULL PRIMARY KEY,"
-+ "  CVARCHAR VARCHAR, CINTEGER INTEGER, CDECIMAL 
DECIMAL(31,10), CUNSIGNED_INT UNSIGNED_INT, CBOOLEAN BOOLEAN, CBIGINT BIGINT, 
CUNSIGNED_LONG UNSIGNED_LONG, CTIME TIME, CDATE DATE);";
++ "  CVARCHAR VARCHAR, CCHAR CHAR(10), CINTEGER INTEGER, 
CDECIMAL DECIMAL(31,10), CUNSIGNED_INT UNSIGNED_INT, CBOOLEAN BOOLEAN, CBIGINT 
BIGINT, CUNSIGNED_LONG UNSIGNED_LONG, CTIME TIME, CDATE DATE);";
 conn = DriverManager.getConnection(getUrl())
 .unwrap(PhoenixConnection.class);
 PhoenixRuntime.executeStatements(conn,
@@ -493,7 +494,7 @@ public class CSVCommonsLoaderIT extends 
BaseHBaseManagedTimeIT {
 
 // Compare Phoenix ResultSet with CSV file content
 PreparedStatement statement = conn
-.prepareStatement("SELECT CKEY, CVARCHAR, CINTEGER, 
CDECIMAL, CUNSIGNED_INT, CBOOLEAN, CBIGINT, CUNSIGNED_LONG, CTIME, CDATE FROM "
+.prepareStatement("SELECT CKEY, CVARCHAR, CCHAR, CINTEGER, 
CDECIMAL, CUNSIGNED_INT, CBOOLEAN, CBIGINT, CUNSIGNED_LONG, CTIME, CDATE FROM "
 + DATATYPE_TABLE);
 ResultSet phoenixResultSet = statement.executeQuery();
 parser = new CSVParser(new StringReader(DATATYPES_CSV_VALUES),
@@ -511,9 +512,12 @@ public class CSVCommonsLoaderIT extends 
BaseHBaseManagedTimeIT {
 i++;
 }
 // special case for matching date, time values
-assertEquals(DateUtil.parseTime(record.get(8)),
+String timeFieldValue = record.get(9);
+assertEquals(timeFieldValue.isEmpty() ? null : 
DateUtil.parseTime(record.get(9)),
 phoenixResultSet.getTime("CTIME"));
-assertEquals(DateUtil.parseDate(record.get(9)),
+
+String dateField = record.get(10);
+

[30/44] phoenix git commit: PHOENIX-1935 org.apache.phoenix.end2end.ArithmeticQueryIT tests are failing (Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-1935 org.apache.phoenix.end2end.ArithmeticQueryIT tests are failing 
(Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 05b1b8b13f4137602567f67642946c883646d4d8
Parents: 329d749
Author: Nick Dimiduk 
Authored: Wed Jun 17 12:28:35 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed Jun 17 12:31:28 2015 -0700

--
 .../src/it/java/org/apache/phoenix/end2end/BaseViewIT.java  | 2 ++
 phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java | 3 +++
 .../src/test/java/org/apache/phoenix/query/BaseTest.java| 5 -
 3 files changed, 9 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/05b1b8b1/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
index b9d7180..3140077 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
@@ -98,6 +98,7 @@ public abstract class BaseViewIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 assertEquals(1, rs.getInt(1));
 assertEquals(121, rs.getInt(2));
 assertFalse(rs.next());
+conn.close();
 }
 
 protected void testUpdatableViewIndex(Integer saltBuckets) throws 
Exception {
@@ -179,6 +180,7 @@ public abstract class BaseViewIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 + "CLIENT MERGE SORT",
 QueryUtil.getExplainPlan(rs));
 }
+conn.close();
 }
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/05b1b8b1/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 266438d..fb58a8f 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
@@ -92,8 +92,11 @@ public class ViewIT extends BaseViewIT {
 fail();
 } catch (ReadOnlyTableException e) {
 
+} finally {
+conn.close();
 }
 
+conn = DriverManager.getConnection(getUrl());
 int count = 0;
 ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM v2");
 while (rs.next()) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/05b1b8b1/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index fa78656..3f09518 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -115,6 +115,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.IntegrationTestingUtility;
+import org.apache.hadoop.hbase.TableNotEnabledException;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
@@ -1634,7 +1635,9 @@ public abstract class BaseTest {
 for (HTableDescriptor table : tables) {
 String schemaName = 
SchemaUtil.getSchemaNameFromFullName(table.getName());
 if (!QueryConstants.SYSTEM_SCHEMA_NAME.equals(schemaName)) {
-admin.disableTable(table.getName());
+try{
+admin.disableTable(table.getName());
+} catch (TableNotEnabledException ignored){}
 admin.deleteTable(table.getName());
 }
 }



[40/44] phoenix git commit: PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data types

2015-12-08 Thread ramkrishna
PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data 
types


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6a96bd2f130cc05a04360a2311a77f2d08f73420
Parents: 76a4786
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon May 18 19:48:30 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:55 2015 +0530

--
 .../src/main/java/org/apache/phoenix/pig/util/TypeUtil.java  | 8 +++-
 .../test/java/org/apache/phoenix/pig/util/TypeUtilTest.java  | 8 +++-
 2 files changed, 6 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a96bd2f/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index c8bc9d8..6e32fb5 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -1,17 +1,15 @@
 /*
- * Copyright 2010 The Apache Software Foundation
- *
  * 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
+ * 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 maynot use this file except in compliance
+ * "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 applicablelaw or agreed to in writing, software
+ * 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

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a96bd2f/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
--
diff --git 
a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java 
b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
index 56167f6..0b44d2b 100644
--- a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
+++ b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
@@ -1,17 +1,15 @@
 /*
- * Copyright 2010 The Apache Software Foundation
- *
  * 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
+ * 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 maynot use this file except in compliance
+ * "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 applicablelaw or agreed to in writing, software
+ * 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



[28/44] phoenix git commit: PHOENIX-2029 Queries are making two rpc calls for getTable

2015-12-08 Thread ramkrishna
PHOENIX-2029 Queries are making two rpc calls for getTable


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 52f5b04643914f33c2d00a1157ca767a32f1adb8
Parents: 43c722c
Author: Thomas D'Silva 
Authored: Mon Jun 8 15:30:40 2015 -0700
Committer: Thomas D'Silva 
Committed: Wed Jun 17 11:16:48 2015 -0700

--
 .../org/apache/phoenix/rpc/UpdateCacheIT.java   | 139 +++
 .../apache/phoenix/compile/QueryCompiler.java   |   2 +-
 .../coprocessor/MetaDataEndpointImpl.java   |   6 +-
 .../apache/phoenix/schema/MetaDataClient.java   |  26 ++--
 4 files changed, 156 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/52f5b046/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
new file mode 100644
index 000..c657e41
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
@@ -0,0 +1,139 @@
+package org.apache.phoenix.rpc;
+
+import static org.apache.phoenix.util.TestUtil.INDEX_DATA_SCHEMA;
+import static org.apache.phoenix.util.TestUtil.MUTABLE_INDEX_DATA_TABLE;
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT;
+import org.apache.phoenix.end2end.Shadower;
+import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.schema.MetaDataClient;
+import org.apache.phoenix.schema.PName;
+import org.apache.phoenix.schema.types.PVarchar;
+import org.apache.phoenix.util.DateUtil;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Verifies the number of rpcs calls from {@link MetaDataClient} updateCache() 
+ * for transactional and non-transactional tables.
+ */
+public class UpdateCacheIT extends BaseHBaseManagedTimeIT {
+   
+   public static final int NUM_MILLIS_IN_DAY = 8640;
+
+@Before
+public void setUp() throws SQLException {
+ensureTableCreated(getUrl(), MUTABLE_INDEX_DATA_TABLE);
+}
+
+   @BeforeClass
+@Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
+public static void doSetup() throws Exception {
+Map props = Maps.newHashMapWithExpectedSize(3);
+setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+}
+   
+   public static void validateRowKeyColumns(ResultSet rs, int i) throws 
SQLException {
+   assertTrue(rs.next());
+   assertEquals(rs.getString(1), "varchar" + String.valueOf(i));
+   assertEquals(rs.getString(2), "char" + String.valueOf(i));
+   assertEquals(rs.getInt(3), i);
+   assertEquals(rs.getInt(4), i);
+   assertEquals(rs.getBigDecimal(5), new BigDecimal(i*0.5d));
+   Date date = new Date(DateUtil.parseDate("2015-01-01 
00:00:00").getTime() + (i - 1) * NUM_MILLIS_IN_DAY);
+   assertEquals(rs.getDate(6), date);
+   }
+   
+   public static void setRowKeyColumns(PreparedStatement stmt, int i) 
throws SQLException {
+// insert row
+stmt.setString(1, "varchar" + String.valueOf(i));
+stmt.setString(2, "char" + String.valueOf(i));
+stmt.setInt(3, i);
+stmt.setLong(4, i);
+stmt.setBigDecimal(5, new BigDecimal(i*0.5d));
+Date date = new Date(DateUtil.parseDate("2015-01-01 
00:00:00").getTime() + (i - 1) * NUM_MILLIS_IN_DAY);
+stmt.setDate(6, date);
+}
+   
+   

[37/44] phoenix git commit: PHOENIX-2042 Windows need hadoop native libraries to run tests (Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-2042 Windows need hadoop native libraries to run tests (Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 63f8a6a2e64e9c1f106e3e29011dffc4231fd649
Parents: 9db70f5
Author: Enis Soztutar 
Authored: Mon Jun 29 18:16:35 2015 -0700
Committer: Enis Soztutar 
Committed: Mon Jun 29 18:57:18 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/63f8a6a2/pom.xml
--
diff --git a/pom.xml b/pom.xml
index be44399..f81f818 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,7 +266,7 @@
  UTF-8
  ${numForkedIT}
  true
- -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom
+ -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
  
${test.output.tofile}
  
${basedir}/src/it/java
  
org.apache.phoenix.end2end.ClientManagedTimeTest
@@ -282,7 +282,7 @@
  UTF-8
  ${numForkedIT}
  true
- -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom
+ -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
  
${test.output.tofile}
  
${basedir}/src/it/java
  
org.apache.phoenix.end2end.HBaseManagedTimeTest
@@ -298,7 +298,7 @@
  UTF-8
  ${numForkedIT}
  true
- -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom
+ -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
  
${test.output.tofile}
  
${basedir}/src/it/java
  
org.apache.phoenix.end2end.NeedsOwnMiniClusterTest
@@ -395,7 +395,7 @@
   ${numForkedUT}
   true
   -enableassertions -Xmx2250m -XX:MaxPermSize=128m 
--Djava.security.egd=file:/dev/./urandom
+-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
   
${test.output.tofile}
 
   



[12/44] phoenix git commit: PHOENIX-1939 Test are failing with DoNotRetryIOException: ATABLE: null (Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-1939 Test are failing with DoNotRetryIOException: ATABLE: null (Alicia 
Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: a600cc4d7acc2c828ae7782e59d094f99e5631f0
Parents: c95e28d
Author: Nick Dimiduk 
Authored: Fri May 29 17:12:25 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri May 29 17:13:08 2015 -0700

--
 .../src/main/java/org/apache/phoenix/schema/PTableImpl.java  | 4 ++--
 .../src/test/java/org/apache/phoenix/query/BaseTest.java | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a600cc4d/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index bf4420c..bdc95b8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -88,8 +88,8 @@ public class PTableImpl implements PTable {
 
 private PTableKey key;
 private PName name;
-private PName schemaName;
-private PName tableName;
+private PName schemaName = PName.EMPTY_NAME;
+private PName tableName = PName.EMPTY_NAME;
 private PName tenantId;
 private PTableType type;
 private PIndexState state;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a600cc4d/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 54ae670..b0574c3 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -121,7 +121,6 @@ import 
org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
 import org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory;
 import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
 import org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory;
-import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.regionserver.LocalIndexMerger;
 import org.apache.hadoop.hbase.regionserver.RSRpcServices;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -829,6 +828,7 @@ public abstract class BaseTest {
 logger.info("Table " + fullTableName + " is already 
deleted.");
 }
 }
+rs.close();
 if (lastTenantId != null) {
 conn.close();
 }
@@ -860,6 +860,7 @@ public abstract class BaseTest {
 logger.info("DROP SEQUENCE STATEMENT: DROP SEQUENCE " + 
SchemaUtil.getEscapedTableName(rs.getString(2), rs.getString(3)));
 conn.createStatement().execute("DROP SEQUENCE " + 
SchemaUtil.getEscapedTableName(rs.getString(2), rs.getString(3)));
 }
+rs.close();
 }
 
 protected static void initSumDoubleValues(byte[][] splits, String url) 
throws Exception {



[25/44] phoenix git commit: PHOENIX-2033 PQS log environment details on launch

2015-12-08 Thread ramkrishna
PHOENIX-2033 PQS log environment details on launch


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e64f61ba431b8db938bf60992bbde56f4c540946
Parents: f7d7349
Author: Nick Dimiduk 
Authored: Tue Jun 9 17:12:21 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri Jun 12 09:38:42 2015 -0700

--
 .../apache/phoenix/queryserver/server/Main.java | 69 
 1 file changed, 69 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e64f61ba/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
--
diff --git 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
index 55febc5..9f9bfc7 100644
--- 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
+++ 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
@@ -34,7 +34,12 @@ import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
 
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
 import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -50,6 +55,11 @@ public final class Main extends Configured implements Tool, 
Runnable {
   "phoenix.queryserver.http.port";
   public static final int DEFAULT_HTTP_PORT = 8765;
 
+  public static final String QUERY_SERVER_ENV_LOGGING_KEY =
+  "phoenix.queryserver.envvars.logging.disabled";
+  public static final String QUERY_SERVER_ENV_LOGGING_SKIPWORDS_KEY =
+  "phoenix.queryserver.envvars.logging.skipwords";
+
   public static final String KEYTAB_FILENAME_KEY = 
"phoenix.queryserver.keytab.file";
   public static final String KERBEROS_PRINCIPAL_KEY = 
"phoenix.queryserver.kerberos.principal";
   public static final String DNS_NAMESERVER_KEY = 
"phoenix.queryserver.dns.nameserver";
@@ -58,12 +68,70 @@ public final class Main extends Configured implements Tool, 
Runnable {
 
   protected static final Log LOG = LogFactory.getLog(Main.class);
 
+  @SuppressWarnings("serial")
+  private static final Set DEFAULT_SKIP_WORDS = new HashSet() {
+{
+  add("secret");
+  add("passwd");
+  add("password");
+  add("credential");
+}
+  };
+
   private final String[] argv;
   private final CountDownLatch runningLatch = new CountDownLatch(1);
   private HttpServer server = null;
   private int retCode = 0;
   private Throwable t = null;
 
+  /**
+   * Log information about the currently running JVM.
+   */
+  public static void logJVMInfo() {
+// Print out vm stats before starting up.
+RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+if (runtime != null) {
+  LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
+  runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
+  LOG.info("vmInputArguments=" + runtime.getInputArguments());
+}
+  }
+
+  /**
+   * Logs information about the currently running JVM process including
+   * the environment variables. Logging of env vars can be disabled by
+   * setting {@code "phoenix.envvars.logging.disabled"} to {@code "true"}.
+   * If enabled, you can also exclude environment variables containing
+   * certain substrings by setting {@code "phoenix.envvars.logging.skipwords"}
+   * to comma separated list of such substrings.
+   */
+  public static void logProcessInfo(Configuration conf) {
+// log environment variables unless asked not to
+if (conf == null || !conf.getBoolean(QUERY_SERVER_ENV_LOGGING_KEY, false)) 
{
+  Set skipWords = new HashSet(DEFAULT_SKIP_WORDS);
+  if (conf != null) {
+String[] confSkipWords = 
conf.getStrings(QUERY_SERVER_ENV_LOGGING_SKIPWORDS_KEY);
+if (confSkipWords != null) {
+  skipWords.addAll(Arrays.asList(confSkipWords));
+}
+  }
+
+  nextEnv:
+  for (Map.Entry entry : System.getenv().entrySet()) {
+String key = entry.getKey().toLowerCase();
+String value = entry.getValue().toLowerCase();
+// exclude variables which may contain skip words
+for(String skipWord : skipWords) {
+  if (key.contains(skipWord) || value.contains(skipWord))
+continue nextEnv;
+}
+LOG.info("env:"+entry);
+  }
+  

[17/44] phoenix git commit: PHOENIX-1976 Exit gracefully if addShutdownHook fails.

2015-12-08 Thread ramkrishna
PHOENIX-1976 Exit gracefully if addShutdownHook fails.

If the JVM is already in the process of shutting down,
we don't need to add the shutdown hook for the PhoenixDriver
instance. Additionally, we shouldn't advertise this instance
either since we're going down.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: f2be9138359b078fd3e285f3fd441de711789962
Parents: dc46b14
Author: Josh Elser 
Authored: Thu May 14 17:40:46 2015 -0400
Committer: Nick Dimiduk 
Committed: Mon Jun 1 12:02:28 2015 -0700

--
 .../org/apache/phoenix/jdbc/PhoenixDriver.java  | 46 ++--
 1 file changed, 32 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2be9138/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
index 6360d06..cfabe82 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
@@ -60,25 +60,43 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
 private static volatile String driverShutdownMsg;
 static {
 try {
-DriverManager.registerDriver( INSTANCE = new PhoenixDriver() );
-// Add shutdown hook to release any resources that were never 
closed
-// In theory not necessary, but it won't hurt anything
-Runtime.getRuntime().addShutdownHook(new Thread() {
-@Override
-public void run() {
-try {
-INSTANCE.close();
-} catch (SQLException e) {
-logger.warn("Unable to close PhoenixDriver on 
shutdown", e);
-} finally {
-driverShutdownMsg = "Phoenix driver closed because 
server is shutting down";
+INSTANCE = new PhoenixDriver();
+try {
+// Add shutdown hook to release any resources that were never 
closed
+// In theory not necessary, but it won't hurt anything
+Runtime.getRuntime().addShutdownHook(new Thread() {
+@Override
+public void run() {
+closeInstance(INSTANCE);
 }
-}
-});
+});
+
+// Only register the driver when we successfully register the 
shutdown hook
+// Don't want to register it if we're already in the process 
of going down.
+DriverManager.registerDriver( INSTANCE );
+} catch (IllegalStateException e) {
+logger.warn("Failed to register PhoenixDriver shutdown hook as 
the JVM is already shutting down");
+
+// Close the instance now because we don't have the shutdown 
hook
+closeInstance(INSTANCE);
+
+throw e;
+}
 } catch (SQLException e) {
 throw new IllegalStateException("Unable to register " + 
PhoenixDriver.class.getName() + ": "+ e.getMessage());
 }
 }
+
+private static void closeInstance(PhoenixDriver instance) {
+try {
+instance.close();
+} catch (SQLException e) {
+logger.warn("Unable to close PhoenixDriver on shutdown", e);
+} finally {
+driverShutdownMsg = "Phoenix driver closed because server is 
shutting down";
+}
+}
+
 // One entry per cluster here
 private final ConcurrentMap 
connectionQueryServicesMap = new 
ConcurrentHashMap(3);
 



[21/44] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)

2015-12-08 Thread ramkrishna
PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 58ee7062c624dd72a5cdaa41ec5b107a1e7b14c2
Parents: 6f890ad
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jun 2 14:32:02 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 2 14:36:05 2015 +0530

--
 .../main/java/org/apache/phoenix/schema/types/PTimestamp.java   | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/58ee7062/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
index d396adc..16b110e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.DateUtil;
 
 public class PTimestamp extends PDataType {
@@ -47,6 +48,10 @@ public class PTimestamp extends PDataType {
   @Override
   public int toBytes(Object object, byte[] bytes, int offset) {
 if (object == null) {
+  // Create the byte[] of size MAX_TIMESTAMP_BYTES
+  if(bytes.length != getByteSize()) {
+  bytes = Bytes.padTail(bytes, (getByteSize() - bytes.length));
+  }
   PDate.INSTANCE.getCodec().encodeLong(0l, bytes, offset);
   Bytes.putInt(bytes, offset + Bytes.SIZEOF_LONG, 0);
   return getByteSize();



[05/44] phoenix git commit: PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because HBASE-13756(Rajeshbabu)

2015-12-08 Thread ramkrishna
PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because 
HBASE-13756(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 56e1c0a1f348572fb73e9d0b8bbfb053df7f8710
Parents: ea622d5
Author: Rajeshbabu Chintaguntla 
Authored: Sat May 23 23:29:31 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Sat May 23 23:29:31 2015 +0530

--
 phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/56e1c0a1/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 54ae670..4aa28c4 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -620,6 +620,8 @@ public abstract class BaseTest {
 }
 //no point doing sanity checks when running tests.
 conf.setBoolean("hbase.table.sanity.checks", false);
+// Remove this configuration once hbase has HBASE-13756 fix.
+conf.set("hbase.regionserver.msginterval", "30");
 // set the server rpc controller and rpc scheduler factory, used to 
configure the cluster
 conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY, 
DEFAULT_SERVER_RPC_CONTROLLER_FACTORY);
 conf.set(RSRpcServices.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS, 
DEFAULT_RPC_SCHEDULER_FACTORY);



[34/44] phoenix git commit: PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column

2015-12-08 Thread ramkrishna
PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 4c705228d278721c12f1d7369c990d1de12f9d13
Parents: 89ab41c
Author: Josh Mahonin 
Authored: Thu Jun 25 15:52:37 2015 -0400
Committer: Josh Mahonin 
Committed: Mon Jun 29 12:30:56 2015 -0400

--
 .../end2end/QueryDatabaseMetaDataIT.java| 31 
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  1 +
 2 files changed, 32 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c705228/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
index 61459a5..2fdccf6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
@@ -1118,4 +1118,35 @@ public class QueryDatabaseMetaDataIT extends 
BaseClientManagedTimeIT {
 assertFalse(rs.next());
 }
 
+@Test
+public void testRemarkColumn() throws SQLException {
+long ts = nextTimestamp();
+Properties props = new Properties();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 5));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+
+// Retrieve the database metadata
+DatabaseMetaData dbmd = conn.getMetaData();
+ResultSet rs = dbmd.getColumns(null, null, null, null);
+rs.next();
+
+// Lookup column by name, this should return null but not throw an 
exception
+String remarks = rs.getString("REMARKS");
+assertNull(remarks);
+
+// Same as above, but lookup by position
+remarks = rs.getString(12);
+assertNull(remarks);
+
+// Iterate through metadata columns to find 'COLUMN_NAME' == 'REMARKS'
+boolean foundRemarksColumn = false;
+while(rs.next()) {
+String colName = rs.getString("COLUMN_NAME");
+if(PhoenixDatabaseMetaData.REMARKS.equals(colName)) {
+foundRemarksColumn = true;
+break;
+}
+}
+assertTrue("Could not find REMARKS column", foundRemarksColumn);
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c705228/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 3a0b03b..a862875 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -437,6 +437,7 @@ public class PhoenixDatabaseMetaData implements 
DatabaseMetaData, org.apache.pho
 DECIMAL_DIGITS + "," +
 NUM_PREC_RADIX + "," +
 NULLABLE + "," +
+REMARKS + "," +
 COLUMN_DEF + "," +
 SQL_DATA_TYPE + "," +
 SQL_DATETIME_SUB + "," +



[29/44] phoenix git commit: PHOENIX-1941 Phoenix tests are failing in linux env with missing class: StaticMapping (Alicia Ying Shu)

2015-12-08 Thread ramkrishna
PHOENIX-1941 Phoenix tests are failing in linux env with missing class: 
StaticMapping (Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 329d74948521ed974593e455369a27d9cd705249
Parents: 52f5b04
Author: Nick Dimiduk 
Authored: Wed Jun 17 12:17:33 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed Jun 17 12:23:47 2015 -0700

--
 .../phoenix/end2end/End2EndTestDriver.java   | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/329d7494/phoenix-core/src/it/java/org/apache/phoenix/end2end/End2EndTestDriver.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/End2EndTestDriver.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/End2EndTestDriver.java
index 26d18cf..743f729 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/End2EndTestDriver.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/End2EndTestDriver.java
@@ -21,6 +21,7 @@ package org.apache.phoenix.end2end;
 
 import java.io.IOException;
 import java.io.PrintStream;
+import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -79,10 +80,20 @@ public class End2EndTestDriver extends AbstractHBaseTool {
 
   @Override
   public boolean isCandidateClass(Class c) {
-return testFilterRe.matcher(c.getName()).find() &&
-  // Our pattern will match the below NON-IntegrationTest. Rather than
-  // do exotic regex, just filter it out here
-  super.isCandidateClass(c);
+  Annotation[] annotations = c.getAnnotations();
+  for (Annotation curAnnotation : annotations) {
+  if 
(curAnnotation.toString().contains("NeedsOwnMiniClusterTest")) {
+  /* Skip tests that aren't designed to run against a live 
cluster.
+   * For a live cluster, we cannot bring it up and down as 
required
+   * for these tests to run.
+   */
+  return false;
+  }
+  }
+  return testFilterRe.matcher(c.getName()).find() &&
+  // Our pattern will match the below NON-IntegrationTest. 
Rather than
+  // do exotic regex, just filter it out here
+  super.isCandidateClass(c);
   }
 }
 



[44/44] phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: a9e1997ede1f2c031cc48338c314cdaf67aa5ae5
Parents: 6511d70
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:48:05 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9e1997e/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 4b79142..1978dba 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9e1997e/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index c7cc1c1..206a8db 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -93,12 +93,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9e1997e/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
@@ -59,12 +59,12 @@ public class PVarchar extends PDataType {
   @Override
   publi

phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-1.0 52a7741e6 -> 7eeaf9eb2


PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/4.5-HBase-1.0
Commit: 7eeaf9eb205cb9caca90e90c78a2ed94603fe0fa
Parents: 52a7741
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:55:10 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7eeaf9eb/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index b7a2ad2..80396a6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7eeaf9eb/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 6b26197..4170253 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -104,12 +104,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7eeaf9eb/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/P

[24/44] phoenix git commit: PHOENIX-1968: Should support saving arrays

2015-12-08 Thread ramkrishna
PHOENIX-1968: Should support saving arrays


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

Branch: refs/heads/4.x-HBase-1.1
Commit: f7d734966f7172c3bc4a6f0ba31594ba74ee91a1
Parents: bfd860f
Author: ravimagham 
Authored: Thu Jun 11 12:59:48 2015 -0700
Committer: ravimagham 
Committed: Thu Jun 11 12:59:48 2015 -0700

--
 .../apache/phoenix/spark/PhoenixSparkIT.scala   | 21 
 .../phoenix/spark/PhoenixRecordWritable.scala   | 25 
 2 files changed, 41 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f7d73496/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
--
diff --git 
a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala 
b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
index 42e8676..5f256e6 100644
--- a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
+++ b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
@@ -415,4 +415,25 @@ class PhoenixSparkIT extends FunSuite with Matchers with 
BeforeAndAfterAll {
 
 results.toList shouldEqual checkResults
   }
+
+  test("Can save arrays back to phoenix") {
+val dataSet = List((2L, Array("String1", "String2", "String3")))
+
+sc
+  .parallelize(dataSet)
+  .saveToPhoenix(
+"ARRAY_TEST_TABLE",
+Seq("ID","VCARRAY"),
+zkUrl = Some(quorumAddress)
+  )
+
+// Load the results back
+val stmt = conn.createStatement()
+val rs = stmt.executeQuery("SELECT VCARRAY FROM ARRAY_TEST_TABLE WHERE ID 
= 2")
+rs.next()
+val sqlArray = rs.getArray(1).getArray().asInstanceOf[Array[String]]
+
+// Verify the arrays are equal
+sqlArray shouldEqual dataSet(0)._2
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f7d73496/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
--
diff --git 
a/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
 
b/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
index 67e0bd2..3977657 100644
--- 
a/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
+++ 
b/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
@@ -16,11 +16,12 @@ package org.apache.phoenix.spark
 import java.sql.{PreparedStatement, ResultSet}
 import org.apache.hadoop.mapreduce.lib.db.DBWritable
 import org.apache.phoenix.mapreduce.util.ColumnInfoToStringEncoderDecoder
-import org.apache.phoenix.schema.types.{PDate, PhoenixArray}
+import org.apache.phoenix.schema.types.{PDataType, PDate, PhoenixArray}
 import org.joda.time.DateTime
 import scala.collection.{immutable, mutable}
 import scala.collection.JavaConversions._
 
+
 class PhoenixRecordWritable(var encodedColumns: String) extends DBWritable {
   val upsertValues = mutable.ArrayBuffer[Any]()
   val resultMap = mutable.Map[String, AnyRef]()
@@ -44,13 +45,27 @@ class PhoenixRecordWritable(var encodedColumns: String) 
extends DBWritable {
 upsertValues.zip(columns).zipWithIndex.foreach {
   case ((v, c), i) => {
 if (v != null) {
+
   // Both Java and Joda dates used to work in 4.2.3, but now they must 
be java.sql.Date
+  // Can override any other types here as needed
   val (finalObj, finalType) = v match {
-case dt: DateTime => (new java.sql.Date(dt.getMillis), 
PDate.INSTANCE.getSqlType)
-case d: java.util.Date => (new java.sql.Date(d.getTime), 
PDate.INSTANCE.getSqlType)
-case _ => (v, c.getSqlType)
+case dt: DateTime => (new java.sql.Date(dt.getMillis), 
PDate.INSTANCE)
+case d: java.util.Date => (new java.sql.Date(d.getTime), 
PDate.INSTANCE)
+case _ => (v, c.getPDataType)
+  }
+
+  // Save as array or object
+  finalObj match {
+case obj: Array[AnyRef] => {
+  // Create a java.sql.Array, need to lookup the base sql type name
+  val sqlArray = statement.getConnection.createArrayOf(
+PDataType.arrayBaseType(finalType).getSqlTypeName,
+obj
+  )
+  statement.setArray(i + 1, sqlArray)
+}
+case _ => statement.setObject(i + 1, finalObj)
   }
-  statement.setObject(i + 1, finalObj, finalType)
 } 

[43/44] phoenix git commit: PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)

2015-12-08 Thread ramkrishna
PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6511d70650fb20f71e1a965f417e011869a14eb0
Parents: 7b448cc
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Aug 31 14:36:48 2015 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6511d706/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 1c1c7df..242ca0f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -27,11 +27,11 @@ import org.apache.phoenix.schema.types.PBinaryArray;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarbinaryArray;
 import org.apache.phoenix.schema.tuple.Tuple;
 
 @BuiltInFunction(name = ArrayLengthFunction.NAME, args = { 
@Argument(allowedTypes = {
-   PBinaryArray.class, PVarbinary.class }) })
+   PBinaryArray.class, PVarbinaryArray.class }) })
 public class ArrayLengthFunction extends ScalarFunction {
public static final String NAME = "ARRAY_LENGTH";
 



phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 5dfd24030 -> da165b359


PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: da165b3592794cffb1fac6a26c89a95532be2e9a
Parents: 5dfd240
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:50:54 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/da165b35/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 7400127..846507b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/da165b35/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 6b26197..4170253 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -104,12 +104,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/da165b35/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/P

phoenix git commit: PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt (Ram)

2015-12-08 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 b9eb08c32 -> 22df7e7b2


PHOENIX-1949 NPE while inserting NULL in a VARCHAR array using UPSERT stmt
(Ram)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 22df7e7b2a309af3cb4b2a842956ae7a30ace377
Parents: b9eb08c
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Dec 9 09:43:01 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Dec 9 09:51:33 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 27 
 .../org/apache/phoenix/schema/types/PChar.java  |  6 ++---
 .../apache/phoenix/schema/types/PVarchar.java   |  6 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/22df7e7b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 7400127..846507b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -870,6 +870,33 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 }
 
 @Test
+public void testArrayWithVarCharArray() throws Exception {
+Connection conn;
+PreparedStatement stmt;
+ResultSet rs;
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+conn = DriverManager.getConnection(getUrl(), props);
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a VARCHAR ARRAY[])");
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+stmt = conn.prepareStatement("UPSERT INTO t 
VALUES('a',ARRAY['a',null])");
+int res = stmt.executeUpdate();
+assertEquals(1, res);
+conn.commit();
+conn.close();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+rs = conn.createStatement().executeQuery("SELECT ARRAY_ELEM(a,2) FROM 
t");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+conn.close();
+}
+
+@Test
 public void testArraySelectSingleArrayElemWithCast() throws Exception {
 Connection conn;
 PreparedStatement stmt;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/22df7e7b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 6b26197..4170253 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -104,12 +104,12 @@ public class PChar extends PDataType {
 
 @Override
 public Object toObject(byte[] bytes, int offset, int length, PDataType 
actualType, SortOrder sortOrder, Integer maxLength, Integer scale) {
-  if (!actualType.isCoercibleTo(this)) { // TODO: have isCoercibleTo that 
takes bytes, offset?
-throwConstraintViolationException(actualType,this);
-  }
   if (length == 0) {
 return null;
   }
+  if (!actualType.isCoercibleTo(this)) {
+throwConstraintViolationException(actualType, this);
+  }
   length = StringUtil.getUnpaddedCharLength(bytes, offset, length, 
sortOrder);
   if (sortOrder == SortOrder.DESC) {
 bytes = SortOrder.invert(bytes, offset, length);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/22df7e7b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
index fa3dbad..2575115 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PVarchar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/P

phoenix git commit: PHOENIX-2160 Projection of specific array index does not work (Dumindu Buddhika)

2015-09-03 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 92d01e116 -> 4fa725937


PHOENIX-2160 Projection of specific array index does not work (Dumindu
Buddhika)


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 4fa72593727e80790d85a12125382cafd62b85a3
Parents: 92d01e1
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Fri Sep 4 11:11:55 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Fri Sep 4 11:11:55 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 441 +++
 .../phoenix/compile/ProjectionCompiler.java | 130 --
 .../apache/phoenix/compile/RowProjector.java|   4 +-
 .../coprocessor/BaseScannerRegionObserver.java  |  15 +-
 .../expression/ProjectedColumnExpression.java   |   7 +-
 .../visitor/CloneExpressionVisitor.java |  47 +-
 .../CloneNonDeterministicExpressionVisitor.java |  30 ++
 .../ProjectedColumnExpressionVisitor.java   |  25 ++
 .../ReplaceArrayFunctionExpressionVisitor.java  |  46 ++
 .../apache/phoenix/iterate/ExplainTable.java|   3 +
 .../phoenix/compile/QueryCompilerTest.java  |  77 
 .../expression/ArithmeticOperationTest.java |   8 +-
 12 files changed, 761 insertions(+), 72 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4fa72593/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 800a7b4..b7a2ad2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -2238,4 +2238,445 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 rs = stmt.executeQuery();
 assertTrue(rs.next());
 }
+
+@Test
+public void testServerArrayElementProjection1() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1] FROM a");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(conn.createArrayOf("INTEGER", new Integer[]{1, 2}), 
rs.getArray(1));
+assertEquals(1, rs.getInt(2));
+assertEquals("a", rs.getString(3));
+}
+
+@Test
+public void testServerArrayElementProjection2() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], arr3[1] 
from a");
+rs = stmt.executeQuery();
+  

phoenix git commit: PHOENIX-2160 Projection of specific array index does not work (Dumindu Buddhika)

2015-09-03 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-1.0 4d809a2d2 -> 7d5e3640d


PHOENIX-2160 Projection of specific array index does not work (Dumindu
Buddhika)


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

Branch: refs/heads/4.5-HBase-1.0
Commit: 7d5e3640d712fb870ee32e18c8b5e9bcb5beabb4
Parents: 4d809a2
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Fri Sep 4 11:16:27 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Fri Sep 4 11:16:27 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 441 +++
 .../phoenix/compile/ProjectionCompiler.java | 130 --
 .../apache/phoenix/compile/RowProjector.java|   4 +-
 .../coprocessor/BaseScannerRegionObserver.java  |  15 +-
 .../expression/ProjectedColumnExpression.java   |   7 +-
 .../visitor/CloneExpressionVisitor.java |  47 +-
 .../CloneNonDeterministicExpressionVisitor.java |  30 ++
 .../ProjectedColumnExpressionVisitor.java   |  25 ++
 .../ReplaceArrayFunctionExpressionVisitor.java  |  46 ++
 .../apache/phoenix/iterate/ExplainTable.java|   3 +
 .../phoenix/compile/QueryCompilerTest.java  |  77 
 .../expression/ArithmeticOperationTest.java |   8 +-
 12 files changed, 761 insertions(+), 72 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d5e3640/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 800a7b4..b7a2ad2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -2238,4 +2238,445 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 rs = stmt.executeQuery();
 assertTrue(rs.next());
 }
+
+@Test
+public void testServerArrayElementProjection1() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1] FROM a");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(conn.createArrayOf("INTEGER", new Integer[]{1, 2}), 
rs.getArray(1));
+assertEquals(1, rs.getInt(2));
+assertEquals("a", rs.getString(3));
+}
+
+@Test
+public void testServerArrayElementProjection2() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], arr3[1] 
from a");
+rs = stmt.executeQuery();
+  

phoenix git commit: PHOENIX-2160 Projection of specific array index does not work (Dumindu Buddhika)

2015-09-03 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 c261ea3ac -> 9ab693258


PHOENIX-2160 Projection of specific array index does not work (Dumindu
Buddhika)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 9ab69325830792efcba314ee4256505d5a7f46d9
Parents: c261ea3
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Fri Sep 4 10:50:13 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Fri Sep 4 10:50:13 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 441 +++
 .../phoenix/compile/ProjectionCompiler.java | 130 --
 .../apache/phoenix/compile/RowProjector.java|   4 +-
 .../coprocessor/BaseScannerRegionObserver.java  |  15 +-
 .../expression/ProjectedColumnExpression.java   |   7 +-
 .../visitor/CloneExpressionVisitor.java |  47 +-
 .../CloneNonDeterministicExpressionVisitor.java |  30 ++
 .../ProjectedColumnExpressionVisitor.java   |  25 ++
 .../ReplaceArrayFunctionExpressionVisitor.java  |  46 ++
 .../apache/phoenix/iterate/ExplainTable.java|   3 +
 .../phoenix/compile/QueryCompilerTest.java  |  77 
 .../expression/ArithmeticOperationTest.java |   8 +-
 12 files changed, 761 insertions(+), 72 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ab69325/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 800a7b4..b7a2ad2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -2238,4 +2238,445 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 rs = stmt.executeQuery();
 assertTrue(rs.next());
 }
+
+@Test
+public void testServerArrayElementProjection1() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1] FROM a");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(conn.createArrayOf("INTEGER", new Integer[]{1, 2}), 
rs.getArray(1));
+assertEquals(1, rs.getInt(2));
+assertEquals("a", rs.getString(3));
+}
+
+@Test
+public void testServerArrayElementProjection2() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], arr3[1] 
from a");
+rs = stmt.executeQuery();
+  

phoenix git commit: PHOENIX-2160 Projection of specific array index does not work (Dumindu Buddhika)

2015-09-03 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-0.98 1aa04df62 -> b4a1ba82c


PHOENIX-2160 Projection of specific array index does not work (Dumindu
Buddhika)


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

Branch: refs/heads/4.5-HBase-0.98
Commit: b4a1ba82ce432074c261a8bd50f30b9bad4945c7
Parents: 1aa04df
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Fri Sep 4 11:19:30 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Fri Sep 4 11:19:30 2015 +0530

--
 .../org/apache/phoenix/end2end/ArrayIT.java | 441 +++
 .../phoenix/compile/ProjectionCompiler.java | 130 --
 .../apache/phoenix/compile/RowProjector.java|   4 +-
 .../coprocessor/BaseScannerRegionObserver.java  |  15 +-
 .../expression/ProjectedColumnExpression.java   |   7 +-
 .../visitor/CloneExpressionVisitor.java |  47 +-
 .../CloneNonDeterministicExpressionVisitor.java |  30 ++
 .../ProjectedColumnExpressionVisitor.java   |  25 ++
 .../ReplaceArrayFunctionExpressionVisitor.java  |  46 ++
 .../apache/phoenix/iterate/ExplainTable.java|   3 +
 .../phoenix/compile/QueryCompilerTest.java  |  77 
 .../expression/ArithmeticOperationTest.java |   8 +-
 12 files changed, 761 insertions(+), 72 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b4a1ba82/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 800a7b4..b7a2ad2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -2238,4 +2238,445 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 rs = stmt.executeQuery();
 assertTrue(rs.next());
 }
+
+@Test
+public void testServerArrayElementProjection1() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1] FROM a");
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(conn.createArrayOf("INTEGER", new Integer[]{1, 2}), 
rs.getArray(1));
+assertEquals(1, rs.getInt(2));
+assertEquals("a", rs.getString(3));
+}
+
+@Test
+public void testServerArrayElementProjection2() throws SQLException {
+long ts = nextTimestamp();
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+String ddl = "CREATE TABLE a (p INTEGER PRIMARY KEY, arr1 INTEGER 
ARRAY, arr2 VARCHAR ARRAY, arr3 INTEGER ARRAY)";
+conn.createStatement().execute(ddl);
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO a VALUES 
(1, ARRAY[1, 2], ARRAY['a', 'b'], ARRAY[2, 3])");
+stmt.execute();
+conn.commit();
+conn.close();
+
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 40));
+conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs;
+stmt = conn.prepareStatement("SELECT arr1, arr1[1], arr2[1], arr3[1] 
from a");
+rs = stmt.executeQuery();
+  

phoenix git commit: PHOENIX-2160 - Add new files

2015-09-02 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master 7d7c21786 -> caaf29e92


PHOENIX-2160 - Add new files


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

Branch: refs/heads/master
Commit: caaf29e920e517d872cf8adad7fddc09328140fe
Parents: 7d7c217
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed Sep 2 17:07:47 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Sep 2 17:07:47 2015 +0530

--
 .../CloneNonDeterministicExpressionVisitor.java | 30 +
 .../ProjectedColumnExpressionVisitor.java   | 25 +++
 .../ReplaceArrayFunctionExpressionVisitor.java  | 46 
 3 files changed, 101 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/caaf29e9/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneNonDeterministicExpressionVisitor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneNonDeterministicExpressionVisitor.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneNonDeterministicExpressionVisitor.java
new file mode 100644
index 000..1aeb9a9
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/CloneNonDeterministicExpressionVisitor.java
@@ -0,0 +1,30 @@
+/*
+ * 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.expression.visitor;
+
+import java.util.List;
+
+import org.apache.phoenix.expression.Determinism;
+import org.apache.phoenix.expression.Expression;
+
+public class CloneNonDeterministicExpressionVisitor extends 
CloneExpressionVisitor {
+
+public boolean isCloneNode(Expression node, List children) {
+return Determinism.PER_INVOCATION.compareTo(node.getDeterminism()) <= 
0;
+}
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/caaf29e9/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/ProjectedColumnExpressionVisitor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/ProjectedColumnExpressionVisitor.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/ProjectedColumnExpressionVisitor.java
new file mode 100644
index 000..2380c6b
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/ProjectedColumnExpressionVisitor.java
@@ -0,0 +1,25 @@
+/*
+ * 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.expression.visitor;
+
+import org.apache.phoenix.expression.ProjectedColumnExpression;
+
+public abstract class ProjectedColumnExpressionVisitor extends 
StatelessTraverseAllExpressionVisitor {
+@Override
+abstract public Void visit(ProjectedColumnExpression node);
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/caaf29e9/phoenix-core/src/main/java/org/apache/phoenix/expression/visitor/ReplaceArrayFunctionExpressionVisitor.java
---

phoenix git commit: PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)

2015-08-31 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-1.1 8da4f7ed1 -> 35276d7d1


PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)


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

Branch: refs/heads/4.5-HBase-1.1
Commit: 35276d7d18f8f6e28a79fdd171bbe0c86fea150e
Parents: 8da4f7e
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Aug 31 14:37:45 2015 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/35276d7d/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 1c1c7df..242ca0f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -27,11 +27,11 @@ import org.apache.phoenix.schema.types.PBinaryArray;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarbinaryArray;
 import org.apache.phoenix.schema.tuple.Tuple;
 
 @BuiltInFunction(name = ArrayLengthFunction.NAME, args = { 
@Argument(allowedTypes = {
-   PBinaryArray.class, PVarbinary.class }) })
+   PBinaryArray.class, PVarbinaryArray.class }) })
 public class ArrayLengthFunction extends ScalarFunction {
public static final String NAME = "ARRAY_LENGTH";
 



phoenix git commit: PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)

2015-08-31 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-1.0 7bc632b33 -> 266a02604


PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)


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

Branch: refs/heads/4.5-HBase-1.0
Commit: 266a02604187ac6e634865a11633ae528033f9a0
Parents: 7bc632b
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Aug 31 14:38:14 2015 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/266a0260/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 1c1c7df..242ca0f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -27,11 +27,11 @@ import org.apache.phoenix.schema.types.PBinaryArray;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarbinaryArray;
 import org.apache.phoenix.schema.tuple.Tuple;
 
 @BuiltInFunction(name = ArrayLengthFunction.NAME, args = { 
@Argument(allowedTypes = {
-   PBinaryArray.class, PVarbinary.class }) })
+   PBinaryArray.class, PVarbinaryArray.class }) })
 public class ArrayLengthFunction extends ScalarFunction {
public static final String NAME = "ARRAY_LENGTH";
 



phoenix git commit: PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)

2015-08-31 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/4.5-HBase-0.98 45615304b -> ef2cd42fb


PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)


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

Branch: refs/heads/4.5-HBase-0.98
Commit: ef2cd42fbe8dd79fccaea9d19f7875902ab788cd
Parents: 4561530
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Aug 31 14:38:43 2015 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef2cd42f/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 1c1c7df..242ca0f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -27,11 +27,11 @@ import org.apache.phoenix.schema.types.PBinaryArray;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarbinaryArray;
 import org.apache.phoenix.schema.tuple.Tuple;
 
 @BuiltInFunction(name = ArrayLengthFunction.NAME, args = { 
@Argument(allowedTypes = {
-   PBinaryArray.class, PVarbinary.class }) })
+   PBinaryArray.class, PVarbinaryArray.class }) })
 public class ArrayLengthFunction extends ScalarFunction {
public static final String NAME = "ARRAY_LENGTH";
 



[16/43] phoenix git commit: PHOENIX-2016 Some Phoenix tests failed with NPE(Alicia Ying Shu)

2015-08-31 Thread ramkrishna
PHOENIX-2016 Some Phoenix tests failed with NPE(Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: dc46b144aa9eaf315c3969669dab7f0a50d94281
Parents: eb9452d
Author: Rajeshbabu Chintaguntla 
Authored: Mon Jun 1 21:34:16 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon Jun 1 21:34:16 2015 +0530

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dc46b144/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index b0574c3..fa78656 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -1627,6 +1627,7 @@ public abstract class BaseTest {
  * Disable and drop all the tables except SYSTEM.CATALOG and 
SYSTEM.SEQUENCE
  */
 private static void disableAndDropNonSystemTables() throws Exception {
+if (driver == null) return;
 HBaseAdmin admin = driver.getConnectionQueryServices(null, 
null).getAdmin();
 try {
 HTableDescriptor[] tables = admin.listTables();



phoenix git commit: PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)

2015-08-31 Thread ramkrishna
Repository: phoenix
Updated Branches:
  refs/heads/master da37b9dac -> f15c4dc33


PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)


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

Branch: refs/heads/master
Commit: f15c4dc3361c1673129042bd3be3bdd6484a4c08
Parents: da37b9d
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Aug 31 14:39:29 2015 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f15c4dc3/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 1c1c7df..242ca0f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -27,11 +27,11 @@ import org.apache.phoenix.schema.types.PBinaryArray;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarbinaryArray;
 import org.apache.phoenix.schema.tuple.Tuple;
 
 @BuiltInFunction(name = ArrayLengthFunction.NAME, args = { 
@Argument(allowedTypes = {
-   PBinaryArray.class, PVarbinary.class }) })
+   PBinaryArray.class, PVarbinaryArray.class }) })
 public class ArrayLengthFunction extends ScalarFunction {
public static final String NAME = "ARRAY_LENGTH";
 



[17/43] phoenix git commit: PHOENIX-1976 Exit gracefully if addShutdownHook fails.

2015-08-31 Thread ramkrishna
PHOENIX-1976 Exit gracefully if addShutdownHook fails.

If the JVM is already in the process of shutting down,
we don't need to add the shutdown hook for the PhoenixDriver
instance. Additionally, we shouldn't advertise this instance
either since we're going down.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: f2be9138359b078fd3e285f3fd441de711789962
Parents: dc46b14
Author: Josh Elser 
Authored: Thu May 14 17:40:46 2015 -0400
Committer: Nick Dimiduk 
Committed: Mon Jun 1 12:02:28 2015 -0700

--
 .../org/apache/phoenix/jdbc/PhoenixDriver.java  | 46 ++--
 1 file changed, 32 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2be9138/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
index 6360d06..cfabe82 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
@@ -60,25 +60,43 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
 private static volatile String driverShutdownMsg;
 static {
 try {
-DriverManager.registerDriver( INSTANCE = new PhoenixDriver() );
-// Add shutdown hook to release any resources that were never 
closed
-// In theory not necessary, but it won't hurt anything
-Runtime.getRuntime().addShutdownHook(new Thread() {
-@Override
-public void run() {
-try {
-INSTANCE.close();
-} catch (SQLException e) {
-logger.warn("Unable to close PhoenixDriver on 
shutdown", e);
-} finally {
-driverShutdownMsg = "Phoenix driver closed because 
server is shutting down";
+INSTANCE = new PhoenixDriver();
+try {
+// Add shutdown hook to release any resources that were never 
closed
+// In theory not necessary, but it won't hurt anything
+Runtime.getRuntime().addShutdownHook(new Thread() {
+@Override
+public void run() {
+closeInstance(INSTANCE);
 }
-}
-});
+});
+
+// Only register the driver when we successfully register the 
shutdown hook
+// Don't want to register it if we're already in the process 
of going down.
+DriverManager.registerDriver( INSTANCE );
+} catch (IllegalStateException e) {
+logger.warn("Failed to register PhoenixDriver shutdown hook as 
the JVM is already shutting down");
+
+// Close the instance now because we don't have the shutdown 
hook
+closeInstance(INSTANCE);
+
+throw e;
+}
 } catch (SQLException e) {
 throw new IllegalStateException("Unable to register " + 
PhoenixDriver.class.getName() + ": "+ e.getMessage());
 }
 }
+
+private static void closeInstance(PhoenixDriver instance) {
+try {
+instance.close();
+} catch (SQLException e) {
+logger.warn("Unable to close PhoenixDriver on shutdown", e);
+} finally {
+driverShutdownMsg = "Phoenix driver closed because server is 
shutting down";
+}
+}
+
 // One entry per cluster here
 private final ConcurrentMap 
connectionQueryServicesMap = new 
ConcurrentHashMap(3);
 



[04/43] phoenix git commit: PHOENIX-1763 Support building with HBase-1.1.0

2015-08-31 Thread ramkrishna
PHOENIX-1763 Support building with HBase-1.1.0


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 98271b888c113f10e174205434e05d3b36b7eb67
Parents: bf01eb2
Author: Enis Soztutar 
Authored: Thu May 21 23:08:26 2015 -0700
Committer: Enis Soztutar 
Committed: Fri May 22 00:30:56 2015 -0700

--
 phoenix-core/pom.xml| 17 +++--
 .../regionserver/IndexHalfStoreFileReader.java  | 31 ++--
 .../regionserver/IndexSplitTransaction.java | 39 --
 .../hbase/regionserver/LocalIndexMerger.java|  3 +-
 .../cache/aggcache/SpillableGroupByCache.java   | 13 +++-
 .../phoenix/coprocessor/BaseRegionScanner.java  | 12 +--
 .../coprocessor/BaseScannerRegionObserver.java  | 77 +++-
 .../coprocessor/DelegateRegionScanner.java  | 23 --
 .../GroupedAggregateRegionObserver.java | 53 --
 .../coprocessor/HashJoinRegionScanner.java  | 60 ---
 .../coprocessor/MetaDataRegionObserver.java | 23 +++---
 .../phoenix/coprocessor/ScanRegionObserver.java | 11 ++-
 .../UngroupedAggregateRegionObserver.java   | 55 +++---
 .../hbase/index/covered/data/LocalTable.java|  2 +-
 .../index/covered/filter/FamilyOnlyFilter.java  |  6 +-
 .../index/scanner/FilteredKeyValueScanner.java  |  2 +-
 .../phoenix/index/PhoenixIndexBuilder.java  |  6 +-
 .../iterate/RegionScannerResultIterator.java|  9 ++-
 .../phoenix/schema/stats/StatisticsScanner.java | 10 ++-
 .../hbase/ipc/PhoenixIndexRpcSchedulerTest.java |  6 +-
 .../index/covered/TestLocalTableState.java  |  1 -
 .../covered/filter/TestFamilyOnlyFilter.java| 12 +--
 .../index/write/TestWALRecoveryCaching.java |  4 +-
 phoenix-flume/pom.xml   |  9 ---
 phoenix-pig/pom.xml | 31 +---
 phoenix-spark/pom.xml   |  7 ++
 pom.xml | 41 ++-
 27 files changed, 361 insertions(+), 202 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 45b8d73..22e6b60 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -350,16 +350,25 @@
 
   org.apache.hbase
   hbase-it
-  ${hbase.version}
   test-jar
   test
 
 
   org.apache.hbase
+  hbase-annotations
+
+
+  org.apache.hbase
   hbase-common
 
 
   org.apache.hbase
+  hbase-common
+  test
+  test-jar
+
+
+  org.apache.hbase
   hbase-protocol
 
 
@@ -369,18 +378,16 @@
 
   org.apache.hbase
   hbase-server
-  ${hbase.version}
 
 
   org.apache.hbase
   hbase-server
-  ${hbase.version}
   test-jar
+  test
 
 
   org.apache.hbase
   hbase-hadoop-compat
-  test
 
 
   org.apache.hbase
@@ -391,13 +398,11 @@
 
   org.apache.hbase
   hbase-hadoop2-compat
-  ${hbase.version}
   test
 
 
   org.apache.hbase
   hbase-hadoop2-compat
-  ${hbase.version}
   test-jar
   test
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/98271b88/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
index 49e2022..9befc8c 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java
@@ -47,11 +47,11 @@ import org.apache.phoenix.index.IndexMaintainer;
  * that sort lowest and 'top' is the second half of the file with keys that 
sort greater than those
  * of the bottom half. The top includes the split files midkey, of the key 
that follows if it does
  * not exist in the file.
- * 
+ *
  * 
  * This type works in tandem with the {@link Reference} type. This class is 
used reading while
  * Reference is used writing.
- * 
+ *
  * 
  * This file is not splitable. Calls to {@link #midkey()} return null.
  */
@@ -64,7 +64,7 @@ public class IndexHalfStoreFileReader extends 
StoreFile.Reader {
 private final byte[] splitkey;
 private final 

[07/43] phoenix git commit: PHOENIX-2005 Connection utilities omit zk client port, parent znode

2015-08-31 Thread ramkrishna
PHOENIX-2005 Connection utilities omit zk client port, parent znode


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c6b37b979da1b514bcb9257c7e095e39b0c2c215
Parents: 3cdc323
Author: Nick Dimiduk 
Authored: Tue May 26 11:11:48 2015 -0700
Committer: Nick Dimiduk 
Committed: Tue May 26 13:27:03 2015 -0700

--
 .../phoenix/jdbc/PhoenixEmbeddedDriver.java | 28 --
 .../phoenix/mapreduce/CsvBulkLoadTool.java  | 93 ++--
 .../phoenix/mapreduce/CsvToKeyValueMapper.java  | 26 +-
 .../query/ConnectionQueryServicesImpl.java  |  4 +-
 .../java/org/apache/phoenix/util/QueryUtil.java | 45 --
 .../phoenix/jdbc/PhoenixEmbeddedDriverTest.java | 14 ++-
 .../phoenix/mapreduce/CsvBulkLoadToolTest.java  | 11 ---
 .../mapreduce/CsvToKeyValueMapperTest.java  | 15 
 .../org/apache/phoenix/util/QueryUtilTest.java  | 33 ---
 9 files changed, 139 insertions(+), 130 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c6b37b97/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index 9e95667..2451603 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -31,6 +31,7 @@ import java.util.logging.Logger;
 
 import javax.annotation.concurrent.Immutable;
 
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
@@ -174,10 +175,10 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 }
 
 /**
- * 
+ *
  * Class to encapsulate connection info for HBase
  *
- * 
+ *
  * @since 0.1.1
  */
 public static class ConnectionInfo {
@@ -204,12 +205,18 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 return false;
 }
 
-protected static ConnectionInfo create(String url) throws SQLException 
{
-StringTokenizer tokenizer = new StringTokenizer(url == null ? "" : 
url.substring(PhoenixRuntime.JDBC_PROTOCOL.length()),DELIMITERS, true);
+public static ConnectionInfo create(String url) throws SQLException {
+url = url == null ? "" : url;
+url = url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)
+? url.substring(PhoenixRuntime.JDBC_PROTOCOL.length())
+: url;
+StringTokenizer tokenizer = new StringTokenizer(url, DELIMITERS, 
true);
 int nTokens = 0;
 String[] tokens = new String[5];
 String token = null;
-while (tokenizer.hasMoreTokens() && 
!(token=tokenizer.nextToken()).equals(TERMINATOR) && tokenizer.hasMoreTokens() 
&& nTokens < tokens.length) {
+while (tokenizer.hasMoreTokens() &&
+!(token=tokenizer.nextToken()).equals(TERMINATOR) &&
+tokenizer.hasMoreTokens() && nTokens < tokens.length) {
 token = tokenizer.nextToken();
 // This would mean we have an empty string for a token which 
is illegal
 if (DELIMITERS.contains(token)) {
@@ -316,8 +323,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 private final String principal;
 private final String keytab;
 
-// used for testing
-ConnectionInfo(String zookeeperQuorum, Integer port, String rootNode, 
String principal, String keytab) {
+public ConnectionInfo(String zookeeperQuorum, Integer port, String 
rootNode, String principal, String keytab) {
 this.zookeeperQuorum = zookeeperQuorum;
 this.port = port;
 this.rootNode = rootNode;
@@ -326,8 +332,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 this.keytab = keytab;
 }
 
-// used for testing
-ConnectionInfo(String zookeeperQuorum, Integer port, String rootNode) {
+public ConnectionInfo(String zookeeperQuorum, Integer port, String 
rootNode) {
this(zookeeperQuorum, port, rootNode, null, null);
 }
 
@@ 

[25/43] phoenix git commit: PHOENIX-2033 PQS log environment details on launch

2015-08-31 Thread ramkrishna
PHOENIX-2033 PQS log environment details on launch


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

Branch: refs/heads/4.x-HBase-1.1
Commit: e64f61ba431b8db938bf60992bbde56f4c540946
Parents: f7d7349
Author: Nick Dimiduk 
Authored: Tue Jun 9 17:12:21 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri Jun 12 09:38:42 2015 -0700

--
 .../apache/phoenix/queryserver/server/Main.java | 69 
 1 file changed, 69 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e64f61ba/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
--
diff --git 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
index 55febc5..9f9bfc7 100644
--- 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
+++ 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
@@ -34,7 +34,12 @@ import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
 
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
 import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -50,6 +55,11 @@ public final class Main extends Configured implements Tool, 
Runnable {
   "phoenix.queryserver.http.port";
   public static final int DEFAULT_HTTP_PORT = 8765;
 
+  public static final String QUERY_SERVER_ENV_LOGGING_KEY =
+  "phoenix.queryserver.envvars.logging.disabled";
+  public static final String QUERY_SERVER_ENV_LOGGING_SKIPWORDS_KEY =
+  "phoenix.queryserver.envvars.logging.skipwords";
+
   public static final String KEYTAB_FILENAME_KEY = 
"phoenix.queryserver.keytab.file";
   public static final String KERBEROS_PRINCIPAL_KEY = 
"phoenix.queryserver.kerberos.principal";
   public static final String DNS_NAMESERVER_KEY = 
"phoenix.queryserver.dns.nameserver";
@@ -58,12 +68,70 @@ public final class Main extends Configured implements Tool, 
Runnable {
 
   protected static final Log LOG = LogFactory.getLog(Main.class);
 
+  @SuppressWarnings("serial")
+  private static final Set DEFAULT_SKIP_WORDS = new HashSet() {
+{
+  add("secret");
+  add("passwd");
+  add("password");
+  add("credential");
+}
+  };
+
   private final String[] argv;
   private final CountDownLatch runningLatch = new CountDownLatch(1);
   private HttpServer server = null;
   private int retCode = 0;
   private Throwable t = null;
 
+  /**
+   * Log information about the currently running JVM.
+   */
+  public static void logJVMInfo() {
+// Print out vm stats before starting up.
+RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+if (runtime != null) {
+  LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
+  runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
+  LOG.info("vmInputArguments=" + runtime.getInputArguments());
+}
+  }
+
+  /**
+   * Logs information about the currently running JVM process including
+   * the environment variables. Logging of env vars can be disabled by
+   * setting {@code "phoenix.envvars.logging.disabled"} to {@code "true"}.
+   * If enabled, you can also exclude environment variables containing
+   * certain substrings by setting {@code "phoenix.envvars.logging.skipwords"}
+   * to comma separated list of such substrings.
+   */
+  public static void logProcessInfo(Configuration conf) {
+// log environment variables unless asked not to
+if (conf == null || !conf.getBoolean(QUERY_SERVER_ENV_LOGGING_KEY, false)) 
{
+  Set skipWords = new HashSet(DEFAULT_SKIP_WORDS);
+  if (conf != null) {
+String[] confSkipWords = 
conf.getStrings(QUERY_SERVER_ENV_LOGGING_SKIPWORDS_KEY);
+if (confSkipWords != null) {
+  skipWords.addAll(Arrays.asList(confSkipWords));
+}
+  }
+
+  nextEnv:
+  for (Map.Entry entry : System.getenv().entrySet()) {
+String key = entry.getKey().toLowerCase();
+String value = entry.getValue().toLowerCase();
+// exclude variables which may contain skip words
+for(String skipWord : skipWords) {
+  if (key.contains(skipWord) || value.contains(skipWord))
+continue nextEnv;
+}
+LOG.info("env:"+entry);
+  }
+  

[37/43] phoenix git commit: PHOENIX-2042 Windows need hadoop native libraries to run tests (Alicia Ying Shu)

2015-08-31 Thread ramkrishna
PHOENIX-2042 Windows need hadoop native libraries to run tests (Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 63f8a6a2e64e9c1f106e3e29011dffc4231fd649
Parents: 9db70f5
Author: Enis Soztutar 
Authored: Mon Jun 29 18:16:35 2015 -0700
Committer: Enis Soztutar 
Committed: Mon Jun 29 18:57:18 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/63f8a6a2/pom.xml
--
diff --git a/pom.xml b/pom.xml
index be44399..f81f818 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,7 +266,7 @@
  UTF-8
  ${numForkedIT}
  true
- -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom
+ -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
  
${test.output.tofile}
  
${basedir}/src/it/java
  
org.apache.phoenix.end2end.ClientManagedTimeTest
@@ -282,7 +282,7 @@
  UTF-8
  ${numForkedIT}
  true
- -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom
+ -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
  
${test.output.tofile}
  
${basedir}/src/it/java
  
org.apache.phoenix.end2end.HBaseManagedTimeTest
@@ -298,7 +298,7 @@
  UTF-8
  ${numForkedIT}
  true
- -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom
+ -enableassertions -Xmx2000m -XX:MaxPermSize=128m 
-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
  
${test.output.tofile}
  
${basedir}/src/it/java
  
org.apache.phoenix.end2end.NeedsOwnMiniClusterTest
@@ -395,7 +395,7 @@
   ${numForkedUT}
   true
   -enableassertions -Xmx2250m -XX:MaxPermSize=128m 
--Djava.security.egd=file:/dev/./urandom
+-Djava.security.egd=file:/dev/./urandom 
"-Djava.library.path=${hadoop.library.path}${path.separator}${java.library.path}"
   
${test.output.tofile}
 
   



[02/43] phoenix git commit: PHOENIX-1681 Use the new Region Interface (Andrew Purtell)

2015-08-31 Thread ramkrishna
PHOENIX-1681 Use the new Region Interface (Andrew Purtell)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: ea622d5f7ab5c37d2ecf8be6054e5ed42f36a035
Parents: 98271b8
Author: Enis Soztutar 
Authored: Thu May 21 23:22:54 2015 -0700
Committer: Enis Soztutar 
Committed: Fri May 22 00:30:56 2015 -0700

--
 ...ReplayWithIndexWritesAndCompressedWALIT.java |  4 +-
 .../EndToEndCoveredColumnsIndexBuilderIT.java   |  4 +-
 .../IndexHalfStoreFileReaderGenerator.java  |  9 +-
 .../regionserver/IndexSplitTransaction.java | 65 +-
 .../hbase/regionserver/LocalIndexMerger.java| 16 ++--
 .../hbase/regionserver/LocalIndexSplitter.java  | 11 +--
 .../coprocessor/BaseScannerRegionObserver.java  | 26 +++---
 .../GroupedAggregateRegionObserver.java | 13 +--
 .../coprocessor/MetaDataEndpointImpl.java   | 94 ++--
 .../phoenix/coprocessor/ScanRegionObserver.java | 17 ++--
 .../coprocessor/SequenceRegionObserver.java | 16 ++--
 .../UngroupedAggregateRegionObserver.java   | 29 +++---
 .../hbase/index/covered/data/LocalTable.java|  5 +-
 .../write/ParallelWriterIndexCommitter.java |  8 +-
 .../recovery/PerRegionIndexWriteCache.java  | 10 +--
 .../recovery/StoreFailuresInCachePolicy.java|  4 +-
 .../TrackingParallelWriterIndexCommitter.java   |  8 +-
 .../phoenix/index/PhoenixIndexBuilder.java  |  4 +-
 .../apache/phoenix/index/PhoenixIndexCodec.java | 14 ++-
 .../schema/stats/StatisticsCollector.java   | 14 +--
 .../phoenix/schema/stats/StatisticsScanner.java | 16 ++--
 .../phoenix/schema/stats/StatisticsWriter.java  | 16 ++--
 .../java/org/apache/phoenix/util/IndexUtil.java | 38 
 .../index/covered/TestLocalTableState.java  |  8 +-
 .../index/write/TestWALRecoveryCaching.java | 17 ++--
 .../recovery/TestPerRegionIndexWriteCache.java  |  6 +-
 26 files changed, 230 insertions(+), 242 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea622d5f/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
index 3b8ff29..611ba68 100644
--- 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
@@ -159,7 +159,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
   }
 
   /**
-   * Test writing edits into an HRegion, closing it, splitting logs, opening 
Region again. Verify
+   * Test writing edits into an region, closing it, splitting logs, opening 
Region again. Verify
* seqids.
* @throws Exception on failure
*/
@@ -183,7 +183,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
 builder.build(htd);
 
 // create the region + its WAL
-HRegion region0 = HRegion.createHRegion(hri, hbaseRootDir, this.conf, htd);
+HRegion region0 = HRegion.createHRegion(hri, hbaseRootDir, this.conf, 
htd); // FIXME: Uses private type
 region0.close();
 region0.getWAL().close();
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea622d5f/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
index d90733f..6b2309e 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
@@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.util.EnvironmentEdge;
 import 

[38/43] phoenix git commit: PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data types

2015-08-31 Thread ramkrishna
PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data 
types


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 7b04ce428d28376b30d3ce63180aa8defd73fe61
Parents: 63f8a6a
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon May 18 19:41:08 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:53 2015 +0530

--
 .../org/apache/phoenix/pig/util/TypeUtil.java   | 415 +--
 .../apache/phoenix/pig/util/TypeUtilTest.java   |  52 +++
 2 files changed, 251 insertions(+), 216 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b04ce42/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index bdee3a4..6549445 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -1,19 +1,11 @@
 /*
- * 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.
+ * 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.pig.util;
@@ -29,11 +21,11 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.phoenix.pig.writable.PhoenixPigDBWritable;
 import org.apache.phoenix.schema.types.PBinary;
-import org.apache.phoenix.schema.types.PChar;
-import org.apache.phoenix.schema.types.PDecimal;
 import org.apache.phoenix.schema.types.PBoolean;
+import org.apache.phoenix.schema.types.PChar;
 import org.apache.phoenix.schema.types.PDataType;
 import org.apache.phoenix.schema.types.PDate;
+import org.apache.phoenix.schema.types.PDecimal;
 import org.apache.phoenix.schema.types.PDouble;
 import org.apache.phoenix.schema.types.PFloat;
 import org.apache.phoenix.schema.types.PInteger;
@@ -56,7 +48,6 @@ import org.apache.phoenix.schema.types.PVarchar;
 import org.apache.pig.PigException;
 import org.apache.pig.ResourceSchema.ResourceFieldSchema;
 import org.apache.pig.backend.hadoop.hbase.HBaseBinaryConverter;
-import org.apache.pig.builtin.Utf8StorageConverter;
 import org.apache.pig.data.DataByteArray;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -68,258 +59,250 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
 
 public final class TypeUtil {
-   
+
 private static final Log LOG = LogFactory.getLog(TypeUtil.class);
-private static final HBaseBinaryConverter binaryConverter = new 
HBaseBinaryConverter ();
-   private static final ImmutableMap<PDataType,Byte> 
phoenixTypeToPigDataType = init();
-   
-   private TypeUtil(){
-   }
-   
-   /**
-* A map of Phoenix to Pig data types.
-* @return
-*/
-   private static ImmutableMap<PDataType, Byte> init

[21/43] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)

2015-08-31 Thread ramkrishna
PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 58ee7062c624dd72a5cdaa41ec5b107a1e7b14c2
Parents: 6f890ad
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jun 2 14:32:02 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 2 14:36:05 2015 +0530

--
 .../main/java/org/apache/phoenix/schema/types/PTimestamp.java   | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/58ee7062/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
index d396adc..16b110e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.DateUtil;
 
 public class PTimestamp extends PDataType {
@@ -47,6 +48,10 @@ public class PTimestamp extends PDataType {
   @Override
   public int toBytes(Object object, byte[] bytes, int offset) {
 if (object == null) {
+  // Create the byte[] of size MAX_TIMESTAMP_BYTES
+  if(bytes.length != getByteSize()) {
+  bytes = Bytes.padTail(bytes, (getByteSize() - bytes.length));
+  }
   PDate.INSTANCE.getCodec().encodeLong(0l, bytes, offset);
   Bytes.putInt(bytes, offset + Bytes.SIZEOF_LONG, 0);
   return getByteSize();



[43/43] phoenix git commit: PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)

2015-08-31 Thread ramkrishna
PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6511d70650fb20f71e1a965f417e011869a14eb0
Parents: 7b448cc
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Mon Aug 31 14:36:48 2015 +0530

--
 .../apache/phoenix/expression/function/ArrayLengthFunction.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6511d706/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
index 1c1c7df..242ca0f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayLengthFunction.java
@@ -27,11 +27,11 @@ import org.apache.phoenix.schema.types.PBinaryArray;
 import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarbinaryArray;
 import org.apache.phoenix.schema.tuple.Tuple;
 
 @BuiltInFunction(name = ArrayLengthFunction.NAME, args = { 
@Argument(allowedTypes = {
-   PBinaryArray.class, PVarbinary.class }) })
+   PBinaryArray.class, PVarbinaryArray.class }) })
 public class ArrayLengthFunction extends ScalarFunction {
public static final String NAME = "ARRAY_LENGTH";
 



[40/43] phoenix git commit: PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data types

2015-08-31 Thread ramkrishna
PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data 
types


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6a96bd2f130cc05a04360a2311a77f2d08f73420
Parents: 76a4786
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon May 18 19:48:30 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:55 2015 +0530

--
 .../src/main/java/org/apache/phoenix/pig/util/TypeUtil.java  | 8 +++-
 .../test/java/org/apache/phoenix/pig/util/TypeUtilTest.java  | 8 +++-
 2 files changed, 6 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a96bd2f/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index c8bc9d8..6e32fb5 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -1,17 +1,15 @@
 /*
- * Copyright 2010 The Apache Software Foundation
- *
  * 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
+ * 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 maynot use this file except in compliance
+ * "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 applicablelaw or agreed to in writing, software
+ * 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

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a96bd2f/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
--
diff --git 
a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java 
b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
index 56167f6..0b44d2b 100644
--- a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
+++ b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
@@ -1,17 +1,15 @@
 /*
- * Copyright 2010 The Apache Software Foundation
- *
  * 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
+ * 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 maynot use this file except in compliance
+ * "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 applicablelaw or agreed to in writing, software
+ * 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



[11/43] phoenix git commit: PHOENIX-1964 - porting from master

2015-08-31 Thread ramkrishna
PHOENIX-1964 - porting from master


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c95e28df94241f47d5cfe9a1515b21960c93adf2
Parents: 0e0b4dd
Author: cmarcel 
Authored: Wed May 27 13:58:45 2015 -0700
Committer: cmarcel 
Committed: Wed May 27 13:58:45 2015 -0700

--
 phoenix-pherf/config/pherf.properties   |  3 ++
 .../org/apache/phoenix/pherf/DataIngestIT.java  |  3 +-
 .../apache/phoenix/pherf/ResultBaseTestIT.java  | 45 ++
 .../java/org/apache/phoenix/pherf/Pherf.java|  7 +--
 .../apache/phoenix/pherf/PherfConstants.java| 50 +++-
 .../phoenix/pherf/loaddata/DataLoader.java  |  2 +-
 .../apache/phoenix/pherf/result/ResultUtil.java |  4 +-
 .../pherf/result/impl/CSVResultHandler.java |  5 +-
 .../pherf/result/impl/ImageResultHandler.java   |  5 +-
 .../pherf/result/impl/XMLResultHandler.java |  6 ++-
 .../apache/phoenix/pherf/util/ResourceList.java | 26 --
 .../pherf/workload/WorkloadExecutor.java|  2 +-
 .../phoenix/pherf/ConfigurationParserTest.java  |  2 +-
 .../org/apache/phoenix/pherf/ResourceTest.java  |  8 ++--
 .../apache/phoenix/pherf/ResultBaseTest.java| 44 +
 .../org/apache/phoenix/pherf/ResultTest.java|  5 +-
 16 files changed, 168 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c95e28df/phoenix-pherf/config/pherf.properties
--
diff --git a/phoenix-pherf/config/pherf.properties 
b/phoenix-pherf/config/pherf.properties
index 354707a..1142f9b5 100644
--- a/phoenix-pherf/config/pherf.properties
+++ b/phoenix-pherf/config/pherf.properties
@@ -29,3 +29,6 @@ pherf.default.dataloader.threadpool=0
 # When upserting, this is the max # of rows that will be inserted in a single 
commit
 pherf.default.dataloader.batchsize=1000
 
+# Directory where results from a scenario run will be written
+pherf.default.results.dir=RESULTS
+

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c95e28df/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
--
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
index b29656d..2b56f43 100644
--- a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
@@ -18,7 +18,6 @@
 
 package org.apache.phoenix.pherf;
 
-import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT;
 import org.apache.phoenix.pherf.configuration.Column;
 import org.apache.phoenix.pherf.configuration.DataTypeMapping;
 import org.apache.phoenix.pherf.configuration.Scenario;
@@ -39,7 +38,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-public class DataIngestIT extends BaseHBaseManagedTimeIT {
+public class DataIngestIT extends ResultBaseTestIT {
 protected static PhoenixUtil util = new PhoenixUtil(true);
 static final String matcherScenario = ".*scenario/.*test.*xml";
 static final String matcherSchema = ".*datamodel/.*test.*sql";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c95e28df/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
--
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
new file mode 100644
index 000..6e103b8
--- /dev/null
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
@@ -0,0 +1,45 @@
+/*
+ * 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 

[32/43] phoenix git commit: PHOENIX-2073 Two bytes character in LIKE expression is not allowed (Yuhao Bi)

2015-08-31 Thread ramkrishna
PHOENIX-2073 Two bytes character in LIKE expression is not allowed (Yuhao Bi)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: c40d64b3bbc793ec920a8a8032c7a93bd015380a
Parents: 980d29c
Author: Yuhao Bi 
Authored: Thu Jun 25 15:41:06 2015 +0800
Committer: Thomas D'Silva 
Committed: Fri Jun 26 11:04:34 2015 -0700

--
 .../apache/phoenix/compile/WhereOptimizer.java|  3 ++-
 .../phoenix/compile/WhereOptimizerTest.java   | 18 ++
 2 files changed, 20 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c40d64b3/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
index a5aef02..32de712 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
@@ -65,6 +65,7 @@ import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PChar;
 import org.apache.phoenix.schema.types.PDataType;
 import org.apache.phoenix.schema.types.PVarbinary;
+import org.apache.phoenix.schema.types.PVarchar;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.ScanUtil;
@@ -945,7 +946,7 @@ public class WhereOptimizer {
 KeySlots childSlots = childParts.get(0);
 KeySlot childSlot = childSlots.iterator().next();
 final String startsWith = node.getLiteralPrefix();
-byte[] key = PChar.INSTANCE.toBytes(startsWith, 
node.getChildren().get(0).getSortOrder());
+byte[] key = PVarchar.INSTANCE.toBytes(startsWith, 
node.getChildren().get(0).getSortOrder());
 // If the expression is an equality expression against a fixed 
length column
 // and the key length doesn't match the column length, the 
expression can
 // never be true.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c40d64b3/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
index f40afc3..2d4763f 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/WhereOptimizerTest.java
@@ -688,6 +688,24 @@ public class WhereOptimizerTest extends 
BaseConnectionlessQueryTest {
 }
 
 @Test
+public void testLikeExtractAllKeyExpression2() throws SQLException {
+String tenantId = "001";
+String keyPrefix = "中文";
+String query = "select * from atable where organization_id = ? and 
entity_id  LIKE '" + keyPrefix + "%'";
+List binds = Arrays.asList(tenantId);
+StatementContext context = compileStatement(query, binds);
+Scan scan = context.getScan();
+
+assertNull(scan.getFilter());
+byte[] startRow = ByteUtil.concat(
+
PVarchar.INSTANCE.toBytes(tenantId),StringUtil.padChar(PVarchar.INSTANCE.toBytes(keyPrefix),15));
+assertArrayEquals(startRow, scan.getStartRow());
+byte[] stopRow = ByteUtil.concat(
+
PVarchar.INSTANCE.toBytes(tenantId),StringUtil.padChar(ByteUtil.nextKey(PVarchar.INSTANCE.toBytes(keyPrefix)),15));
+assertArrayEquals(stopRow, scan.getStopRow());
+}
+
+@Test
 public void testLikeExtractAllAsEqKeyExpression() throws SQLException {
 String tenantId = "001";
 String keyPrefix = "002";



[35/43] phoenix git commit: PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column

2015-08-31 Thread ramkrishna
PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column

Followup commit to adjust the COLUMN_FAMILY_POSITION in QueryUtil as well.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: b0786f5d1082509da9ca2d9f20e651328f025069
Parents: 4c70522
Author: Josh Mahonin 
Authored: Mon Jun 29 15:27:01 2015 -0400
Committer: Josh Mahonin 
Committed: Mon Jun 29 17:00:41 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b0786f5d/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index a2d4a91..bc2141c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -59,7 +59,7 @@ public final class QueryUtil {
 /**
  *  Column family name index within ResultSet resulting from {@link 
DatabaseMetaData#getColumns(String, String, String, String)}
  */
-public static final int COLUMN_FAMILY_POSITION = 24;
+public static final int COLUMN_FAMILY_POSITION = 25;
 
 /**
  *  Column name index within ResultSet resulting from {@link 
DatabaseMetaData#getColumns(String, String, String, String)}



[20/43] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)

2015-08-31 Thread ramkrishna
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af
Parents: 9c5f111
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Tue Jun 2 11:18:51 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 2 11:18:51 2015 +0530

--
 .../phoenix/end2end/ArraysWithNullsIT.java  | 300 +++
 .../phoenix/compile/ExpressionCompiler.java |   9 +-
 .../apache/phoenix/schema/types/PBinary.java|   2 +-
 .../org/apache/phoenix/schema/types/PChar.java  |   5 +-
 .../org/apache/phoenix/schema/types/PDate.java  |   6 +-
 .../apache/phoenix/schema/types/PDecimal.java   |   3 +
 .../apache/phoenix/schema/types/PTimestamp.java |  17 +-
 .../phoenix/schema/types/PhoenixArray.java  |  51 ++--
 8 files changed, 358 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
new file mode 100644
index 000..b034193
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
@@ -0,0 +1,300 @@
+/*
+ * 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 java.sql.*;
+
+import org.apache.phoenix.schema.types.PTimestamp;
+import org.apache.phoenix.schema.types.PhoenixArray;
+import org.junit.Test;
+
+public class ArraysWithNullsIT extends BaseClientManagedTimeIT {
+
+@Test
+public void testArrayUpsertIntWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t1 ( k VARCHAR PRIMARY 
KEY, a INTEGER[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t1 
VALUES('a',ARRAY[null,3,null])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t1 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("INTEGER",new Object[]{null,3,null});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+
+
+@Test
+public void testArrayUpsertVarcharWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t2 ( k VARCHAR PRIMARY 
KEY, a VARCHAR[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t2 
VALUES('a',ARRAY['10',null])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t2 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("VARCHAR",new Object[]{"10",null});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+@Test
+public void testArrayUpsertBigIntWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t3 ( k VARCHAR PRIMARY 
KEY, a BIGINT[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t3 
VALUES('a',ARRAY[2,null,32335,4])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t3 
where k = 'a'");
+   

[31/43] phoenix git commit: PHOENIX-1975 Detect and use HBASE_HOME when set

2015-08-31 Thread ramkrishna
PHOENIX-1975 Detect and use HBASE_HOME when set


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 980d29c5acf785dc90ece1a7f047711e8d522a2e
Parents: 05b1b8b
Author: Nick Dimiduk 
Authored: Wed Jun 24 13:59:00 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed Jun 24 13:59:28 2015 -0700

--
 bin/phoenix_utils.py | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/980d29c5/bin/phoenix_utils.py
--
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 383e0e1..bfb4737 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -65,7 +65,15 @@ def setPath():
 phoenix_class_path = os.getenv('PHOENIX_CLASS_PATH','')
 
 global hbase_conf_dir
-hbase_conf_dir = os.getenv('HBASE_CONF_DIR', os.getenv('HBASE_CONF_PATH', 
'.'))
+# if HBASE_CONF_DIR set explicitly, use that
+hbase_conf_dir = os.getenv('HBASE_CONF_DIR', os.getenv('HBASE_CONF_PATH'))
+if not hbase_conf_dir:
+# else fall back to HBASE_HOME
+if os.getenv('HBASE_HOME'):
+hbase_conf_dir = os.path.join(os.getenv('HBASE_HOME'), "conf")
+else:
+# default to pwd
+hbase_conf_dir = '.'
 global hbase_conf_path # keep conf_path around for backward compatibility
 hbase_conf_path = hbase_conf_dir
 



[15/43] phoenix git commit: PHOENIX-2007 java.sql.SQLException: Encountered exception in sub plan [0] execution(Alicia Ying Shu)

2015-08-31 Thread ramkrishna
PHOENIX-2007 java.sql.SQLException: Encountered exception in sub plan [0] 
execution(Alicia Ying Shu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: eb9452d55068ff4574b48938aebba765c28caaaf
Parents: c1882ee
Author: Rajeshbabu Chintaguntla 
Authored: Mon Jun 1 21:05:24 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon Jun 1 21:05:24 2015 +0530

--
 .../org/apache/phoenix/end2end/HashJoinIT.java  | 54 
 .../apache/phoenix/execute/HashJoinPlan.java|  7 +--
 2 files changed, 58 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/eb9452d5/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index a03204a..88e03ca 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -3813,6 +3813,60 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
 }
 }
 
+@Test
+public void testSubqueryWithoutData() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+
+try {
+String GRAMMAR_TABLE = "CREATE TABLE IF NOT EXISTS GRAMMAR_TABLE 
(ID INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String LARGE_TABLE = "CREATE TABLE IF NOT EXISTS LARGE_TABLE (ID 
INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String SECONDARY_LARGE_TABLE = "CREATE TABLE IF NOT EXISTS 
SECONDARY_LARGE_TABLE (SEC_ID INTEGER PRIMARY KEY," +
+"sec_unsig_id UNSIGNED_INT, sec_big_id BIGINT, 
sec_usnig_long_id UNSIGNED_LONG, sec_tiny_id TINYINT," + 
+"sec_unsig_tiny_id UNSIGNED_TINYINT, sec_small_id 
SMALLINT, sec_unsig_small_id UNSIGNED_SMALLINT," + 
+"sec_float_id FLOAT, sec_unsig_float_id UNSIGNED_FLOAT, 
sec_double_id DOUBLE, sec_unsig_double_id UNSIGNED_DOUBLE," +
+"sec_decimal_id DECIMAL, sec_boolean_id BOOLEAN, 
sec_time_id TIME, sec_date_id DATE," +
+"sec_timestamp_id TIMESTAMP, sec_unsig_time_id TIME, 
sec_unsig_date_id DATE, sec_unsig_timestamp_id TIMESTAMP," +
+"sec_varchar_id VARCHAR (30), sec_char_id CHAR (30), 
sec_binary_id BINARY (100), sec_varbinary_id VARBINARY (100))";
+createTestTable(getUrl(), GRAMMAR_TABLE);
+createTestTable(getUrl(), LARGE_TABLE);
+createTestTable(getUrl(), SECONDARY_LARGE_TABLE);
+
+String ddl = "SELECT * FROM (SELECT ID, BIG_ID, DATE_ID FROM 
LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A " +
+"INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, 
SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS 
B " + 
+"ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT 
SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 100) " +  
+"AND 

[27/43] phoenix git commit: PHOENIX-2040 Mark spark/scala dependencies as 'provided' (Josh Mahonin)

2015-08-31 Thread ramkrishna
PHOENIX-2040 Mark spark/scala dependencies as 'provided' (Josh Mahonin)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 43c722ca6d2d55347d1f2caf7641ce03339e1e1e
Parents: d0bcb7b
Author: Nick Dimiduk 
Authored: Mon Jun 15 16:16:03 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon Jun 15 16:16:30 2015 -0700

--
 phoenix-assembly/pom.xml |  4 
 phoenix-spark/pom.xml| 51 ---
 2 files changed, 32 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/43c722ca/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index ebc5d71..d275d03 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -152,6 +152,10 @@
 
 
   org.apache.phoenix
+  phoenix-spark
+
+
+  org.apache.phoenix
   phoenix-server
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/43c722ca/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index 1747573..aea5c7e 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -45,12 +45,7 @@
   org.apache.phoenix
   phoenix-core
 
-
-  org.apache.phoenix
-  phoenix-core
-  tests
-  test
-
+
 
 
   javax.servlet
@@ -59,16 +54,38 @@
   test
 
 
+
 
-  junit
-  junit
+  org.scala-lang
+  scala-library
+  ${scala.version}
+  provided
+
+
+  org.apache.spark
+  spark-core_${scala.binary.version}
+  ${spark.version}
+  provided
+
+
+  org.apache.spark
+  spark-sql_${scala.binary.version}
+  ${spark.version}
+  provided
+
+
+
+
+  org.apache.phoenix
+  phoenix-core
+  tests
   test
 
 
 
-  org.scala-lang
-  scala-library
-  ${scala.version}
+  junit
+  junit
+  test
 
 
 
@@ -86,18 +103,6 @@
 
 
 
-  org.apache.spark
-  spark-core_${scala.binary.version}
-  ${spark.version}
-
-
-
-  org.apache.spark
-  spark-sql_${scala.binary.version}
-  ${spark.version}
-
-
-
   org.apache.hadoop
   hadoop-client
   ${hadoop-two.version}



[41/43] phoenix git commit: minor changes based on jesses feedback

2015-08-31 Thread ramkrishna
minor changes based on jesses feedback


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 13ddda22e82f9016b9e46544f659a03c8e7d1e5c
Parents: 6a96bd2
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon Jun 15 16:18:47 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:56 2015 +0530

--
 .../src/main/java/org/apache/phoenix/pig/util/TypeUtil.java   | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/13ddda22/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index 6e32fb5..5820ec6 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -76,9 +76,7 @@ public final class TypeUtil {
 private TypeUtil() {}
 
 /**
- * A map of Phoenix to Pig data types.
- * 
- * @return
+ * @return map of Phoenix to Pig data types.
  */
 private static ImmutableMap<PDataType, Byte> init() {
 final ImmutableMap.Builder<PDataType, Byte> builder = new 
Builder<PDataType, Byte>();
@@ -160,7 +158,8 @@ public final class TypeUtil {
 
 /**
  * This method encodes a value with Phoenix data type. It begins with 
checking whether an object is BINARY and makes
- * a call to {@link #castBytes(Object, PDataType)} to convery bytes to 
targetPhoenixType
+ * a call to {@link #castBytes(Object, PDataType)} to convert bytes to 
targetPhoenixType. It returns a {@link RuntimeException}
+ * when object can not be coerced.
  * 
  * @param o
  * @param targetPhoenixType



[05/43] phoenix git commit: PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because HBASE-13756(Rajeshbabu)

2015-08-31 Thread ramkrishna
PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because 
HBASE-13756(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 56e1c0a1f348572fb73e9d0b8bbfb053df7f8710
Parents: ea622d5
Author: Rajeshbabu Chintaguntla 
Authored: Sat May 23 23:29:31 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Sat May 23 23:29:31 2015 +0530

--
 phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/56e1c0a1/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 54ae670..4aa28c4 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -620,6 +620,8 @@ public abstract class BaseTest {
 }
 //no point doing sanity checks when running tests.
 conf.setBoolean("hbase.table.sanity.checks", false);
+// Remove this configuration once hbase has HBASE-13756 fix.
+conf.set("hbase.regionserver.msginterval", "30");
 // set the server rpc controller and rpc scheduler factory, used to 
configure the cluster
 conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY, 
DEFAULT_SERVER_RPC_CONTROLLER_FACTORY);
 conf.set(RSRpcServices.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS, 
DEFAULT_RPC_SCHEDULER_FACTORY);



[39/43] phoenix git commit: PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data types

2015-08-31 Thread ramkrishna
PHOENIX-1981 : PhoenixHBase Load and Store Funcs should handle all Pig data 
types


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 76a478661bcf67340a4f2e0e0a784e2b03e981f4
Parents: 7b04ce4
Author: Prashant Kommireddi 
<pkommire...@pkommireddi-ltm.internal.salesforce.com>
Authored: Mon May 18 19:47:01 2015 -0700
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Tue Jun 30 22:55:54 2015 +0530

--
 .../org/apache/phoenix/pig/util/TypeUtil.java   | 24 ++--
 .../apache/phoenix/pig/util/TypeUtilTest.java   | 20 
 2 files changed, 37 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/76a47866/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
--
diff --git 
a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java 
b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
index 6549445..c8bc9d8 100644
--- a/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
+++ b/phoenix-pig/src/main/java/org/apache/phoenix/pig/util/TypeUtil.java
@@ -1,11 +1,21 @@
 /*
- * 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.
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * 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 maynot 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 applicablelaw 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.pig.util;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/76a47866/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
--
diff --git 
a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java 
b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
index 25d9f48..56167f6 100644
--- a/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
+++ b/phoenix-pig/src/test/java/org/apache/phoenix/pig/util/TypeUtilTest.java
@@ -1,3 +1,23 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * 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 maynot 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 applicablelaw 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.pig.util;
 
 import static org.junit.Assert.assertEquals;



[42/43] phoenix git commit: PHOENIX-1875 implement ARRAY_PREPEND built in function (Dumindu)

2015-08-31 Thread ramkrishna
PHOENIX-1875 implement ARRAY_PREPEND built in function (Dumindu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 7b448cc24c48f695836c72a2dd08c7454ae928bc
Parents: 13ddda2
Author: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Authored: Wed May 13 10:46:19 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com>
Committed: Wed Jul 1 09:50:26 2015 +0530

--
 .../phoenix/end2end/ArrayPrependFunctionIT.java | 652 +++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../function/ArrayAppendFunction.java   |  35 +-
 .../function/ArrayModifierFunction.java |  75 +++
 .../function/ArrayPrependFunction.java  |  96 +++
 .../phoenix/schema/types/PArrayDataType.java| 161 -
 .../expression/ArrayPrependFunctionTest.java| 552 
 7 files changed, 1541 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b448cc2/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
new file mode 100644
index 000..3145d95
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
@@ -0,0 +1,652 @@
+/*
+ * 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.assertFalse;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.*;
+
+import org.apache.phoenix.schema.TypeMismatchException;
+import org.apache.phoenix.schema.types.PhoenixArray;
+import org.junit.Test;
+
+public class ArrayPrependFunctionIT extends BaseHBaseManagedTimeIT {
+
+private void initTableWithVarArray(Connection conn, String type, Object[] 
objectArray, String value) throws SQLException {
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a " + type + "[],b " + type + ")");
+conn.commit();
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t 
VALUES(?,?," + value + ")");
+PhoenixArray array = (PhoenixArray) conn.createArrayOf(type, 
objectArray);
+stmt.setString(1, "a");
+stmt.setArray(2, array);
+stmt.execute();
+conn.commit();
+
+}
+
+private void initTables(Connection conn) throws Exception {
+String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY 
KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints 
BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck 
INTEGER,chars2 CHAR(15)[])";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO 
regions(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2)
 VALUES('SF Bay Area'," +
+"ARRAY['2345','46345','23234']," +
+"ARRAY[2345,46345,23234,456]," +
+"ARRAY[23.45,46.345,23.234,45.6,5.78]," +
+"ARRAY[12,34,56,78,910]," +
+"ARRAY['a','','c','ddd','e']," +
+"23.45," +
+"'wert'," +
+"NULL," +
+"ARRAY['foo','a','','c','ddd','e']" +
+")";
+PreparedStatement stmt = conn.prepareStatement(dml);
+stmt.execute();
+conn.commit();
+}
+
+private void initTablesDesc(Connection conn, String type, String val) 
throws E

[34/43] phoenix git commit: PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column

2015-08-31 Thread ramkrishna
PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 4c705228d278721c12f1d7369c990d1de12f9d13
Parents: 89ab41c
Author: Josh Mahonin 
Authored: Thu Jun 25 15:52:37 2015 -0400
Committer: Josh Mahonin 
Committed: Mon Jun 29 12:30:56 2015 -0400

--
 .../end2end/QueryDatabaseMetaDataIT.java| 31 
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  1 +
 2 files changed, 32 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c705228/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
index 61459a5..2fdccf6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
@@ -1118,4 +1118,35 @@ public class QueryDatabaseMetaDataIT extends 
BaseClientManagedTimeIT {
 assertFalse(rs.next());
 }
 
+@Test
+public void testRemarkColumn() throws SQLException {
+long ts = nextTimestamp();
+Properties props = new Properties();
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 5));
+Connection conn = DriverManager.getConnection(getUrl(), props);
+
+// Retrieve the database metadata
+DatabaseMetaData dbmd = conn.getMetaData();
+ResultSet rs = dbmd.getColumns(null, null, null, null);
+rs.next();
+
+// Lookup column by name, this should return null but not throw an 
exception
+String remarks = rs.getString("REMARKS");
+assertNull(remarks);
+
+// Same as above, but lookup by position
+remarks = rs.getString(12);
+assertNull(remarks);
+
+// Iterate through metadata columns to find 'COLUMN_NAME' == 'REMARKS'
+boolean foundRemarksColumn = false;
+while(rs.next()) {
+String colName = rs.getString("COLUMN_NAME");
+if(PhoenixDatabaseMetaData.REMARKS.equals(colName)) {
+foundRemarksColumn = true;
+break;
+}
+}
+assertTrue("Could not find REMARKS column", foundRemarksColumn);
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c705228/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 3a0b03b..a862875 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -437,6 +437,7 @@ public class PhoenixDatabaseMetaData implements 
DatabaseMetaData, org.apache.pho
 DECIMAL_DIGITS + "," +
 NUM_PREC_RADIX + "," +
 NULLABLE + "," +
+REMARKS + "," +
 COLUMN_DEF + "," +
 SQL_DATA_TYPE + "," +
 SQL_DATETIME_SUB + "," +



[08/43] phoenix git commit: PHOENIX-2005 Connection utilities omit zk client port, parent znode (addendum)

2015-08-31 Thread ramkrishna
PHOENIX-2005 Connection utilities omit zk client port, parent znode (addendum)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 5546a42226e3f0fdf0cc89f1c175ff3da7a75d8c
Parents: c6b37b9
Author: Nick Dimiduk 
Authored: Tue May 26 17:41:04 2015 -0700
Committer: Nick Dimiduk 
Committed: Tue May 26 17:52:24 2015 -0700

--
 .../phoenix/jdbc/PhoenixEmbeddedDriver.java |  2 +-
 .../java/org/apache/phoenix/util/QueryUtil.java |  2 +-
 .../phoenix/jdbc/PhoenixEmbeddedDriverTest.java | 20 
 3 files changed, 22 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5546a422/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index 2451603..3cfaacc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -209,7 +209,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 url = url == null ? "" : url;
 url = url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)
 ? url.substring(PhoenixRuntime.JDBC_PROTOCOL.length())
-: url;
+: PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + url;
 StringTokenizer tokenizer = new StringTokenizer(url, DELIMITERS, 
true);
 int nTokens = 0;
 String[] tokens = new String[5];

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5546a422/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index bd38983..a2d4a91 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -290,7 +290,7 @@ public final class QueryUtil {
 throws ClassNotFoundException,
 SQLException {
 String url = getConnectionUrl(props, conf);
-LOG.info("Creating connection with the jdbc url:" + url);
+LOG.info("Creating connection with the jdbc url: " + url);
 PropertiesUtil.extractProperties(props, conf);
 return DriverManager.getConnection(url, props);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5546a422/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
index 083b205..4eda825 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
@@ -34,23 +34,33 @@ public class PhoenixEmbeddedDriverTest {
 @Test
 public void testGetConnectionInfo() throws SQLException {
 String[] urls = new String[] {
+null,
+"",
 "jdbc:phoenix",
 "jdbc:phoenix;test=true",
 "jdbc:phoenix:localhost",
+"localhost",
+"localhost;",
 "jdbc:phoenix:localhost:123",
 "jdbc:phoenix:localhost:123;foo=bar",
+"localhost:123",
 "jdbc:phoenix:localhost:123:/hbase",
 "jdbc:phoenix:localhost:123:/foo-bar",
 "jdbc:phoenix:localhost:123:/foo-bar;foo=bas",
+"localhost:123:/foo-bar",
 "jdbc:phoenix:localhost:/hbase",
 "jdbc:phoenix:localhost:/foo-bar",
 "jdbc:phoenix:localhost:/foo-bar;test=true",
+"localhost:/foo-bar",
 "jdbc:phoenix:v1,v2,v3",
 "jdbc:phoenix:v1,v2,v3;",
 "jdbc:phoenix:v1,v2,v3;test=true",
+"v1,v2,v3",
 "jdbc:phoenix:v1,v2,v3:/hbase",
 "jdbc:phoenix:v1,v2,v3:/hbase;test=true",
+"v1,v2,v3:/foo-bar",
 "jdbc:phoenix:v1,v2,v3:123:/hbase",
+"v1,v2,v3:123:/hbase",
 

[22/43] phoenix git commit: PHOENIX-1978 UDF ArgumentTypeMismatchException(Rajeshbabu)

2015-08-31 Thread ramkrishna
PHOENIX-1978 UDF ArgumentTypeMismatchException(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 18b9e72756642e127b2e227ea46a4f70401e6187
Parents: 58ee706
Author: Rajeshbabu Chintaguntla 
Authored: Fri Jun 5 09:04:17 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Fri Jun 5 09:04:17 2015 +0530

--
 .../phoenix/end2end/UserDefinedFunctionsIT.java | 58 ++--
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 17 +++---
 2 files changed, 61 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/18b9e727/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
index 868e19d..c6bd62f 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
@@ -58,6 +58,8 @@ import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.FunctionAlreadyExistsException;
 import org.apache.phoenix.schema.FunctionNotFoundException;
 import org.apache.phoenix.schema.ValueRangeExcpetion;
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PArrayDataType;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -121,11 +123,31 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
 .append("
ptr.set(PInteger.INSTANCE.toBytes((Integer)sum));\n")
 .append("return true;\n")
 .append("}\n").toString();
-
+private static String ARRAY_INDEX_EVALUATE_METHOD =
+new StringBuffer()
+.append("public boolean evaluate(Tuple tuple, 
ImmutableBytesWritable ptr) {\n")
+.append("Expression indexExpr = 
children.get(1);\n")
+.append("if (!indexExpr.evaluate(tuple, ptr)) {\n")
+.append("   return false;\n")
+.append("} else if (ptr.getLength() == 0) {\n")
+.append("   return true;\n")
+.append("}\n")
+.append("// Use Codec to prevent Integer object 
allocation\n")
+.append("int index = 
PInteger.INSTANCE.getCodec().decodeInt(ptr, indexExpr.getSortOrder());\n")
+.append("if(index < 0) {\n")
+.append("   throw new ParseException(\"Index 
cannot be negative :\" + index);\n")
+.append("}\n")
+.append("Expression arrayExpr = 
children.get(0);\n")
+.append("return 
PArrayDataType.positionAtArrayElement(tuple, ptr, index, arrayExpr, 
getDataType(),getMaxLength());\n")
+.append("}\n").toString();
+
+
 private static String MY_REVERSE_CLASS_NAME = "MyReverse";
 private static String MY_SUM_CLASS_NAME = "MySum";
-private static String MY_REVERSE_PROGRAM = 
getProgram(MY_REVERSE_CLASS_NAME, STRING_REVERSE_EVALUATE_METHOD, "PVarchar");
-private static String MY_SUM_PROGRAM = getProgram(MY_SUM_CLASS_NAME, 
SUM_COLUMN_VALUES_EVALUATE_METHOD, "PInteger");
+private static String MY_ARRAY_INDEX_CLASS_NAME = "MyArrayIndex";
+private static String MY_REVERSE_PROGRAM = 
getProgram(MY_REVERSE_CLASS_NAME, STRING_REVERSE_EVALUATE_METHOD, "return 
PVarchar.INSTANCE;");
+private static String MY_SUM_PROGRAM = getProgram(MY_SUM_CLASS_NAME, 
SUM_COLUMN_VALUES_EVALUATE_METHOD, "return PInteger.INSTANCE;");
+private static String MY_ARRAY_INDEX_PROGRAM = 
getProgram(MY_ARRAY_INDEX_CLASS_NAME, ARRAY_INDEX_EVALUATE_METHOD, "return 
PDataType.fromTypeId(children.get(0).getDataType().getSqlType()- 
PDataType.ARRAY_TYPE_BASE);");
 private static Properties EMPTY_PROPS = new Properties();
 
 
@@ -144,6 +166,8 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
 .append("import org.apache.phoenix.schema.types.PInteger;\n")
 .append("import org.apache.phoenix.schema.types.PVarchar;\n")
 .append("import org.apache.phoenix.util.StringUtil;\n")
+   

  1   2   3   >