git commit: PHOENIX-1184 Phoenix 4.0 will not compile agaist CDH HBase 5.1

2014-08-31 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.0.1 a169e1ba4 - 06be59d0f


PHOENIX-1184 Phoenix 4.0 will not compile agaist CDH HBase 5.1

Conflicts:

phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java


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

Branch: refs/heads/4.0.1
Commit: 06be59d0ffa97d1e15a4d40a93dccd26144ad9ff
Parents: a169e1b
Author: James Taylor jtay...@salesforce.com
Authored: Mon Aug 25 11:32:59 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Fri Aug 29 18:06:02 2014 -0700

--
 .../query/ConnectionlessQueryServicesImpl.java   | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/06be59d0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index 74cdf52..bcbac67 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@ -19,7 +19,6 @@ package org.apache.phoenix.query;
 
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_STATE_BYTES;
 
-import java.lang.reflect.Constructor;
 import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
@@ -36,6 +35,7 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.util.Addressing;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.compile.MutationPlan;
@@ -84,6 +84,8 @@ import com.google.common.collect.Maps;
  * @since 0.1
  */
 public class ConnectionlessQueryServicesImpl extends DelegateQueryServices 
implements ConnectionQueryServices  {
+private static ServerName SERVER_NAME = 
ServerName.parseServerName(HConstants.LOCALHOST + 
Addressing.HOSTNAME_PORT_SEPARATOR + HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT);
+
 private PMetaData metaData;
 private final MapSequenceKey, Long sequenceMap = Maps.newHashMap();
 private KeyValueBuilder kvBuilder;
@@ -139,22 +141,9 @@ public class ConnectionlessQueryServicesImpl extends 
DelegateQueryServices imple
 
 @Override
 public ListHRegionLocation getAllTableRegions(byte[] tableName) throws 
SQLException {
-// HBase hides the ServerName constructors and provides static valueOf 
helper methods
-// for obtaining ServerName objects instead. However some commercial 
Hadoop distributions
-// have patched their HBase to remove the valueOf static methods, 
leaving no common way
-// to construct ServerNames except by way of reflection.
-ServerName fakeServerName;
-try {
-  ConstructorServerName c = 
ServerName.class.getDeclaredConstructor(String.class,
-  int.class, long.class);
-  c.setAccessible(true);
-  fakeServerName = c.newInstance(localhost, 
HConstants.DEFAULT_REGIONSERVER_PORT, 0L);
-} catch (Exception e) {
-  throw new SQLException(e);
-}
 return Collections.singletonList(new HRegionLocation(
 new HRegionInfo(TableName.valueOf(tableName), 
HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW),
-fakeServerName, -1));
+SERVER_NAME, -1));
 }
 
 @Override



git commit: PHOENIX-1203 Uable to work for count (distinct col) queries via phoenix table with secondary indexes.

2014-08-31 Thread anoopsamjohn
Repository: phoenix
Updated Branches:
  refs/heads/master 867af78dd - 4774c6332


PHOENIX-1203 Uable to work for count (distinct col) queries via phoenix table 
with secondary indexes.


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

Branch: refs/heads/master
Commit: 4774c63320517fed15c4f4e3ef0a03fdbc597b06
Parents: 867af78
Author: anoopsjohn anoopsamj...@gmail.com
Authored: Mon Sep 1 09:13:38 2014 +0530
Committer: anoopsjohn anoopsamj...@gmail.com
Committed: Mon Sep 1 09:13:38 2014 +0530

--
 .../apache/phoenix/end2end/DistinctCountIT.java | 45 
 .../apache/phoenix/parse/ParseNodeFactory.java  |  2 +-
 2 files changed, 46 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4774c633/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
index 62fa0f5..4b76d29 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
@@ -45,6 +45,7 @@ import java.sql.ResultSet;
 import java.sql.Types;
 import java.util.Properties;
 
+import org.apache.phoenix.schema.TableAlreadyExistsException;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
@@ -458,4 +459,48 @@ public class DistinctCountIT extends 
BaseClientManagedTimeIT {
 conn.close();
 }
 }
