phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject phoenix git commit: PHOENIX-1484 Index creation failed due to specifying DEFAULT_COLUMN_FAMILY option (James Taylor)
Date Wed, 03 Dec 2014 20:58:07 GMT
Repository: phoenix
Updated Branches:
  refs/heads/3.2 cdcbcf218 -> d09ef63c6


PHOENIX-1484 Index creation failed due to specifying
 DEFAULT_COLUMN_FAMILY option (James Taylor)

Conflicts:
	phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
	phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java

Conflicts:
	phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
	phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
	phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferQueue.java
	phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java


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

Branch: refs/heads/3.2
Commit: d09ef63c6567f20f4d837b7d2b50c1d55b5c44b1
Parents: cdcbcf2
Author: James Taylor <jtaylor@salesforce.com>
Authored: Wed Dec 3 11:13:06 2014 -0800
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Wed Dec 3 12:57:44 2014 -0800

----------------------------------------------------------------------
 .../end2end/BaseTenantSpecificViewIndexIT.java  |  1 -
 .../example/EndToEndCoveredIndexingIT.java      |  1 -
 .../iterate/MappedByteBufferSortedQueue.java    |  6 +++---
 .../apache/phoenix/parse/ParseNodeFactory.java  |  1 -
 .../apache/phoenix/schema/MetaDataClient.java   |  5 ++---
 .../org/apache/phoenix/util/ServerUtil.java     |  1 -
 .../org/apache/phoenix/util/UpgradeUtil.java    |  1 -
 .../phoenix/compile/QueryCompilerTest.java      | 21 ++++++++++++++++++++
 .../apache/phoenix/schema/SaltingUtilTest.java  | 13 ++++++------
 9 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java
index c1e82db..c6a6a7e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java
@@ -115,7 +115,6 @@ public class BaseTenantSpecificViewIndexIT extends BaseHBaseManagedTimeIT
{
         return DriverManager.getConnection(getUrl(), props);
     }
     
