git commit: PHOENIX-1249 Support local immutable index

2014-09-30 Thread rajeshbabu
Repository: phoenix
Updated Branches:
  refs/heads/4.0 c0c4bdf10 - 6d91f8c4c


PHOENIX-1249 Support local immutable index


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

Branch: refs/heads/4.0
Commit: 6d91f8c4c27fe0c843412b010529a12195e0be23
Parents: c0c4bdf
Author: Rajeshbabu Chintaguntla rajeshbabu.chintagun...@huawei.com
Authored: Tue Sep 30 07:40:17 2014 +0530
Committer: Rajeshbabu Chintaguntla rajeshbabu.chintagun...@huawei.com
Committed: Tue Sep 30 19:41:54 2014 +0530

--
 .../org/apache/phoenix/end2end/DeleteIT.java|  11 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |  74 --
 .../phoenix/end2end/index/LocalIndexIT.java |  60 +++
 .../apache/phoenix/compile/DeleteCompiler.java  |  13 ++-
 .../hbase/index/covered/IndexUpdate.java|   2 +-
 .../apache/phoenix/index/IndexMaintainer.java   |  55 --
 .../phoenix/index/PhoenixIndexBuilder.java  |  20 +++-
 .../apache/phoenix/index/PhoenixIndexCodec.java | 101 +++
 .../apache/phoenix/schema/MetaDataClient.java   |   3 -
 9 files changed, 255 insertions(+), 84 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6d91f8c4/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
