cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1022631 - in /cassandra/trunk: CHANGES.txt src/java/org/apache/cassandra/cli/CliClient.java
Date Thu, 14 Oct 2010 18:02:20 GMT
Author: jbellis
Date: Thu Oct 14 18:02:19 2010
New Revision: 1022631

URL: http://svn.apache.org/viewvc?rev=1022631&view=rev
Log:
include CF metadata in cli 'show keyspaces'.  patch by Pavel Yaskevich; reviewed by jbellis
for CASSANDRA-1613

Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1022631&r1=1022630&r2=1022631&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Thu Oct 14 18:02:19 2010
@@ -33,6 +33,7 @@ dev
  * removed IClock & related classes from internals (CASSANDRA-1502)
  * fix removing tokens from SystemTable on decommission and removetoken
    (CASSANDRA-1609)
+ * include CF metadata in cli 'show keyspaces' (CASSANDRA-1613)
 
 
 0.7-beta2

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1022631&r1=1022630&r2=1022631&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Thu Oct 14 18:02:19 2010
@@ -1177,34 +1177,46 @@ public class CliClient 
 
     private void describeTableInternal(String tableName, KsDef metadata) throws TException
{
         // Describe and display
-        css_.out.println("Keyspace: " + tableName);
+        css_.out.println("Keyspace: " + tableName + ":");
         try
         {
             KsDef ks_def;
-            if (metadata != null) {
-                ks_def = metadata;
-            }
-            else {
-                ks_def = thriftClient_.describe_keyspace(tableName);
-            }
+            ks_def = metadata == null ? thriftClient_.describe_keyspace(tableName) : metadata;
             css_.out.println("  Replication Factor: " + ks_def.replication_factor);
             css_.out.println("  Column Families:");
 
             for (CfDef cf_def : ks_def.cf_defs)
             {
-                /**
-                String desc = columnMap.get("Desc");
-                String columnFamilyType = columnMap.get("Type");
-                String sort = columnMap.get("CompareWith");
-                String flushperiod = columnMap.get("FlushPeriodInMinutes");
-                css_.out.println(desc);
-                 */
-                //css_.out.println("description");
-                css_.out.println("    Column Family Name: " + cf_def.name + " {");
+                css_.out.println("    Column Family Name: " + cf_def.name);
                 css_.out.println("      Column Family Type: " + cf_def.column_type);
                 css_.out.println("      Column Sorted By: " + cf_def.comparator_type);
-                //css_.out.println("      flush period: " + flushperiod + " minutes");
-                css_.out.println("    }");
+
+                if (cf_def.getColumn_metadataSize() != 0)
+                {
+                    String leftSpace = "      ";
+                    String columnLeftSpace = leftSpace + "    ";
+
+                    AbstractType columnNameValidator = getFormatTypeForColumn(cf_def.comparator_type);
+
+                    css_.out.println(leftSpace + "Column Metadata:");
+                    for (ColumnDef columnDef : cf_def.getColumn_metadata())
+                    {
+                        String columnName = columnNameValidator.getString(columnDef.getName());
+
+                        css_.out.println(leftSpace + "  Column Name: " + columnName);
+                        css_.out.println(columnLeftSpace + "Validation Class: " + columnDef.getValidation_class());
+
+                        if (columnDef.isSetIndex_name())
+                        {
+                            css_.out.println(columnLeftSpace + "Index Name: " + columnDef.getIndex_name());
+                        }
+
+                        if (columnDef.isSetIndex_type())
+                        {
+                            css_.out.println(columnLeftSpace + "Index Type: " + columnDef.getIndex_type().name());
+                        }
+                    }
+                }
             }
         }
         catch (InvalidRequestException e)



Mime
View raw message