-    @SuppressWarnings("unchecked")
     private void verifyViewData(Connection conn, String valuePrefix) throws SQLException
{
         String query = "SELECT k1, k2, v2 FROM v WHERE v2='" + valuePrefix + "v2-1'";
         ResultSet rs = conn.createStatement().executeQuery(query);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
index 88bcb2a..5196031 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
@@ -857,7 +857,6 @@ public class EndToEndCoveredIndexingIT {
 
     // setup the primary table
     String indexedTableName = Bytes.toString(TestTable.getTableName());
-    @SuppressWarnings("deprecation")
     HTableDescriptor pTable = new HTableDescriptor(indexedTableName);
     pTable.addFamily(new HColumnDescriptor(FAM));
     pTable.addFamily(new HColumnDescriptor(FAM2));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
index 7bb25d0..c7102f7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
@@ -34,12 +34,12 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
-
-import com.google.common.collect.MinMaxPriorityQueue;
 import org.apache.phoenix.iterate.OrderedResultIterator.ResultEntry;
 import org.apache.phoenix.schema.tuple.ResultTuple;
 import org.apache.phoenix.schema.tuple.Tuple;
 
+import com.google.common.collect.MinMaxPriorityQueue;
+
 public class MappedByteBufferSortedQueue extends AbstractQueue<ResultEntry> {
     private Comparator<ResultEntry> comparator;
     private final int limit;
@@ -175,7 +175,7 @@ public class MappedByteBufferSortedQueue extends AbstractQueue<ResultEntry>
{
     }
 
     private static class MappedByteBufferPriorityQueue {
-    	// at least create 128 KB MappedByteBuffers
+        // at least create 128 KB MappedByteBuffers
         private static final long DEFAULT_MAPPING_SIZE = 128 * 1024;
         
         private final int limit;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/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 5aaf04d..5c3a40d 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
@@ -63,7 +63,6 @@ import com.google.common.collect.Maps;
 public class ParseNodeFactory {
     private static final String ARRAY_ELEM = "ARRAY_ELEM";
 	// TODO: Use Google's Reflection library instead to find aggregate functions
-    @SuppressWarnings("unchecked")
     private static final List<Class<? extends FunctionExpression>> CLIENT_SIDE_BUILT_IN_FUNCTIONS
= Arrays.<Class<? extends FunctionExpression>>asList(
         CurrentDateFunction.class,
         CurrentTimeFunction.class,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/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 4fa0cb3..053155f 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
@@ -907,7 +907,7 @@ public class MetaDataClient {
                 }
                 // Set DEFAULT_COLUMN_FAMILY_NAME of index to match data table
                 // We need this in the props so that the correct column family is created
-                if (dataTable.getDefaultFamilyName() != null && dataTable.getType()
!= PTableType.VIEW) {
+                if (dataTable.getDefaultFamilyName() != null && dataTable.getType()
!= PTableType.VIEW && viewIndexId == null) {
                     statement.getProps().put("", new Pair<String,Object>(DEFAULT_COLUMN_FAMILY_NAME,dataTable.getDefaultFamilyName().getString()));
                 }
                 CreateTableStatement tableStatement = FACTORY.createTable(indexTableName,
statement.getProps(), columnDefs, pk, statement.getSplitNodes(), PTableType.INDEX, statement.ifNotExists(),
null, null, statement.getBindCount());
@@ -1100,11 +1100,10 @@ public class MetaDataClient {
             }
             
             boolean removedProp = false;
-            // Can't set MULTI_TENANT or DEFAULT_COLUMN_FAMILY_NAME on an index
+            // Can't set MULTI_TENANT or DEFAULT_COLUMN_FAMILY_NAME on an INDEX or a non
mapped VIEW
             if (tableType != PTableType.INDEX && (tableType != PTableType.VIEW ||
viewType == ViewType.MAPPED)) {
                 Boolean multiTenantProp = (Boolean) tableProps.remove(PhoenixDatabaseMetaData.MULTI_TENANT);
                 multiTenant = Boolean.TRUE.equals(multiTenantProp);
-                // Remove, but add back after our check below
                 defaultFamilyName = (String)tableProps.remove(PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME);
 
                 removedProp = (defaultFamilyName != null);
             }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
index bd701a8..8dcf8c5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
@@ -30,7 +30,6 @@ import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 
 
-@SuppressWarnings("deprecation")
 public class ServerUtil {
     private static final String FORMAT = "ERROR %d (%s): %s";
     private static final Pattern PATTERN = Pattern.compile("ERROR (\\d+) \\((\\w+)\\): (.*)");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
index 1e57941..d6251b6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
@@ -86,7 +86,6 @@ public class UpgradeUtil {
         }
     }
 
-    @SuppressWarnings("deprecation")
     private static void copyTable(PhoenixConnection conn, byte[] sourceName, byte[] targetName)
throws SQLException {
         int batchSizeBytes = 100 * 1024; // 100K chunks
         int sizeBytes = 0;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
index 3857736..58d7710 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
@@ -1452,4 +1452,25 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest
{
             assertFalse("Did not expected to find GROUP BY limit optimization in: " + query,
QueryUtil.getExplainPlan(rs).contains(" LIMIT 3 GROUPS"));
         }
     }
+    
+    @Test
+    public void testViewIndexCreationWithDefaultFamilyOption() throws Exception {
+        Connection conn1 = DriverManager.getConnection(getUrl());
+        try{
+            Statement statement = conn1.createStatement();
+            statement.execute("create table example (id integer not null,fn varchar,"
+                    + "ln varchar constraint pk primary key(id)) DEFAULT_COLUMN_FAMILY='F'");
+            statement.execute("create view v as select * from example");
+            try {
+                statement.execute("create index my_idx on v (fn) DEFAULT_COLUMN_FAMILY='F'");
+                fail();
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.VIEW_WITH_PROPERTIES.getErrorCode(),e.getErrorCode());
+            }
+            statement.execute("create index my_idx on v (fn)");
+       } finally {
+            conn1.close();
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d09ef63c/phoenix-core/src/test/java/org/apache/phoenix/schema/SaltingUtilTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/schema/SaltingUtilTest.java b/phoenix-core/src/test/java/org/apache/phoenix/schema/SaltingUtilTest.java
index 9642045..244c813 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/schema/SaltingUtilTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/schema/SaltingUtilTest.java
@@ -17,15 +17,16 @@
  */
 package org.apache.phoenix.schema;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Set;
 
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
 
 public class SaltingUtilTest {
 


Mime
View raw message