[2/2] phoenix git commit: PHOENIX-1812 Only sync table metadata when necessary

2015-08-31 Thread tdsilva
PHOENIX-1812 Only sync table metadata when necessary


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

Branch: refs/heads/txn
Commit: 92ee51a0d4f25ab6e2f353a7cfeea36b36df3ebd
Parents: 81e52e8
Author: Thomas D'Silva 
Authored: Tue Jun 2 15:39:44 2015 -0700
Committer: Thomas D'Silva 
Committed: Mon Aug 31 10:28:49 2015 -0700

--
 phoenix-core/pom.xml|   8 +-
 .../apache/phoenix/end2end/AlterTableIT.java|  10 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |   4 +-
 .../phoenix/end2end/index/IndexMetadataIT.java  |   4 +-
 .../phoenix/end2end/index/LocalIndexIT.java |   6 +-
 .../phoenix/end2end/index/SaltedIndexIT.java|   2 +-
 .../end2end/index/TxImmutableIndexIT.java   |   1 +
 .../phoenix/transactions/TransactionIT.java |  52 ++
 .../transactions/TxPointInTimeQueryIT.java  |  33 
 .../phoenix/transactions/UpdateCacheIT.java | 122 +
 .../transactions/UpdateCacheWithScnIT.java  |  41 +
 .../phoenix/compile/CreateTableCompiler.java|   4 +-
 .../apache/phoenix/compile/DeleteCompiler.java  |   4 +-
 .../apache/phoenix/compile/FromCompiler.java|  15 +-
 .../apache/phoenix/compile/PostDDLCompiler.java |   2 +-
 .../phoenix/compile/ProjectionCompiler.java |   6 +-
 .../apache/phoenix/compile/QueryCompiler.java   |   2 +-
 .../apache/phoenix/compile/UpsertCompiler.java  |   2 +-
 .../coprocessor/MetaDataEndpointImpl.java   |   6 +-
 .../apache/phoenix/execute/MutationState.java   |  11 +-
 .../apache/phoenix/jdbc/PhoenixConnection.java  |  52 --
 .../apache/phoenix/jdbc/PhoenixStatement.java   |   8 +-
 .../query/ConnectionQueryServicesImpl.java  |  31 ++--
 .../query/ConnectionlessQueryServicesImpl.java  |  21 ++-
 .../query/DelegateConnectionQueryServices.java  |  17 +-
 .../apache/phoenix/query/MetaDataMutated.java   |   7 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 179 ---
 .../org/apache/phoenix/schema/PMetaData.java|   4 +-
 .../apache/phoenix/schema/PMetaDataImpl.java| 107 +--
 .../org/apache/phoenix/schema/PTableRef.java|  65 +++
 .../org/apache/phoenix/schema/TableRef.java |   2 +-
 .../org/apache/phoenix/util/PhoenixRuntime.java |   4 +-
 .../org/apache/phoenix/util/SchemaUtil.java |   7 +-
 .../apache/phoenix/util/TransactionUtil.java|  40 -
 .../phoenix/compile/QueryCompilerTest.java  |   4 +-
 .../phoenix/compile/ViewCompilerTest.java   |  29 ++-
 .../phoenix/filter/SkipScanBigFilterTest.java   |   5 +-
 .../phoenix/index/IndexMaintainerTest.java  |   4 +-
 .../query/BaseConnectionlessQueryTest.java  |   2 +-
 .../java/org/apache/phoenix/query/BaseTest.java |   4 +-
 .../query/ParallelIteratorsSplitTest.java   |   2 +-
 .../phoenix/schema/PMetaDataImplTest.java   |   4 +-
 .../apache/phoenix/schema/RowKeySchemaTest.java |   2 +-
 .../phoenix/schema/RowKeyValueAccessorTest.java |   2 +-
 .../java/org/apache/phoenix/util/TestUtil.java  |  25 +++
 phoenix-flume/pom.xml   |   7 +
 phoenix-pig/pom.xml |   7 +
 pom.xml |   1 +
 48 files changed, 653 insertions(+), 324 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/92ee51a0/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 775411c..c205e87 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -224,24 +224,24 @@
 
   co.cask.tephra
   tephra-api
