cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r802640 [3/4] - in /incubator/cassandra/trunk: interface/ interface/gen-java/org/apache/cassandra/service/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/filter/ src/java/org/apache/cas...
Date Mon, 10 Aug 2009 02:51:36 GMT
Copied: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnOrSuperColumn.java (from r802639, incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java)
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnOrSuperColumn.java?p2=incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnOrSuperColumn.java&p1=incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java&r1=802639&r2=802640&rev=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnOrSuperColumn.java Mon Aug 10 02:51:35 2009
@@ -18,100 +18,88 @@
 import org.apache.thrift.meta_data.*;
 import org.apache.thrift.protocol.*;
 
-public class ColumnPathOrParent implements TBase, java.io.Serializable, Cloneable {
-  private static final TStruct STRUCT_DESC = new TStruct("ColumnPathOrParent");
-  private static final TField COLUMN_FAMILY_FIELD_DESC = new TField("column_family", TType.STRING, (short)3);
-  private static final TField SUPER_COLUMN_FIELD_DESC = new TField("super_column", TType.STRING, (short)4);
-  private static final TField COLUMN_FIELD_DESC = new TField("column", TType.STRING, (short)5);
-
-  public String column_family;
-  public static final int COLUMN_FAMILY = 3;
-  public byte[] super_column;
-  public static final int SUPER_COLUMN = 4;
-  public byte[] column;
-  public static final int COLUMN = 5;
+public class ColumnOrSuperColumn implements TBase, java.io.Serializable, Cloneable {
+  private static final TStruct STRUCT_DESC = new TStruct("ColumnOrSuperColumn");
+  private static final TField COLUMN_FIELD_DESC = new TField("column", TType.STRUCT, (short)1);
+  private static final TField SUPER_COLUMN_FIELD_DESC = new TField("super_column", TType.STRUCT, (short)2);
+
+  public Column column;
+  public static final int COLUMN = 1;
+  public SuperColumn super_column;
+  public static final int SUPER_COLUMN = 2;
 
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
   }
 
   public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(COLUMN_FAMILY, new FieldMetaData("column_family", TFieldRequirementType.DEFAULT, 
-        new FieldValueMetaData(TType.STRING)));
-    put(SUPER_COLUMN, new FieldMetaData("super_column", TFieldRequirementType.OPTIONAL, 
-        new FieldValueMetaData(TType.STRING)));
     put(COLUMN, new FieldMetaData("column", TFieldRequirementType.OPTIONAL, 
-        new FieldValueMetaData(TType.STRING)));
+        new StructMetaData(TType.STRUCT, Column.class)));
+    put(SUPER_COLUMN, new FieldMetaData("super_column", TFieldRequirementType.OPTIONAL, 
+        new StructMetaData(TType.STRUCT, SuperColumn.class)));
   }});
 
   static {
-    FieldMetaData.addStructMetaDataMap(ColumnPathOrParent.class, metaDataMap);
+    FieldMetaData.addStructMetaDataMap(ColumnOrSuperColumn.class, metaDataMap);
   }
 
