cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Remove user types rename for now
Date Thu, 27 Mar 2014 14:14:57 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 62a0222aa -> 07a451ea0


Remove user types rename for now


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

Branch: refs/heads/cassandra-2.1
Commit: 07a451ea0274ab75f4772aef741bf8aa83e86f91
Parents: 62a0222
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu Mar 27 15:14:50 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Mar 27 15:14:50 2014 +0100

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cql3/Cql.g        |  1 -
 .../cql3/statements/AlterTypeStatement.java     | 41 --------------------
 2 files changed, 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/07a451ea/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g b/src/java/org/apache/cassandra/cql3/Cql.g
index cc3b7fe..da8c051 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -632,7 +632,6 @@ alterTypeStatement returns [AlterTypeStatement expr]
     : K_ALTER K_TYPE name=userTypeName
           ( K_ALTER f=cident K_TYPE v=comparatorType { $expr = AlterTypeStatement.alter(name,
f, v); }
           | K_ADD   f=cident v=comparatorType        { $expr = AlterTypeStatement.addition(name,
f, v); }
-          | K_RENAME K_TO new_name=userTypeName      { $expr = AlterTypeStatement.typeRename(name,
new_name); }
           | K_RENAME
                { Map<ColumnIdentifier, ColumnIdentifier> renames = new HashMap<ColumnIdentifier,
ColumnIdentifier>(); }
                  id1=cident K_TO toId1=cident { renames.put(id1, toId1); }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/07a451ea/src/java/org/apache/cassandra/cql3/statements/AlterTypeStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/AlterTypeStatement.java b/src/java/org/apache/cassandra/cql3/statements/AlterTypeStatement.java
index f8731ce..3ea8d63 100644
--- a/src/java/org/apache/cassandra/cql3/statements/AlterTypeStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/AlterTypeStatement.java
@@ -67,11 +67,6 @@ public abstract class AlterTypeStatement extends SchemaAlteringStatement
         return new Renames(name, renames);
     }
 
-    public static AlterTypeStatement typeRename(UTName name, UTName newName)
-    {
-        return new TypeRename(name, newName);
-    }
-
     public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
     {
         state.hasKeyspaceAccess(keyspace(), Permission.ALTER);
@@ -345,40 +340,4 @@ public abstract class AlterTypeStatement extends SchemaAlteringStatement
         }
 
     }
-
-    private static class TypeRename extends AlterTypeStatement
-    {
-        private final UTName newName;
-
-        public TypeRename(UTName name, UTName newName)
-        {
-            super(name);
-            this.newName = newName;
-        }
-
-        @Override
-        public void prepareKeyspace(ClientState state) throws InvalidRequestException
-        {
-            super.prepareKeyspace(state);
-
-            if (!newName.hasKeyspace())
-                newName.setKeyspace(state.getKeyspace());
-
-            if (newName.getKeyspace() == null)
-                throw new InvalidRequestException("You need to be logged in a keyspace or
use a fully qualified user type name");
-        }
-
-        protected UserType makeUpdatedType(UserType toUpdate) throws InvalidRequestException
-        {
-            KSMetaData ksm = Schema.instance.getKSMetaData(newName.getKeyspace());
-            if (ksm == null)
-                throw new InvalidRequestException("Unknown keyspace " + newName.getKeyspace());
-
-            UserType previous = ksm.userTypes.getType(newName.getUserTypeName());
-            if (previous != null)
-                throw new InvalidRequestException(String.format("Cannot rename user type
%s to %s as another type of that name exists", name, newName));
-
-            return new UserType(newName.getKeyspace(), newName.getUserTypeName(), new ArrayList<>(toUpdate.columnNames),
new ArrayList<>(toUpdate.types));
-        }
-    }
 }


Mime
View raw message