-  0.6.2-SNAPSHOT
+  ${tephra.version}
 
 
   co.cask.tephra
   tephra-core
-  0.6.2-SNAPSHOT
+  ${tephra.version}
 
 
   co.cask.tephra
   tephra-core
   test-jar
-  0.6.2-SNAPSHOT
+  ${tephra.version}
   test
 
 
   co.cask.tephra
   tephra-hbase-compat-0.98
-  0.6.2-SNAPSHOT
+  ${tephra.version}
 
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/92ee51a0/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
index 46f51cf..3004bd6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
@@ -718,7 +718,7 @@ public class AlterTableIT extends 

Apache-Phoenix | 4.5-HBase-0.98 | Build Successful

2015-08-31 Thread Apache Jenkins Server
4.5-HBase-0.98 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf?p=phoenix.git;a=shortlog;h=refs/heads/4.5-HBase-0.98

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.5-HBase-0.98/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.5-HBase-0.98/lastCompletedBuild/testReport/

Changes
[ramkrishna] PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)



Build times for last couple of runsLatest build time is the right most | Legend blue: normal, red: test failure, gray: timeout


Apache-Phoenix | Master | Build Successful

2015-08-31 Thread Apache Jenkins Server
Master branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf?p=phoenix.git;a=shortlog;h=refs/heads/master

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-master/lastCompletedBuild/testReport/

Changes
[ramkrishna] PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)



Build times for last couple of runsLatest build time is the right most | Legend blue: normal, red: test failure, gray: timeout


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 
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna 
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 
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna 
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 
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna 
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();



Apache-Phoenix | 4.5-HBase-1.1 | Build Successful

2015-08-31 Thread Apache Jenkins Server
4.5-HBase-1.1 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf?p=phoenix.git;a=shortlog;h=refs/heads/4.5-HBase-1.1

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.5-HBase-1.1/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.5-HBase-1.1/lastCompletedBuild/testReport/

Changes
[ramkrishna] PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)



Build times for last couple of runsLatest build time is the right most | Legend blue: normal, red: test failure, gray: timeout


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 
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna 
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";
 



Apache-Phoenix | 4.x-HBase-1.0 | Build Successful

2015-08-31 Thread Apache Jenkins Server
4.x-HBase-1.0 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf?p=phoenix.git;a=shortlog;h=refs/heads/4.x-HBase-1.0

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.x-HBase-1.0/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.x-HBase-1.0/lastCompletedBuild/testReport/

Changes
[ramkrishna] PHOENIX-2213 ARRAY_LENGTH fails for Decimal type array (Dumindu Buddhika)



Build times for last couple of runsLatest build time is the right most | Legend blue: normal, red: test failure, gray: timeout