+
+@Test
+public void testDistinctCountOnIndexTab() throws Exception {
+String ddl = create table personal_details (id integer not null, 
first_name char(15),\n
++ last_name char(15), CONSTRAINT pk PRIMARY KEY (id));
+Properties props = new Properties();
+Connection conn = DriverManager.getConnection(getUrl(), props);
+try {
+PreparedStatement stmt = conn.prepareStatement(ddl);
+stmt.execute(ddl);
+conn.createStatement().execute(CREATE INDEX personal_details_idx 
ON personal_details(first_name));
+} catch (TableAlreadyExistsException e) {
+
+} finally {
+conn.close();
+}
+
+conn = DriverManager.getConnection(getUrl(), props);
+try {
+PreparedStatement stmt = conn.prepareStatement(upsert into 
personal_details(id, first_name, 
++ last_name) VALUES (?, ?, ?));
+stmt.setInt(1, 1);
+stmt.setString(2, NAME1);
+stmt.setString(3, LN);
+stmt.execute();
+stmt.setInt(1, 2);
+stmt.setString(2, NAME1);
+stmt.setString(3, LN2);
+stmt.execute();
+stmt.setInt(1, 3);
+stmt.setString(2, NAME2);
+stmt.setString(3, LN3);
+stmt.execute();
+conn.commit();
+
+String query = SELECT COUNT (DISTINCT first_name) FROM 
personal_details;
+PreparedStatement statement = conn.prepareStatement(query);
+ResultSet rs = statement.executeQuery();
+assertTrue(rs.next());
+assertEquals(2, rs.getInt(1));
+} finally {
+conn.close();
+}
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4774c633/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
index 5125340..6872f8a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
@@ -345,7 +345,7 @@ public class ParseNodeFactory {
 if 
(CountAggregateFunction.NAME.equals(SchemaUtil.normalizeIdentifier(name))) {
 BuiltInFunctionInfo info = getInfo(
 
SchemaUtil.normalizeIdentifier(DistinctCountAggregateFunction.NAME), args);
-return new DistinctCountParseNode(name, args, info);
+return new 
DistinctCountParseNode(DistinctCountAggregateFunction.NAME, args, info);
 } else {
 throw new UnsupportedOperationException(DISTINCT not supported 
with  + name);
 }



git commit: PHOENIX-1203 Uable to work for count (distinct col) queries via phoenix table with secondary indexes.

2014-08-31 Thread anoopsamjohn
Repository: phoenix
Updated Branches:
  refs/heads/4.0 6fb2b22b9 - 214a4ccf8


PHOENIX-1203 Uable to work for count (distinct col) queries via phoenix table 
with secondary indexes.


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

Branch: refs/heads/4.0
Commit: 214a4ccf89da50c47158b71e9d17418a0c3e6fae
Parents: 6fb2b22
Author: anoopsjohn anoopsamj...@gmail.com
Authored: Mon Sep 1 09:16:04 2014 +0530
Committer: anoopsjohn anoopsamj...@gmail.com
Committed: Mon Sep 1 09:16:04 2014 +0530

--
 .../apache/phoenix/end2end/DistinctCountIT.java | 45 
 .../apache/phoenix/parse/ParseNodeFactory.java  |  2 +-
 2 files changed, 46 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/214a4ccf/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
index 62fa0f5..4b76d29 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
@@ -45,6 +45,7 @@ import java.sql.ResultSet;
 import java.sql.Types;
 import java.util.Properties;
 
+import org.apache.phoenix.schema.TableAlreadyExistsException;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
@@ -458,4 +459,48 @@ public class DistinctCountIT extends 
BaseClientManagedTimeIT {
 conn.close();
 }
 }
+
+@Test
+public void testDistinctCountOnIndexTab() throws Exception {
+String ddl = create table personal_details (id integer not null, 
first_name char(15),\n
++ last_name char(15), CONSTRAINT pk PRIMARY KEY (id));
+Properties props = new Properties();
+Connection conn = DriverManager.getConnection(getUrl(), props);
+try {
+PreparedStatement stmt = conn.prepareStatement(ddl);
+stmt.execute(ddl);
+conn.createStatement().execute(CREATE INDEX personal_details_idx 
ON personal_details(first_name));
+} catch (TableAlreadyExistsException e) {
+
+} finally {
+conn.close();
+}
+
+conn = DriverManager.getConnection(getUrl(), props);
+try {
+PreparedStatement stmt = conn.prepareStatement(upsert into 
personal_details(id, first_name, 
++ last_name) VALUES (?, ?, ?));
+stmt.setInt(1, 1);
+stmt.setString(2, NAME1);
+stmt.setString(3, LN);
+stmt.execute();
+stmt.setInt(1, 2);
+stmt.setString(2, NAME1);
+stmt.setString(3, LN2);
+stmt.execute();
+stmt.setInt(1, 3);
+stmt.setString(2, NAME2);
+stmt.setString(3, LN3);
+stmt.execute();
+conn.commit();
+
+String query = SELECT COUNT (DISTINCT first_name) FROM 
personal_details;
+PreparedStatement statement = conn.prepareStatement(query);
+ResultSet rs = statement.executeQuery();
+assertTrue(rs.next());
+assertEquals(2, rs.getInt(1));
+} finally {
+conn.close();
+}
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/214a4ccf/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
index 5125340..6872f8a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
@@ -345,7 +345,7 @@ public class ParseNodeFactory {
 if 
(CountAggregateFunction.NAME.equals(SchemaUtil.normalizeIdentifier(name))) {
 BuiltInFunctionInfo info = getInfo(
 
SchemaUtil.normalizeIdentifier(DistinctCountAggregateFunction.NAME), args);
-return new DistinctCountParseNode(name, args, info);
+return new 
DistinctCountParseNode(DistinctCountAggregateFunction.NAME, args, info);
 } else {
 throw new UnsupportedOperationException(DISTINCT not supported 
with  + name);
 }



Apache-Phoenix | 4.0 | Hadoop1 | Build Successful

2014-08-31 Thread Apache Jenkins Server
4.0 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/

Changes
[anoopsamjohn] PHOENIX-1203 Uable to work for count (distinct col) queries via phoenix table with secondary indexes.



Apache-Phoenix | 3.0 | Hadoop1 | Build Successful

2014-08-31 Thread Apache Jenkins Server
3.0 branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git

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

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

Changes
[anoopsamjohn] PHOENIX-1203 Uable to work for count (distinct col) queries via phoenix table with secondary indexes.