phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject phoenix git commit: PHOENIX-1734 Local index improvements(Rajeshbabu)-addendum
Date Wed, 25 May 2016 14:16:22 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master 10909ae50 -> aedf48fab


PHOENIX-1734 Local index improvements(Rajeshbabu)-addendum


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

Branch: refs/heads/master
Commit: aedf48fab4610d979c023515f03606e5d81dea5b
Parents: 10909ae
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Wed May 25 19:51:55 2016 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Wed May 25 19:51:55 2016 +0530

----------------------------------------------------------------------
 .../apache/phoenix/compile/PostLocalIndexDDLCompiler.java    | 8 +++++++-
 .../main/java/org/apache/phoenix/schema/MetaDataClient.java  | 4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/aedf48fa/phoenix-core/src/main/java/org/apache/phoenix/compile/PostLocalIndexDDLCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/PostLocalIndexDDLCompiler.java
b/phoenix-core/src/main/java/org/apache/phoenix/compile/PostLocalIndexDDLCompiler.java
index f92738c..079ff5c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/PostLocalIndexDDLCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/PostLocalIndexDDLCompiler.java
@@ -55,7 +55,7 @@ public class PostLocalIndexDDLCompiler {
         this.tableName = tableName;
     }
 
-	public MutationPlan compile(final PTable index) throws SQLException {
+	public MutationPlan compile(PTable index) throws SQLException {
 		try (final PhoenixStatement statement = new PhoenixStatement(connection)) {
             String query = "SELECT count(*) FROM " + tableName;
             final QueryPlan plan = statement.compileQuery(query);
@@ -64,6 +64,12 @@ public class PostLocalIndexDDLCompiler {
             ImmutableBytesWritable ptr = new ImmutableBytesWritable();
             final PTable dataTable = tableRef.getTable();
             List<PTable> indexes = Lists.newArrayListWithExpectedSize(1);
+            for (PTable indexTable : dataTable.getIndexes()) {
+                if (indexTable.getKey().equals(index.getKey())) {
+                    index = indexTable;
+                    break;
+                }
+            }
             // Only build newly created index.
             indexes.add(index);
             IndexMaintainer.serialize(dataTable, ptr, indexes, plan.getContext().getConnection());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/aedf48fa/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 75b094b..f52fc52 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -2636,14 +2636,14 @@ public class MetaDataClient {
             buf.setCharAt(buf.length() - 1, ')');
             if(tableRefs.get(0).getTable().getIndexType()==IndexType.LOCAL) {
                 buf.append(" AND COLUMN_FAMILY IN(");
-                               if (tableRefs.get(0).getTable().getColumnFamilies().isEmpty())
{
+                if (tableRefs.get(0).getTable().getColumnFamilies().isEmpty()) {
                     buf.append("'" + QueryConstants.DEFAULT_LOCAL_INDEX_COLUMN_FAMILY + "',");
                 } else {
                     for(PColumnFamily cf : tableRefs.get(0).getTable().getColumnFamilies())
{
                         buf.append("'" + cf.getName().getString() + "',");
                     }
                 }
-                   buf.setCharAt(buf.length() - 1, ')');
+                buf.setCharAt(buf.length() - 1, ')');
             }
             conn.createStatement().execute(buf.toString());
             success = true;


Mime
View raw message