[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 

Authored: Mon May 18 19:41:08 2015 -0700
Committer: ramkrishna 
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 
phoenixTypeToPigDataType = init();
-   
-   private TypeUtil(){
-   }
-   
-   /**
-* A map of Phoenix to Pig data types.
-* @return
-*/
-   private static ImmutableMap init() {
-final ImmutableMap.Builder builder = 

[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 
Authored: Tue Jun 2 14:32:02 2015 +0530
Committer: ramkrishna 
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 
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna 
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 

Authored: Mon May 18 19:48:30 2015 -0700
Committer: ramkrishna 
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 
Authored: Tue Jun 2 11:18:51 2015 +0530
Committer: ramkrishna 
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'");
+rs.next();
+Array array = conn.createArrayOf("BIGINT",new 
Object[]{(long)2,null,(long)32335,(long)4});
+
+

[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 

Authored: Mon Jun 15 16:18:47 2015 -0700
Committer: ramkrishna 
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 init() {
 final ImmutableMap.Builder builder = new 
Builder();
@@ -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 

Authored: Mon May 18 19:47:01 2015 -0700
Committer: ramkrishna 
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 
Authored: Wed May 13 10:46:19 2015 +0530
Committer: ramkrishna 
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 Exception {
+String ddl = "CREATE TABLE regions (pk " + type + " PRIMARY KEY 
DESC,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints 
BIGINT[],chars CHAR(15)[],chars2 CHAR(15)[], bools BOOLEAN[])";
+

[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")
+   

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

2015-08-31 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 {



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

2015-08-31 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
+
+  
   
 
   /



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

2015-08-31 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);
+

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

2015-08-31 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;
 }



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

2015-08-31 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);



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

2015-08-31 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 @@
 

[13/43] phoenix git commit: PHOENIX-2010 Properly validate number of arguments passed to the functions in FunctionParseNode#validate(Rajeshbabu)

2015-08-31 Thread ramkrishna
PHOENIX-2010 Properly validate number of arguments passed to the functions in 
FunctionParseNode#validate(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: b2c0cb9002ee881f21d968817c386a98d39074ca
Parents: a600cc4
Author: Rajeshbabu Chintaguntla 
Authored: Sun May 31 07:40:39 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Sun May 31 07:40:39 2015 +0530

--
 .../phoenix/end2end/UserDefinedFunctionsIT.java   | 14 ++
 .../org/apache/phoenix/parse/FunctionParseNode.java   |  4 
 .../main/java/org/apache/phoenix/parse/PFunction.java |  4 +---
 3 files changed, 19 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b2c0cb90/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 7dbde3c..868e19d 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
@@ -442,6 +442,20 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
 rs = stmt.executeQuery("select k from t9 where mysum9(k)=11");
 assertTrue(rs.next());
 assertEquals(1, rs.getInt(1));
+try {
+rs = stmt.executeQuery("select k from t9 where 
mysum9(k,10,'x')=11");
+fail("FunctionNotFoundException should be thrown");
+} catch(FunctionNotFoundException e) {
+} catch(Exception e) {
+fail("FunctionNotFoundException should be thrown");
+}
+try {
+rs = stmt.executeQuery("select mysum9() from t9");
+fail("FunctionNotFoundException should be thrown");
+} catch(FunctionNotFoundException e) {
+} catch(Exception e) {
+fail("FunctionNotFoundException should be thrown");
+}
 stmt.execute("drop function mysum9");
 try {
 rs = stmt.executeQuery("select k from t9 where mysum9(k)=11");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b2c0cb90/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
index d1001ee..be52d89 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
@@ -41,6 +41,7 @@ import 
org.apache.phoenix.expression.function.FunctionExpression;
 import org.apache.phoenix.expression.function.UDFExpression;
 import org.apache.phoenix.parse.PFunction.FunctionArgument;
 import org.apache.phoenix.schema.ArgumentTypeMismatchException;
+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.PDataTypeFactory;
@@ -133,6 +134,9 @@ public class FunctionParseNode extends CompoundParseNode {
 public List validate(List children, 
StatementContext context) throws SQLException {
 BuiltInFunctionInfo info = this.getInfo();
 BuiltInFunctionArgInfo[] args = info.getArgs();
+if (args.length < children.size() || info.getRequiredArgCount() > 
children.size()) {
+throw new FunctionNotFoundException(this.name);
+}
 if (args.length > children.size()) {
 List moreChildren = new 
ArrayList(children);
 for (int i = children.size(); i < info.getArgs().length; i++) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b2c0cb90/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
index 351bec7..aeed3ac 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
@@ -96,9 +96,7 @@ public class PFunction implements PMetaDataEntity {
 }
 
 public PFunction(PFunction 

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.x-HBase-1.0 2611a9c3c -> 2335308e2


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/2335308e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2335308e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2335308e

Branch: refs/heads/4.x-HBase-1.0
Commit: 2335308e2aec16377f30bec7e2e07e87a5cb0375
Parents: 2611a9c
Author: ramkrishna 
Authored: Mon Aug 31 14:34:26 2015 +0530
Committer: ramkrishna 
Committed: Mon Aug 31 14:36:03 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/2335308e/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";