-  public ColumnPathOrParent() {
+  public ColumnOrSuperColumn() {
   }
 
-  public ColumnPathOrParent(
-    String column_family,
-    byte[] super_column,
-    byte[] column)
+  public ColumnOrSuperColumn(
+    Column column,
+    SuperColumn super_column)
   {
     this();
-    this.column_family = column_family;
-    this.super_column = super_column;
     this.column = column;
+    this.super_column = super_column;
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
-  public ColumnPathOrParent(ColumnPathOrParent other) {
-    if (other.isSetColumn_family()) {
-      this.column_family = other.column_family;
+  public ColumnOrSuperColumn(ColumnOrSuperColumn other) {
+    if (other.isSetColumn()) {
+      this.column = new Column(other.column);
     }
     if (other.isSetSuper_column()) {
-      this.super_column = new byte[other.super_column.length];
-      System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
-    }
-    if (other.isSetColumn()) {
-      this.column = new byte[other.column.length];
-      System.arraycopy(other.column, 0, column, 0, other.column.length);
+      this.super_column = new SuperColumn(other.super_column);
     }
   }
 
   @Override
-  public ColumnPathOrParent clone() {
-    return new ColumnPathOrParent(this);
+  public ColumnOrSuperColumn clone() {
+    return new ColumnOrSuperColumn(this);
   }
 
-  public String getColumn_family() {
-    return this.column_family;
+  public Column getColumn() {
+    return this.column;
   }
 
-  public void setColumn_family(String column_family) {
-    this.column_family = column_family;
+  public void setColumn(Column column) {
+    this.column = column;
   }
 
-  public void unsetColumn_family() {
-    this.column_family = null;
+  public void unsetColumn() {
+    this.column = null;
   }
 
-  // Returns true if field column_family is set (has been asigned a value) and false otherwise
-  public boolean isSetColumn_family() {
-    return this.column_family != null;
+  // Returns true if field column is set (has been asigned a value) and false otherwise
+  public boolean isSetColumn() {
+    return this.column != null;
   }
 
-  public void setColumn_familyIsSet(boolean value) {
+  public void setColumnIsSet(boolean value) {
     if (!value) {
-      this.column_family = null;
+      this.column = null;
     }
   }
 
-  public byte[] getSuper_column() {
+  public SuperColumn getSuper_column() {
     return this.super_column;
   }
 
-  public void setSuper_column(byte[] super_column) {
+  public void setSuper_column(SuperColumn super_column) {
     this.super_column = super_column;
   }
 
@@ -130,36 +118,13 @@
     }
   }
 
-  public byte[] getColumn() {
-    return this.column;
-  }
-
-  public void setColumn(byte[] column) {
-    this.column = column;
-  }
-
-  public void unsetColumn() {
-    this.column = null;
-  }
-
-  // Returns true if field column is set (has been asigned a value) and false otherwise
-  public boolean isSetColumn() {
-    return this.column != null;
-  }
-
-  public void setColumnIsSet(boolean value) {
-    if (!value) {
-      this.column = null;
-    }
-  }
-
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
-    case COLUMN_FAMILY:
+    case COLUMN:
       if (value == null) {
-        unsetColumn_family();
+        unsetColumn();
       } else {
-        setColumn_family((String)value);
+        setColumn((Column)value);
       }
       break;
 
@@ -167,15 +132,7 @@
       if (value == null) {
         unsetSuper_column();
       } else {
-        setSuper_column((byte[])value);
-      }
-      break;
-
-    case COLUMN:
-      if (value == null) {
-        unsetColumn();
-      } else {
-        setColumn((byte[])value);
+        setSuper_column((SuperColumn)value);
       }
       break;
 
@@ -186,15 +143,12 @@
 
   public Object getFieldValue(int fieldID) {
     switch (fieldID) {
-    case COLUMN_FAMILY:
-      return getColumn_family();
+    case COLUMN:
+      return getColumn();
 
     case SUPER_COLUMN:
       return getSuper_column();
 
-    case COLUMN:
-      return getColumn();
-
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -203,12 +157,10 @@
   // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
   public boolean isSet(int fieldID) {
     switch (fieldID) {
-    case COLUMN_FAMILY:
-      return isSetColumn_family();
-    case SUPER_COLUMN:
-      return isSetSuper_column();
     case COLUMN:
       return isSetColumn();
+    case SUPER_COLUMN:
+      return isSetSuper_column();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -218,21 +170,21 @@
   public boolean equals(Object that) {
     if (that == null)
       return false;
-    if (that instanceof ColumnPathOrParent)
-      return this.equals((ColumnPathOrParent)that);
+    if (that instanceof ColumnOrSuperColumn)
+      return this.equals((ColumnOrSuperColumn)that);
     return false;
   }
 
-  public boolean equals(ColumnPathOrParent that) {
+  public boolean equals(ColumnOrSuperColumn that) {
     if (that == null)
       return false;
 
-    boolean this_present_column_family = true && this.isSetColumn_family();
-    boolean that_present_column_family = true && that.isSetColumn_family();
-    if (this_present_column_family || that_present_column_family) {
-      if (!(this_present_column_family && that_present_column_family))
+    boolean this_present_column = true && this.isSetColumn();
+    boolean that_present_column = true && that.isSetColumn();
+    if (this_present_column || that_present_column) {
+      if (!(this_present_column && that_present_column))
         return false;
-      if (!this.column_family.equals(that.column_family))
+      if (!this.column.equals(that.column))
         return false;
     }
 
@@ -241,16 +193,7 @@
     if (this_present_super_column || that_present_super_column) {
       if (!(this_present_super_column && that_present_super_column))
         return false;
-      if (!java.util.Arrays.equals(this.super_column, that.super_column))
-        return false;
-    }
-
-    boolean this_present_column = true && this.isSetColumn();
-    boolean that_present_column = true && that.isSetColumn();
-    if (this_present_column || that_present_column) {
-      if (!(this_present_column && that_present_column))
-        return false;
-      if (!java.util.Arrays.equals(this.column, that.column))
+      if (!this.super_column.equals(that.super_column))
         return false;
     }
 
@@ -273,23 +216,18 @@
       }
       switch (field.id)
       {
-        case COLUMN_FAMILY:
-          if (field.type == TType.STRING) {
-            this.column_family = iprot.readString();
+        case COLUMN:
+          if (field.type == TType.STRUCT) {
+            this.column = new Column();
+            this.column.read(iprot);
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
         case SUPER_COLUMN:
-          if (field.type == TType.STRING) {
-            this.super_column = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case COLUMN:
-          if (field.type == TType.STRING) {
-            this.column = iprot.readBinary();
+          if (field.type == TType.STRUCT) {
+            this.super_column = new SuperColumn();
+            this.super_column.read(iprot);
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -311,19 +249,14 @@
     validate();
 
     oprot.writeStructBegin(STRUCT_DESC);
-    if (this.column_family != null) {
-      oprot.writeFieldBegin(COLUMN_FAMILY_FIELD_DESC);
-      oprot.writeString(this.column_family);
+    if (this.column != null) {
+      oprot.writeFieldBegin(COLUMN_FIELD_DESC);
+      this.column.write(oprot);
       oprot.writeFieldEnd();
     }
     if (this.super_column != null) {
       oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
-      oprot.writeBinary(this.super_column);
-      oprot.writeFieldEnd();
-    }
-    if (this.column != null) {
-      oprot.writeFieldBegin(COLUMN_FIELD_DESC);
-      oprot.writeBinary(this.column);
+      this.super_column.write(oprot);
       oprot.writeFieldEnd();
     }
     oprot.writeFieldStop();
@@ -332,43 +265,25 @@
 
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder("ColumnPathOrParent(");
+    StringBuilder sb = new StringBuilder("ColumnOrSuperColumn(");
     boolean first = true;
 
-    sb.append("column_family:");
-    if (this.column_family == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.column_family);
-    }
-    first = false;
-    if (isSetSuper_column()) {
-      if (!first) sb.append(", ");
-      sb.append("super_column:");
-      if (this.super_column == null) {
+    if (isSetColumn()) {
+      sb.append("column:");
+      if (this.column == null) {
         sb.append("null");
       } else {
-          int __super_column_size = Math.min(this.super_column.length, 128);
-          for (int i = 0; i < __super_column_size; i++) {
-            if (i != 0) sb.append(" ");
-            sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
-          }
-          if (this.super_column.length > 128) sb.append(" ...");
+        sb.append(this.column);
       }
       first = false;
     }
-    if (isSetColumn()) {
+    if (isSetSuper_column()) {
       if (!first) sb.append(", ");
-      sb.append("column:");
-      if (this.column == null) {
+      sb.append("super_column:");
+      if (this.super_column == null) {
         sb.append("null");
       } else {
-          int __column_size = Math.min(this.column.length, 128);
-          for (int i = 0; i < __column_size; i++) {
-            if (i != 0) sb.append(" ");
-            sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
-          }
-          if (this.column.length > 128) sb.append(" ...");
+        sb.append(this.super_column);
       }
       first = false;
     }

Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java Mon Aug 10 02:51:35 2009
@@ -40,7 +40,7 @@
         new FieldValueMetaData(TType.STRING)));
     put(SUPER_COLUMN, new FieldMetaData("super_column", TFieldRequirementType.OPTIONAL, 
         new FieldValueMetaData(TType.STRING)));
-    put(COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT, 
+    put(COLUMN, new FieldMetaData("column", TFieldRequirementType.OPTIONAL, 
         new FieldValueMetaData(TType.STRING)));
   }});
 
@@ -357,19 +357,21 @@
       }
       first = false;
     }
-    if (!first) sb.append(", ");
-    sb.append("column:");
-    if (this.column == null) {
-      sb.append("null");
-    } else {
-        int __column_size = Math.min(this.column.length, 128);
-        for (int i = 0; i < __column_size; i++) {
-          if (i != 0) sb.append(" ");
-          sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
-        }
-        if (this.column.length > 128) sb.append(" ...");
+    if (isSetColumn()) {
+      if (!first) sb.append(", ");
+      sb.append("column:");
+      if (this.column == null) {
+        sb.append("null");
+      } else {
+          int __column_size = Math.min(this.column.length, 128);
+          for (int i = 0; i < __column_size; i++) {
+            if (i != 0) sb.append(" ");
+            sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
+          }
+          if (this.column.length > 128) sb.append(" ...");
+      }
+      first = false;
     }
-    first = false;
     sb.append(")");
     return sb.toString();
   }

Added: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java?rev=802640&view=auto
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java (added)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java Mon Aug 10 02:51:35 2009
@@ -0,0 +1,337 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package org.apache.cassandra.service;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import org.apache.log4j.Logger;
+
+import org.apache.thrift.*;
+import org.apache.thrift.meta_data.*;
+import org.apache.thrift.protocol.*;
+
+public class SlicePredicate implements TBase, java.io.Serializable, Cloneable {
+  private static final TStruct STRUCT_DESC = new TStruct("SlicePredicate");
+  private static final TField COLUMN_NAMES_FIELD_DESC = new TField("column_names", TType.LIST, (short)1);
+  private static final TField SLICE_RANGE_FIELD_DESC = new TField("slice_range", TType.STRUCT, (short)2);
+
+  public List<byte[]> column_names;
+  public static final int COLUMN_NAMES = 1;
+  public SliceRange slice_range;
+  public static final int SLICE_RANGE = 2;
+
+  private final Isset __isset = new Isset();
+  private static final class Isset implements java.io.Serializable {
+  }
+
+  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+    put(COLUMN_NAMES, new FieldMetaData("column_names", TFieldRequirementType.OPTIONAL, 
+        new ListMetaData(TType.LIST, 
+            new FieldValueMetaData(TType.STRING))));
+    put(SLICE_RANGE, new FieldMetaData("slice_range", TFieldRequirementType.OPTIONAL, 
+        new StructMetaData(TType.STRUCT, SliceRange.class)));
+  }});
+
+  static {
+    FieldMetaData.addStructMetaDataMap(SlicePredicate.class, metaDataMap);
+  }
+
+  public SlicePredicate() {
+  }
+
+  public SlicePredicate(
+    List<byte[]> column_names,
+    SliceRange slice_range)
+  {
+    this();
+    this.column_names = column_names;
+    this.slice_range = slice_range;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public SlicePredicate(SlicePredicate other) {
+    if (other.isSetColumn_names()) {
+      List<byte[]> __this__column_names = new ArrayList<byte[]>();
+      for (byte[] other_element : other.column_names) {
+        byte[] temp_binary_element = new byte[other_element.length];
+        System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
+        __this__column_names.add(temp_binary_element);
+      }
+      this.column_names = __this__column_names;
+    }
+    if (other.isSetSlice_range()) {
+      this.slice_range = new SliceRange(other.slice_range);
+    }
+  }
+
+  @Override
+  public SlicePredicate clone() {
+    return new SlicePredicate(this);
+  }
+
+  public int getColumn_namesSize() {
+    return (this.column_names == null) ? 0 : this.column_names.size();
+  }
+
+  public java.util.Iterator<byte[]> getColumn_namesIterator() {
+    return (this.column_names == null) ? null : this.column_names.iterator();
+  }
+
+  public void addToColumn_names(byte[] elem) {
+    if (this.column_names == null) {
+      this.column_names = new ArrayList<byte[]>();
+    }
+    this.column_names.add(elem);
+  }
+
+  public List<byte[]> getColumn_names() {
+    return this.column_names;
+  }
+
+  public void setColumn_names(List<byte[]> column_names) {
+    this.column_names = column_names;
+  }
+
+  public void unsetColumn_names() {
+    this.column_names = null;
+  }
+
+  // Returns true if field column_names is set (has been asigned a value) and false otherwise
+  public boolean isSetColumn_names() {
+    return this.column_names != null;
+  }
+
+  public void setColumn_namesIsSet(boolean value) {
+    if (!value) {
+      this.column_names = null;
+    }
+  }
+
+  public SliceRange getSlice_range() {
+    return this.slice_range;
+  }
+
+  public void setSlice_range(SliceRange slice_range) {
+    this.slice_range = slice_range;
+  }
+
+  public void unsetSlice_range() {
+    this.slice_range = null;
+  }
+
+  // Returns true if field slice_range is set (has been asigned a value) and false otherwise
+  public boolean isSetSlice_range() {
+    return this.slice_range != null;
+  }
+
+  public void setSlice_rangeIsSet(boolean value) {
+    if (!value) {
+      this.slice_range = null;
+    }
+  }
+
+  public void setFieldValue(int fieldID, Object value) {
+    switch (fieldID) {
+    case COLUMN_NAMES:
+      if (value == null) {
+        unsetColumn_names();
+      } else {
+        setColumn_names((List<byte[]>)value);
+      }
+      break;
+
+    case SLICE_RANGE:
+      if (value == null) {
+        unsetSlice_range();
+      } else {
+        setSlice_range((SliceRange)value);
+      }
+      break;
+
+    default:
+      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+    }
+  }
+
+  public Object getFieldValue(int fieldID) {
+    switch (fieldID) {
+    case COLUMN_NAMES:
+      return getColumn_names();
+
+    case SLICE_RANGE:
+      return getSlice_range();
+
+    default:
+      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+    }
+  }
+
+  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+  public boolean isSet(int fieldID) {
+    switch (fieldID) {
+    case COLUMN_NAMES:
+      return isSetColumn_names();
+    case SLICE_RANGE:
+      return isSetSlice_range();
+    default:
+      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+    }
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof SlicePredicate)
+      return this.equals((SlicePredicate)that);
+    return false;
+  }
+
+  public boolean equals(SlicePredicate that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_column_names = true && this.isSetColumn_names();
+    boolean that_present_column_names = true && that.isSetColumn_names();
+    if (this_present_column_names || that_present_column_names) {
+      if (!(this_present_column_names && that_present_column_names))
+        return false;
+      if (!this.column_names.equals(that.column_names))
+        return false;
+    }
+
+    boolean this_present_slice_range = true && this.isSetSlice_range();
+    boolean that_present_slice_range = true && that.isSetSlice_range();
+    if (this_present_slice_range || that_present_slice_range) {
+      if (!(this_present_slice_range && that_present_slice_range))
+        return false;
+      if (!this.slice_range.equals(that.slice_range))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public void read(TProtocol iprot) throws TException {
+    TField field;
+    iprot.readStructBegin();
+    while (true)
+    {
+      field = iprot.readFieldBegin();
+      if (field.type == TType.STOP) { 
+        break;
+      }
+      switch (field.id)
+      {
+        case COLUMN_NAMES:
+          if (field.type == TType.LIST) {
+            {
+              TList _list31 = iprot.readListBegin();
+              this.column_names = new ArrayList<byte[]>(_list31.size);
+              for (int _i32 = 0; _i32 < _list31.size; ++_i32)
+              {
+                byte[] _elem33;
+                _elem33 = iprot.readBinary();
+                this.column_names.add(_elem33);
+              }
+              iprot.readListEnd();
+            }
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        case SLICE_RANGE:
+          if (field.type == TType.STRUCT) {
+            this.slice_range = new SliceRange();
+            this.slice_range.read(iprot);
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        default:
+          TProtocolUtil.skip(iprot, field.type);
+          break;
+      }
+      iprot.readFieldEnd();
+    }
+    iprot.readStructEnd();
+
+
+    // check for required fields of primitive type, which can't be checked in the validate method
+    validate();
+  }
+
+  public void write(TProtocol oprot) throws TException {
+    validate();
+
+    oprot.writeStructBegin(STRUCT_DESC);
+    if (this.column_names != null) {
+      oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
+      {
+        oprot.writeListBegin(new TList(TType.STRING, this.column_names.size()));
+        for (byte[] _iter34 : this.column_names)        {
+          oprot.writeBinary(_iter34);
+        }
+        oprot.writeListEnd();
+      }
+      oprot.writeFieldEnd();
+    }
+    if (this.slice_range != null) {
+      oprot.writeFieldBegin(SLICE_RANGE_FIELD_DESC);
+      this.slice_range.write(oprot);
+      oprot.writeFieldEnd();
+    }
+    oprot.writeFieldStop();
+    oprot.writeStructEnd();
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("SlicePredicate(");
+    boolean first = true;
+
+    if (isSetColumn_names()) {
+      sb.append("column_names:");
+      if (this.column_names == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.column_names);
+      }
+      first = false;
+    }
+    if (isSetSlice_range()) {
+      if (!first) sb.append(", ");
+      sb.append("slice_range:");
+      if (this.slice_range == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.slice_range);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws TException {
+    // check for required fields
+    // check that fields of type enum have valid values
+  }
+
+}
+

Added: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SliceRange.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SliceRange.java?rev=802640&view=auto
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SliceRange.java (added)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SliceRange.java Mon Aug 10 02:51:35 2009
@@ -0,0 +1,450 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package org.apache.cassandra.service;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import org.apache.log4j.Logger;
+
+import org.apache.thrift.*;
+import org.apache.thrift.meta_data.*;
+import org.apache.thrift.protocol.*;
+
+public class SliceRange implements TBase, java.io.Serializable, Cloneable {
+  private static final TStruct STRUCT_DESC = new TStruct("SliceRange");
+  private static final TField START_FIELD_DESC = new TField("start", TType.STRING, (short)1);
+  private static final TField FINISH_FIELD_DESC = new TField("finish", TType.STRING, (short)2);
+  private static final TField IS_ASCENDING_FIELD_DESC = new TField("is_ascending", TType.BOOL, (short)3);
+  private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)4);
+
+  public byte[] start;
+  public static final int START = 1;
+  public byte[] finish;
+  public static final int FINISH = 2;
+  public boolean is_ascending;
+  public static final int IS_ASCENDING = 3;
+  public int count;
+  public static final int COUNT = 4;
+
+  private final Isset __isset = new Isset();
+  private static final class Isset implements java.io.Serializable {
+    public boolean is_ascending = false;
+    public boolean count = false;
+  }
+
+  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+    put(START, new FieldMetaData("start", TFieldRequirementType.DEFAULT, 
+        new FieldValueMetaData(TType.STRING)));
+    put(FINISH, new FieldMetaData("finish", TFieldRequirementType.DEFAULT, 
+        new FieldValueMetaData(TType.STRING)));
+    put(IS_ASCENDING, new FieldMetaData("is_ascending", TFieldRequirementType.DEFAULT, 
+        new FieldValueMetaData(TType.BOOL)));
+    put(COUNT, new FieldMetaData("count", TFieldRequirementType.DEFAULT, 
+        new FieldValueMetaData(TType.I32)));
+  }});
+
+  static {
+    FieldMetaData.addStructMetaDataMap(SliceRange.class, metaDataMap);
+  }
+
+  public SliceRange() {
+    this.is_ascending = true;
+
+    this.count = 100;
+
+  }
+
+  public SliceRange(
+    byte[] start,
+    byte[] finish,
+    boolean is_ascending,
+    int count)
+  {
+    this();
+    this.start = start;
+    this.finish = finish;
+    this.is_ascending = is_ascending;
+    this.__isset.is_ascending = true;
+    this.count = count;
+    this.__isset.count = true;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public SliceRange(SliceRange other) {
+    if (other.isSetStart()) {
+      this.start = new byte[other.start.length];
+      System.arraycopy(other.start, 0, start, 0, other.start.length);
+    }
+    if (other.isSetFinish()) {
+      this.finish = new byte[other.finish.length];
+      System.arraycopy(other.finish, 0, finish, 0, other.finish.length);
+    }
+    __isset.is_ascending = other.__isset.is_ascending;
+    this.is_ascending = other.is_ascending;
+    __isset.count = other.__isset.count;
+    this.count = other.count;
+  }
+
+  @Override
+  public SliceRange clone() {
+    return new SliceRange(this);
+  }
+
+  public byte[] getStart() {
+    return this.start;
+  }
+
+  public void setStart(byte[] start) {
+    this.start = start;
+  }
+
+  public void unsetStart() {
+    this.start = null;
+  }
+
+  // Returns true if field start is set (has been asigned a value) and false otherwise
+  public boolean isSetStart() {
+    return this.start != null;
+  }
+
+  public void setStartIsSet(boolean value) {
+    if (!value) {
+      this.start = null;
+    }
+  }
+
+  public byte[] getFinish() {
+    return this.finish;
+  }
+
+  public void setFinish(byte[] finish) {
+    this.finish = finish;
+  }
+
+  public void unsetFinish() {
+    this.finish = null;
+  }
+
+  // Returns true if field finish is set (has been asigned a value) and false otherwise
+  public boolean isSetFinish() {
+    return this.finish != null;
+  }
+
+  public void setFinishIsSet(boolean value) {
+    if (!value) {
+      this.finish = null;
+    }
+  }
+
+  public boolean isIs_ascending() {
+    return this.is_ascending;
+  }
+
+  public void setIs_ascending(boolean is_ascending) {
+    this.is_ascending = is_ascending;
+    this.__isset.is_ascending = true;
+  }
+
+  public void unsetIs_ascending() {
+    this.__isset.is_ascending = false;
+  }
+
+  // Returns true if field is_ascending is set (has been asigned a value) and false otherwise
+  public boolean isSetIs_ascending() {
+    return this.__isset.is_ascending;
+  }
+
+  public void setIs_ascendingIsSet(boolean value) {
+    this.__isset.is_ascending = value;
+  }
+
+  public int getCount() {
+    return this.count;
+  }
+
+  public void setCount(int count) {
+    this.count = count;
+    this.__isset.count = true;
+  }
+
+  public void unsetCount() {
+    this.__isset.count = false;
+  }
+
+  // Returns true if field count is set (has been asigned a value) and false otherwise
+  public boolean isSetCount() {
+    return this.__isset.count;
+  }
+
+  public void setCountIsSet(boolean value) {
+    this.__isset.count = value;
+  }
+
+  public void setFieldValue(int fieldID, Object value) {
+    switch (fieldID) {
+    case START:
+      if (value == null) {
+        unsetStart();
+      } else {
+        setStart((byte[])value);
+      }
+      break;
+
+    case FINISH:
+      if (value == null) {
+        unsetFinish();
+      } else {
+        setFinish((byte[])value);
+      }
+      break;
+
+    case IS_ASCENDING:
+      if (value == null) {
+        unsetIs_ascending();
+      } else {
+        setIs_ascending((Boolean)value);
+      }
+      break;
+
+    case COUNT:
+      if (value == null) {
+        unsetCount();
+      } else {
+        setCount((Integer)value);
+      }
+      break;
+
+    default:
+      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+    }
+  }
+
+  public Object getFieldValue(int fieldID) {
+    switch (fieldID) {
+    case START:
+      return getStart();
+
+    case FINISH:
+      return getFinish();
+
+    case IS_ASCENDING:
+      return new Boolean(isIs_ascending());
+
+    case COUNT:
+      return new Integer(getCount());
+
+    default:
+      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+    }
+  }
+
+  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+  public boolean isSet(int fieldID) {
+    switch (fieldID) {
+    case START:
+      return isSetStart();
+    case FINISH:
+      return isSetFinish();
+    case IS_ASCENDING:
+      return isSetIs_ascending();
+    case COUNT:
+      return isSetCount();
+    default:
+      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+    }
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof SliceRange)
+      return this.equals((SliceRange)that);
+    return false;
+  }
+
+  public boolean equals(SliceRange that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_start = true && this.isSetStart();
+    boolean that_present_start = true && that.isSetStart();
+    if (this_present_start || that_present_start) {
+      if (!(this_present_start && that_present_start))
+        return false;
+      if (!java.util.Arrays.equals(this.start, that.start))
+        return false;
+    }
+
+    boolean this_present_finish = true && this.isSetFinish();
+    boolean that_present_finish = true && that.isSetFinish();
+    if (this_present_finish || that_present_finish) {
+      if (!(this_present_finish && that_present_finish))
+        return false;
+      if (!java.util.Arrays.equals(this.finish, that.finish))
+        return false;
+    }
+
+    boolean this_present_is_ascending = true;
+    boolean that_present_is_ascending = true;
+    if (this_present_is_ascending || that_present_is_ascending) {
+      if (!(this_present_is_ascending && that_present_is_ascending))
+        return false;
+      if (this.is_ascending != that.is_ascending)
+        return false;
+    }
+
+    boolean this_present_count = true;
+    boolean that_present_count = true;
+    if (this_present_count || that_present_count) {
+      if (!(this_present_count && that_present_count))
+        return false;
+      if (this.count != that.count)
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public void read(TProtocol iprot) throws TException {
+    TField field;
+    iprot.readStructBegin();
+    while (true)
+    {
+      field = iprot.readFieldBegin();
+      if (field.type == TType.STOP) { 
+        break;
+      }
+      switch (field.id)
+      {
+        case START:
+          if (field.type == TType.STRING) {
+            this.start = iprot.readBinary();
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        case FINISH:
+          if (field.type == TType.STRING) {
+            this.finish = iprot.readBinary();
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        case IS_ASCENDING:
+          if (field.type == TType.BOOL) {
+            this.is_ascending = iprot.readBool();
+            this.__isset.is_ascending = true;
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        case COUNT:
+          if (field.type == TType.I32) {
+            this.count = iprot.readI32();
+            this.__isset.count = true;
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        default:
+          TProtocolUtil.skip(iprot, field.type);
+          break;
+      }
+      iprot.readFieldEnd();
+    }
+    iprot.readStructEnd();
+
+
+    // check for required fields of primitive type, which can't be checked in the validate method
+    validate();
+  }
+
+  public void write(TProtocol oprot) throws TException {
+    validate();
+
+    oprot.writeStructBegin(STRUCT_DESC);
+    if (this.start != null) {
+      oprot.writeFieldBegin(START_FIELD_DESC);
+      oprot.writeBinary(this.start);
+      oprot.writeFieldEnd();
+    }
+    if (this.finish != null) {
+      oprot.writeFieldBegin(FINISH_FIELD_DESC);
+      oprot.writeBinary(this.finish);
+      oprot.writeFieldEnd();
+    }
+    oprot.writeFieldBegin(IS_ASCENDING_FIELD_DESC);
+    oprot.writeBool(this.is_ascending);
+    oprot.writeFieldEnd();
+    oprot.writeFieldBegin(COUNT_FIELD_DESC);
+    oprot.writeI32(this.count);
+    oprot.writeFieldEnd();
+    oprot.writeFieldStop();
+    oprot.writeStructEnd();
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("SliceRange(");
+    boolean first = true;
+
+    sb.append("start:");
+    if (this.start == null) {
+      sb.append("null");
+    } else {
+        int __start_size = Math.min(this.start.length, 128);
+        for (int i = 0; i < __start_size; i++) {
+          if (i != 0) sb.append(" ");
+          sb.append(Integer.toHexString(this.start[i]).length() > 1 ? Integer.toHexString(this.start[i]).substring(Integer.toHexString(this.start[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start[i]).toUpperCase());
+        }
+        if (this.start.length > 128) sb.append(" ...");
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("finish:");
+    if (this.finish == null) {
+      sb.append("null");
+    } else {
+        int __finish_size = Math.min(this.finish.length, 128);
+        for (int i = 0; i < __finish_size; i++) {
+          if (i != 0) sb.append(" ");
+          sb.append(Integer.toHexString(this.finish[i]).length() > 1 ? Integer.toHexString(this.finish[i]).substring(Integer.toHexString(this.finish[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.finish[i]).toUpperCase());
+        }
+        if (this.finish.length > 128) sb.append(" ...");
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("is_ascending:");
+    sb.append(this.is_ascending);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("count:");
+    sb.append(this.count);
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws TException {
+    // check for required fields
+    // check that fields of type enum have valid values
+  }
+
+}
+

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Mon Aug 10 02:51:35 2009
@@ -137,14 +137,14 @@
         if (columnSpecCnt == 0)
         {
             // table.cf['key']
-        	List<Column> columns = new ArrayList<Column>();
-      		columns = thriftClient_.get_slice(tableName, key, new ColumnParent(columnFamily, null), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, 1000000, ConsistencyLevel.ONE);
+            SliceRange range = new SliceRange(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, 1000000);
+      	    List<ColumnOrSuperColumn> columns = thriftClient_.get_slice(tableName, key, new ColumnParent(columnFamily, null), new SlicePredicate(null, range), ConsistencyLevel.ONE);
             int size = columns.size();
-            for (Iterator<Column> colIter = columns.iterator(); colIter.hasNext(); )
+            for (ColumnOrSuperColumn cosc : columns)
             {
-                Column column = colIter.next();
+                Column column = cosc.column;
                 css_.out.printf("  (column=%s, value=%s; timestamp=%d)\n",
-                                 column.name, column.value, column.timestamp);
+                                column.name, column.value, column.timestamp);
             }
             css_.out.println("Returned " + size + " rows.");
         }
@@ -153,15 +153,16 @@
             assert columnSpecCnt == 1;
             // table.cf['key']['column']
             String columnName = CliCompiler.getColumn(columnFamilySpec, 0);
-            Column column = new Column();
+            ColumnOrSuperColumn cosc;
             try
             {
-                column = thriftClient_.get_column(tableName, key, new ColumnPath(columnFamily, null, columnName.getBytes("UTF-8")), ConsistencyLevel.ONE);
+                cosc = thriftClient_.get(tableName, key, new ColumnPath(columnFamily, null, columnName.getBytes("UTF-8")), ConsistencyLevel.ONE);
             }
             catch (UnsupportedEncodingException e)
             {
                 throw new RuntimeException(e);
             }
+            Column column = cosc.column;
             css_.out.printf("==> (name=%s, value=%s; timestamp=%d)\n",
                             column.name, column.value, column.timestamp);
         }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java Mon Aug 10 02:51:35 2009
@@ -29,6 +29,7 @@
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.config.DatabaseDescriptor;
 
 
@@ -55,15 +56,17 @@
         return new Message(StorageService.getLocalStorageEndPoint(), StorageService.readStage_, StorageService.readVerbHandler_, bos.toByteArray());
     }
 
+    public final QueryPath queryPath;
     public final String table;
     public final String key;
     private boolean isDigestQuery = false;    
     protected final byte commandType;
 
-    protected ReadCommand(String table, String key, byte cmdType)
+    protected ReadCommand(String table, String key, QueryPath queryPath, byte cmdType)
     {
         this.table = table;
         this.key = key;
+        this.queryPath = queryPath;
         this.commandType = cmdType;
     }
     

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java Mon Aug 10 02:51:35 2009
@@ -22,17 +22,12 @@
 import java.io.IOException;
 import java.util.*;
 
-import org.apache.commons.lang.StringUtils;
-
 import org.apache.cassandra.service.ColumnParent;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.filter.NamesQueryFilter;
-import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.config.DatabaseDescriptor;
 
 public class SliceByNamesReadCommand extends ReadCommand
 {
-    public final QueryPath columnParent;
     public final SortedSet<byte[]> columnNames;
 
     public SliceByNamesReadCommand(String table, String key, ColumnParent column_parent, Collection<byte[]> columnNames)
@@ -42,8 +37,7 @@
 
     public SliceByNamesReadCommand(String table, String key, QueryPath path, Collection<byte[]> columnNames)
     {
-        super(table, key, CMD_TYPE_GET_SLICE_BY_NAMES);
-        this.columnParent = path;
+        super(table, key, path, CMD_TYPE_GET_SLICE_BY_NAMES);
         this.columnNames = new TreeSet<byte[]>(getComparator());
         this.columnNames.addAll(columnNames);
     }
@@ -51,13 +45,13 @@
     @Override
     public String getColumnFamilyName()
     {
-        return columnParent.columnFamilyName;
+        return queryPath.columnFamilyName;
     }
 
     @Override
     public ReadCommand copy()
     {
-        ReadCommand readCommand= new SliceByNamesReadCommand(table, key, columnParent, columnNames);
+        ReadCommand readCommand= new SliceByNamesReadCommand(table, key, queryPath, columnNames);
         readCommand.setDigestQuery(isDigestQuery());
         return readCommand;
     }
@@ -65,7 +59,7 @@
     @Override
     public Row getRow(Table table) throws IOException
     {        
-        return table.getRow(new NamesQueryFilter(key, columnParent, columnNames));
+        return table.getRow(new NamesQueryFilter(key, queryPath, columnNames));
     }
 
     @Override
@@ -74,7 +68,7 @@
         return "SliceByNamesReadCommand(" +
                "table='" + table + '\'' +
                ", key='" + key + '\'' +
-               ", columnParent='" + columnParent + '\'' +
+               ", columnParent='" + queryPath + '\'' +
                ", columns=[" + getComparator().getString(columnNames) + "]" +
                ')';
     }
@@ -90,7 +84,7 @@
         dos.writeBoolean(realRM.isDigestQuery());
         dos.writeUTF(realRM.table);
         dos.writeUTF(realRM.key);
-        realRM.columnParent.serialize(dos);
+        realRM.queryPath.serialize(dos);
         dos.writeInt(realRM.columnNames.size());
         if (realRM.columnNames.size() > 0)
         {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java Mon Aug 10 02:51:35 2009
@@ -27,7 +27,6 @@
 
 public class SliceFromReadCommand extends ReadCommand
 {
-    public final QueryPath column_parent;
     public final byte[] start, finish;
     public final boolean isAscending;
     public final int count;
@@ -37,10 +36,9 @@
         this(table, key, new QueryPath(column_parent), start, finish, isAscending, count);
     }
 
-    public SliceFromReadCommand(String table, String key, QueryPath columnParent, byte[] start, byte[] finish, boolean isAscending, int count)
+    public SliceFromReadCommand(String table, String key, QueryPath path, byte[] start, byte[] finish, boolean isAscending, int count)
     {
-        super(table, key, CMD_TYPE_GET_SLICE);
-        this.column_parent = columnParent;
+        super(table, key, path, CMD_TYPE_GET_SLICE);
         this.start = start;
         this.finish = finish;
         this.isAscending = isAscending;
@@ -50,13 +48,13 @@
     @Override
     public String getColumnFamilyName()
     {
-        return column_parent.columnFamilyName;
+        return queryPath.columnFamilyName;
     }
 
     @Override
     public ReadCommand copy()
     {
-        ReadCommand readCommand = new SliceFromReadCommand(table, key, column_parent, start, finish, isAscending, count);
+        ReadCommand readCommand = new SliceFromReadCommand(table, key, queryPath, start, finish, isAscending, count);
         readCommand.setDigestQuery(isDigestQuery());
         return readCommand;
     }
@@ -64,7 +62,7 @@
     @Override
     public Row getRow(Table table) throws IOException
     {
-        return table.getRow(new SliceQueryFilter(key, column_parent, start, finish, isAscending, count));
+        return table.getRow(new SliceQueryFilter(key, queryPath, start, finish, isAscending, count));
     }
 
     @Override
@@ -73,7 +71,7 @@
         return "SliceFromReadCommand(" +
                "table='" + table + '\'' +
                ", key='" + key + '\'' +
-               ", column_parent='" + column_parent + '\'' +
+               ", column_parent='" + queryPath + '\'' +
                ", start='" + getComparator().getString(start) + '\'' +
                ", finish='" + getComparator().getString(finish) + '\'' +
                ", isAscending=" + isAscending +
@@ -91,7 +89,7 @@
         dos.writeBoolean(realRM.isDigestQuery());
         dos.writeUTF(realRM.table);
         dos.writeUTF(realRM.key);
-        realRM.column_parent.serialize(dos);
+        realRM.queryPath.serialize(dos);
         ColumnSerializer.writeName(realRM.start, dos);
         ColumnSerializer.writeName(realRM.finish, dos);
         dos.writeBoolean(realRM.isAscending);

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryPath.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryPath.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryPath.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryPath.java Mon Aug 10 02:51:35 2009
@@ -8,8 +8,6 @@
 
 import org.apache.cassandra.service.ColumnParent;
 import org.apache.cassandra.service.ColumnPath;
-import org.apache.cassandra.service.ColumnPathOrParent;
-import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.db.ColumnSerializer;
 
 public class QueryPath
@@ -45,11 +43,6 @@
         this(column_path.column_family, column_path.super_column, column_path.column);
     }
 
-    public QueryPath(ColumnPathOrParent column_path_or_parent)
-    {
-        this(column_path_or_parent.column_family, column_path_or_parent.super_column, column_path_or_parent.column);
-    }
-
     public static QueryPath column(byte[] columnName)
     {
         return new QueryPath(null, null, columnName);

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java Mon Aug 10 02:51:35 2009
@@ -48,8 +48,8 @@
 {
 	private static Logger logger = Logger.getLogger(CassandraServer.class);
 
-    private final static List<Column> EMPTY_COLUMNS = Collections.emptyList();
-    private final static List<SuperColumn> EMPTY_SUPERCOLUMNS = Collections.emptyList();
+    private final static List<ColumnOrSuperColumn> EMPTY_COLUMNS = Collections.emptyList();
+    private final static List<Column> EMPTY_SUBCOLUMNS = Collections.emptyList();
 
     /*
       * Handle to the storage service to interact with the other machines in the
@@ -109,16 +109,11 @@
         return row.getColumnFamily(cfName);
 	}
 
-    public List<Column> thriftifyColumns(Collection<IColumn> columns)
-    {
-        return thriftifyColumns(columns, false);
-    }
-    
-    public List<Column> thriftifyColumns(Collection<IColumn> columns, boolean reverseOrder)
+    public List<Column> thriftifySubColumns(Collection<IColumn> columns)
     {
         if (columns == null || columns.isEmpty())
         {
-            return EMPTY_COLUMNS;
+            return EMPTY_SUBCOLUMNS;
         }
 
         ArrayList<Column> thriftColumns = new ArrayList<Column>(columns.size());
@@ -132,6 +127,22 @@
             thriftColumns.add(thrift_column);
         }
 
+        return thriftColumns;
+    }
+
+    public List<ColumnOrSuperColumn> thriftifyColumns(Collection<IColumn> columns, boolean reverseOrder)
+    {
+        ArrayList<ColumnOrSuperColumn> thriftColumns = new ArrayList<ColumnOrSuperColumn>(columns.size());
+        for (IColumn column : columns)
+        {
+            if (column.isMarkedForDelete())
+            {
+                continue;
+            }
+            Column thrift_column = new Column(column.name(), column.value(), column.timestamp());
+            thriftColumns.add(new ColumnOrSuperColumn(thrift_column, null));
+        }
+
         // we have to do the reversing here, since internally we pass results around in ColumnFamily
         // objects, which always sort their columns in the "natural" order
         if (reverseOrder)
@@ -139,65 +150,93 @@
         return thriftColumns;
     }
 
-    /** for resultsets of standard columns */
-    private List<Column> getSlice(ReadCommand command, int consistency_level) throws InvalidRequestException
+    private List<ColumnOrSuperColumn> thriftifySuperColumns(Collection<IColumn> columns, boolean reverseOrder)
+    {
+        ArrayList<ColumnOrSuperColumn> thriftSuperColumns = new ArrayList<ColumnOrSuperColumn>(columns.size());
+        for (IColumn column : columns)
+        {
+            List<Column> subcolumns = thriftifySubColumns(column.getSubColumns());
+            if (subcolumns.isEmpty())
+            {
+                continue;
+            }
+            SuperColumn superColumn = new SuperColumn(column.name(), subcolumns);
+            thriftSuperColumns.add(new ColumnOrSuperColumn(null, superColumn));
+        }
+
+        if (reverseOrder)
+            Collections.reverse(thriftSuperColumns);
+
+        return thriftSuperColumns;
+    }
+
+    private List<ColumnOrSuperColumn> getSlice(ReadCommand command, int consistency_level) throws InvalidRequestException
     {
         ColumnFamily cfamily = readColumnFamily(command, consistency_level);
         boolean reverseOrder = false;
-        
+
         if (command instanceof SliceFromReadCommand)
+        {
             reverseOrder = !((SliceFromReadCommand)command).isAscending;
+        }
 
         if (cfamily == null || cfamily.getColumnsMap().size() == 0)
         {
             return EMPTY_COLUMNS;
         }
-        if (cfamily.isSuper())
+        if (command.queryPath.superColumnName != null)
         {
             IColumn column = cfamily.getColumnsMap().values().iterator().next();
-            return thriftifyColumns(column.getSubColumns(), reverseOrder);
+            Collection<IColumn> subcolumns = column.getSubColumns();
+            if (subcolumns == null || subcolumns.isEmpty())
+            {
+                return EMPTY_COLUMNS;
+            }
+            return thriftifyColumns(subcolumns, reverseOrder);
+        }
+        if (cfamily.isSuper())
+        {
+            return thriftifySuperColumns(cfamily.getSortedColumns(), reverseOrder);
         }
         return thriftifyColumns(cfamily.getSortedColumns(), reverseOrder);
     }
 
-    public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent, List<byte[]> column_names, int consistency_level)
-    throws InvalidRequestException, NotFoundException
-    {
-        if (logger.isDebugEnabled())
-            logger.debug("get_slice_by_names");
-        ThriftValidation.validateColumnParent(table, column_parent);
-        return getSlice(new SliceByNamesReadCommand(table, key, column_parent, column_names), consistency_level);
-    }
-
-    public List<Column> get_slice(String table, String key, ColumnParent column_parent, byte[] start, byte[] finish, boolean is_ascending, int count, int consistency_level)
+    public List<ColumnOrSuperColumn> get_slice(String keyspace, String key, ColumnParent column_parent, SlicePredicate predicate, int consistency_level)
     throws InvalidRequestException, NotFoundException
     {
         if (logger.isDebugEnabled())
             logger.debug("get_slice_from");
-        ThriftValidation.validateColumnParent(table, column_parent);
-        // TODO support get_slice on super CFs
-        if (count <= 0)
-            throw new InvalidRequestException("get_slice requires positive count");
+        ThriftValidation.validateColumnParent(keyspace, column_parent);
 
-        return getSlice(new SliceFromReadCommand(table, key, column_parent, start, finish, is_ascending, count), consistency_level);
+        if (predicate.column_names != null)
+        {
+            return getSlice(new SliceByNamesReadCommand(keyspace, key, column_parent, predicate.column_names), consistency_level);
+        }
+        else
+        {
+            SliceRange range = predicate.slice_range;
+            if (range.count < 0)
+                throw new InvalidRequestException("get_slice requires non-negative count");
+            return getSlice(new SliceFromReadCommand(keyspace, key, column_parent, range.start, range.finish, range.is_ascending, range.count), consistency_level);
+        }
     }
 
-    public Column get_column(String table, String key, ColumnPath column_path, int consistency_level)
+    public ColumnOrSuperColumn get(String table, String key, ColumnPath column_path, int consistency_level)
     throws InvalidRequestException, NotFoundException
     {
         if (logger.isDebugEnabled())
-            logger.debug("get_column");
+            logger.debug("get");
         ThriftValidation.validateColumnPath(table, column_path);
 
         QueryPath path = new QueryPath(column_path.column_family, column_path.super_column);
-        ColumnFamily cfamily = readColumnFamily(new SliceByNamesReadCommand(table, key, path, Arrays.asList(column_path.column)), consistency_level);
-        // TODO can we leverage getSlice here and just check that it returns one column?
+        List<byte[]> nameAsList = Arrays.asList(column_path.column == null ? column_path.super_column : column_path.column);
+        ColumnFamily cfamily = readColumnFamily(new SliceByNamesReadCommand(table, key, path, nameAsList), consistency_level);
         if (cfamily == null)
         {
             throw new NotFoundException();
         }
         Collection<IColumn> columns = null;
-        if (column_path.super_column != null)
+        if (column_path.super_column != null && column_path.column != null)
         {
             IColumn column = cfamily.getColumn(column_path.super_column);
             if (column != null)
@@ -221,10 +260,12 @@
             throw new NotFoundException();
         }
 
-        return new Column(column.name(), column.value(), column.timestamp());
+        return column instanceof org.apache.cassandra.db.Column
+               ? new ColumnOrSuperColumn(new Column(column.name(), column.value(), column.timestamp()), null)
+               : new ColumnOrSuperColumn(null, new SuperColumn(column.name(), thriftifySubColumns(column.getSubColumns())));
     }
 
-    public int get_column_count(String table, String key, ColumnParent column_parent, int consistency_level)
+    public int get_count(String table, String key, ColumnParent column_parent, int consistency_level)
     throws InvalidRequestException
     {
         if (logger.isDebugEnabled())
@@ -296,15 +337,15 @@
         doInsert(consistency_level, rm);
     }
 
-    public void remove(String table, String key, ColumnPathOrParent column_path_or_parent, long timestamp, int consistency_level)
+    public void remove(String table, String key, ColumnPath column_path, long timestamp, int consistency_level)
     throws InvalidRequestException, UnavailableException
     {
         if (logger.isDebugEnabled())
             logger.debug("remove");
-        ThriftValidation.validateColumnPathOrParent(table, column_path_or_parent);
+        ThriftValidation.validateColumnPathOrParent(table, column_path);
         
         RowMutation rm = new RowMutation(table, key.trim());
-        rm.delete(new QueryPath(column_path_or_parent), timestamp);
+        rm.delete(new QueryPath(column_path), timestamp);
 
         doInsert(consistency_level, rm);
 	}
@@ -321,98 +362,6 @@
         }
     }
 
-    public List<SuperColumn> get_slice_super_by_names(String table, String key, String column_family, List<byte[]> super_column_names, int consistency_level)
-    throws InvalidRequestException
-    {
-        if (logger.isDebugEnabled())
-            logger.debug("get_slice_super_by_names");
-        ThriftValidation.validateColumnFamily(table, column_family);
-
-        ColumnFamily cfamily = readColumnFamily(new SliceByNamesReadCommand(table, key, new QueryPath(column_family), super_column_names), consistency_level);
-        if (cfamily == null)
-        {
-            return EMPTY_SUPERCOLUMNS;
-        }
-        return thriftifySuperColumns(cfamily.getSortedColumns());
-    }
-
-    private List<SuperColumn> thriftifySuperColumns(Collection<IColumn> columns)
-    {
-        return thriftifySuperColumns(columns, false);
-    }
-    
-    private List<SuperColumn> thriftifySuperColumns(Collection<IColumn> columns, boolean reverseOrder)
-    {
-        if (columns == null || columns.isEmpty())
-        {
-            return EMPTY_SUPERCOLUMNS;
-        }
-
-        ArrayList<SuperColumn> thriftSuperColumns = new ArrayList<SuperColumn>(columns.size());
-        for (IColumn column : columns)
-        {
-            List<Column> subcolumns = thriftifyColumns(column.getSubColumns());
-            if (subcolumns.isEmpty())
-            {
-                continue;
-            }
-            thriftSuperColumns.add(new SuperColumn(column.name(), subcolumns));
-        }
-
-        if (reverseOrder)
-            Collections.reverse(thriftSuperColumns);
-
-        return thriftSuperColumns;
-    }
-
-    public List<SuperColumn> get_slice_super(String table, String key, String column_family, byte[] start, byte[] finish, boolean is_ascending, int count, int consistency_level)
-    throws InvalidRequestException
-    {
-        if (logger.isDebugEnabled())
-            logger.debug("get_slice_super");
-        if (!DatabaseDescriptor.getColumnFamilyType(table, column_family).equals("Super"))
-            throw new InvalidRequestException("get_slice_super requires a super CF name");
-        if (count <= 0)
-            throw new InvalidRequestException("get_slice_super requires positive count");
-
-        ColumnFamily cfamily = readColumnFamily(new SliceFromReadCommand(table, key, new QueryPath(column_family), start, finish, is_ascending, count), consistency_level);
-        if (cfamily == null)
-        {
-            return EMPTY_SUPERCOLUMNS;
-        }
-        Collection<IColumn> columns = cfamily.getSortedColumns();
-        return thriftifySuperColumns(columns, !is_ascending);
-    }
-
-
-    public SuperColumn get_super_column(String table, String key, SuperColumnPath super_column_path, int consistency_level)
-    throws InvalidRequestException, NotFoundException
-    {
-        if (logger.isDebugEnabled())
-            logger.debug("get_superColumn");
-        ThriftValidation.validateSuperColumnPath(table, super_column_path);
-
-        ColumnFamily cfamily = readColumnFamily(new SliceByNamesReadCommand(table, key, new QueryPath(super_column_path.column_family), Arrays.asList(super_column_path.super_column)), consistency_level);
-        if (cfamily == null)
-        {
-            throw new NotFoundException();
-        }
-        Collection<IColumn> columns = cfamily.getSortedColumns();
-        if (columns == null || columns.size() == 0)
-        {
-            throw new NotFoundException();
-        }
-
-        assert columns.size() == 1;
-        IColumn column = columns.iterator().next();
-        if (column.getSubColumns().size() == 0)
-        {
-            throw new NotFoundException();
-        }
-
-        return new SuperColumn(column.name(), thriftifyColumns(column.getSubColumns()));
-    }
-
     public void batch_insert_super_column(String table, BatchMutationSuper batch_mutation_super, int consistency_level)
     throws InvalidRequestException, UnavailableException
     {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java?rev=802640&r1=802639&r2=802640&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java Mon Aug 10 02:51:35 2009
@@ -64,15 +64,15 @@
             {
                 throw new InvalidRequestException("supercolumn parameter is invalid for standard CF " + column_path.column_family);
             }
+            if (column_path.column == null)
+            {
+                throw new InvalidRequestException("column parameter is not optional for standard CF " + column_path.column_family);
+            }
         }
         else if (column_path.super_column == null)
         {
             throw new InvalidRequestException("column parameter is not optional for super CF " + column_path.column_family);
         }
-        if (column_path.column == null)
-        {
-            throw new InvalidRequestException("column parameter is not optional");
-        }
     }
 
     static void validateColumnParent(String tablename, ColumnParent column_parent) throws InvalidRequestException
@@ -86,23 +86,10 @@
                 throw new InvalidRequestException("columnfamily alone is required for standard CF " + column_parent.column_family);
             }
         }
-        else if (column_parent.super_column == null)
-        {
-            throw new InvalidRequestException("columnfamily and supercolumn are both required for super CF " + column_parent.column_family);
-        }
-    }
-
-    static void validateSuperColumnPath(String tablename, SuperColumnPath super_column_path) throws InvalidRequestException
-    {
-        validateTable(tablename);
-        String cfType = validateColumnFamily(tablename, super_column_path.column_family);
-        if (cfType.equals("Standard"))
-        {
-            throw new InvalidRequestException(super_column_path.column_family + " is a standard columnfamily; only super columnfamilies are valid here");
-        }
     }
 
-    static void validateColumnPathOrParent(String tablename, ColumnPathOrParent column_path_or_parent) throws InvalidRequestException
+    // column_path_or_parent is a ColumnPath for remove, where the "column" is optional even for a standard CF
+    static void validateColumnPathOrParent(String tablename, ColumnPath column_path_or_parent) throws InvalidRequestException
     {
         validateTable(tablename);
         String cfType = validateColumnFamily(tablename, column_path_or_parent.column_family);



Mime
View raw message