index 337e49b..677fb53 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
@@ -344,6 +344,15 @@ public class DeleteIT extends BaseHBaseManagedTimeIT {
 
 @Test
 public void testDeleteRowFromTableWithImmutableIndex() throws SQLException 
{
+testDeleteRowFromTableWithImmutableIndex(false);
+}
+
+@Test
+public void testDeleteRowFromTableWithImmutableLocalIndex() throws 
SQLException {
+testDeleteRowFromTableWithImmutableIndex(true);
+}
+
+public void testDeleteRowFromTableWithImmutableIndex(boolean localIndex) 
throws SQLException {
 Connection con = null;
 try {
 boolean autoCommit = false;
@@ -360,7 +369,7 @@ public class DeleteIT extends BaseHBaseManagedTimeIT {
 USAGE.DB BIGINT, +
 STATS.ACTIVE_VISITOR INTEGER  +
 CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)) 
IMMUTABLE_ROWS=true);
-stm.execute(CREATE INDEX web_stats_idx ON web_stats (DATE, 
FEATURE));
+stm.execute(CREATE  + (localIndex ? LOCAL : ) +  INDEX 
web_stats_idx ON web_stats (DATE, FEATURE));
 stm.close();
 
 Date date = new Date(0);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6d91f8c4/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
index b522931..c1a50da 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
@@ -113,12 +113,21 @@ public class ImmutableIndexIT extends 
BaseHBaseManagedTimeIT {
 
 @Test
 public void testIndexWithNullableFixedWithCols() throws Exception {
+testIndexWithNullableFixedWithCols(false);
+}
+
+@Test
+public void testLocalIndexWithNullableFixedWithCols() throws Exception {
+testIndexWithNullableFixedWithCols(true);
+}
+
+public void testIndexWithNullableFixedWithCols(boolean localIndex) throws 
Exception {
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 Connection conn = DriverManager.getConnection(getUrl(), props);
 conn.setAutoCommit(false);
 ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
 populateTestTable();
-String ddl = CREATE INDEX IDX ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
+String ddl = CREATE  + (localIndex ? LOCAL : ) +  INDEX IDX ON 
 + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
 +  (char_col1 ASC, int_col1 ASC)
 +  INCLUDE (long_col1, long_col2);
 PreparedStatement stmt = conn.prepareStatement(ddl);
@@ -126,7 +135,13 @@ public class ImmutableIndexIT extends 
BaseHBaseManagedTimeIT {
 
   

git commit: PHOENIX-1249 Support local immutable index

2014-09-29 Thread rajeshbabu
Repository: phoenix
Updated Branches:
  refs/heads/master abd049d88 - f28fb8b7c


PHOENIX-1249 Support local immutable index


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

Branch: refs/heads/master
Commit: f28fb8b7c5075ccb7a522baa58c2b3ab3003dbe7
Parents: abd049d
Author: Rajeshbabu Chintaguntla rajeshbabu.chintagun...@huawei.com
Authored: Tue Sep 30 07:40:17 2014 +0530
Committer: Rajeshbabu Chintaguntla rajeshbabu.chintagun...@huawei.com
Committed: Tue Sep 30 07:40:17 2014 +0530

--
 .../org/apache/phoenix/end2end/DeleteIT.java|  11 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |  74 --
 .../phoenix/end2end/index/LocalIndexIT.java |  60 +++
 .../apache/phoenix/compile/DeleteCompiler.java  |  13 ++-
 .../hbase/index/covered/IndexUpdate.java|   2 +-
 .../apache/phoenix/index/IndexMaintainer.java   |  55 --
 .../phoenix/index/PhoenixIndexBuilder.java  |  20 +++-
 .../apache/phoenix/index/PhoenixIndexCodec.java | 101 +++
 .../apache/phoenix/schema/MetaDataClient.java   |   3 -
 9 files changed, 255 insertions(+), 84 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f28fb8b7/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
index 337e49b..677fb53 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
@@ -344,6 +344,15 @@ public class DeleteIT extends BaseHBaseManagedTimeIT {
 
 @Test
 public void testDeleteRowFromTableWithImmutableIndex() throws SQLException 
{
+testDeleteRowFromTableWithImmutableIndex(false);
+}
+
+@Test
+public void testDeleteRowFromTableWithImmutableLocalIndex() throws 
SQLException {
+testDeleteRowFromTableWithImmutableIndex(true);
+}
+
+public void testDeleteRowFromTableWithImmutableIndex(boolean localIndex) 
throws SQLException {
 Connection con = null;
 try {
 boolean autoCommit = false;
@@ -360,7 +369,7 @@ public class DeleteIT extends BaseHBaseManagedTimeIT {
 USAGE.DB BIGINT, +
 STATS.ACTIVE_VISITOR INTEGER  +
 CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)) 
IMMUTABLE_ROWS=true);
-stm.execute(CREATE INDEX web_stats_idx ON web_stats (DATE, 
FEATURE));
+stm.execute(CREATE  + (localIndex ? LOCAL : ) +  INDEX 
web_stats_idx ON web_stats (DATE, FEATURE));
 stm.close();
 
 Date date = new Date(0);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f28fb8b7/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
index b522931..c1a50da 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java
@@ -113,12 +113,21 @@ public class ImmutableIndexIT extends 
BaseHBaseManagedTimeIT {
 
 @Test
 public void testIndexWithNullableFixedWithCols() throws Exception {
+testIndexWithNullableFixedWithCols(false);
+}
+
+@Test
+public void testLocalIndexWithNullableFixedWithCols() throws Exception {
+testIndexWithNullableFixedWithCols(true);
+}
+
+public void testIndexWithNullableFixedWithCols(boolean localIndex) throws 
Exception {
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 Connection conn = DriverManager.getConnection(getUrl(), props);
 conn.setAutoCommit(false);
 ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
 populateTestTable();
-String ddl = CREATE INDEX IDX ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
+String ddl = CREATE  + (localIndex ? LOCAL : ) +  INDEX IDX ON 
 + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
 +  (char_col1 ASC, int_col1 ASC)
 +  INCLUDE (long_col1, long_col2);
 PreparedStatement stmt = conn.prepareStatement(ddl);
@@ -126,7 +135,13 @@ public class ImmutableIndexIT extends 
BaseHBaseManagedTimeIT {