cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1075859 - in /cassandra/branches/cassandra-0.7.3: ./ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/db/filter/ src/java/org/apache/cassandra/db/marshal/ src/java/org...
Date Tue, 01 Mar 2011 15:55:50 GMT
Author: jbellis
Date: Tue Mar  1 15:55:49 2011
New Revision: 1075859

URL: http://svn.apache.org/viewvc?rev=1075859&view=rev
Log:
merge r1075231 (cache IColumn and reverse comparators in AbstractType)

Modified:
    cassandra/branches/cassandra-0.7.3/   (props changed)
    cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
  (props changed)
    cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
  (props changed)
    cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/avro/AvroValidation.java
    cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
    cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/QueryFilter.java
    cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
    cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/marshal/AbstractType.java
    cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/thrift/ThriftValidation.java

Propchange: cassandra/branches/cassandra-0.7.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 15:55:49 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6:922689-1071777
-/cassandra/branches/cassandra-0.7:1026516,1035666,1050269,1075198
+/cassandra/branches/cassandra-0.7:1026516,1035666,1050269,1075198,1075231
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /cassandra/trunk:1026516-1026734,1028929

Propchange: cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 15:55:49 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1071777
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516,1035666,1050269,1075198
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516,1035666,1050269,1075198,1075231
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1026734,1028929

Propchange: cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 15:55:49 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1071777
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516,1035666,1050269,1075198
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516,1035666,1050269,1075198,1075231
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1026734,1028929

Propchange: cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 15:55:49 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1071777
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516,1035666,1050269,1075198
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516,1035666,1050269,1075198,1075231
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1026734,1028929

Propchange: cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 15:55:49 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1071777
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516,1035666,1050269,1075198
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516,1035666,1050269,1075198,1075231
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1026734,1028929

Propchange: cassandra/branches/cassandra-0.7.3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 15:55:49 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1071777
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516,1035666,1050269,1075198
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516,1035666,1050269,1075198,1075231
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1026734,1028929

Modified: cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/avro/AvroValidation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/avro/AvroValidation.java?rev=1075859&r1=1075858&r2=1075859&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/avro/AvroValidation.java
(original)
+++ cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/avro/AvroValidation.java
Tue Mar  1 15:55:49 2011
@@ -203,7 +203,7 @@ public class AvroValidation
         if (range.count < 0)
             throw newInvalidRequestException("Ranges require a non-negative count.");
 
-        Comparator<ByteBuffer> orderedComparator = range.reversed ? comparator.getReverseComparator()
: comparator;
+        Comparator<ByteBuffer> orderedComparator = range.reversed ? comparator.reverseComparator
: comparator;
         if (range.start.remaining() > 0 && range.finish.remaining() > 0 &&
orderedComparator.compare(range.start, range.finish) > 0)
             throw newInvalidRequestException("range finish must come after start in the order
of traversal");
     }

Modified: cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java?rev=1075859&r1=1075858&r2=1075859&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
(original)
+++ cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
Tue Mar  1 15:55:49 2011
@@ -26,7 +26,6 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.SortedSet;
 
-import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.columniterator.IColumnIterator;
 import org.apache.cassandra.db.columniterator.SSTableNamesIterator;
@@ -88,6 +87,6 @@ public class NamesQueryFilter implements
 
     public Comparator<IColumn> getColumnComparator(AbstractType comparator)
     {
-        return QueryFilter.getColumnComparator(comparator);
+        return comparator.columnComparator;
     }
 }

Modified: cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/QueryFilter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/QueryFilter.java?rev=1075859&r1=1075858&r2=1075859&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/QueryFilter.java
(original)
+++ cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/QueryFilter.java
Tue Mar  1 15:55:49 2011
@@ -88,18 +88,6 @@ public class QueryFilter
         return superFilter.getSSTableColumnIterator(sstable, file, key);
     }
 
-    // here so it can be used by SQF and NQF.  non-package callers should call IFilter.getColumnComparator
-    static Comparator<IColumn> getColumnComparator(final Comparator<ByteBuffer>
comparator)
-    {
-        return new Comparator<IColumn>()
-        {
-            public int compare(IColumn c1, IColumn c2)
-            {
-                return comparator.compare(c1.name(), c2.name());
-            }
-        };
-    }
-    
     public void collectCollatedColumns(final ColumnFamily returnCF, Iterator<IColumn>
collatedColumns, final int gcBefore)
     {
         // define a 'reduced' iterator that merges columns w/ the same name, which

Modified: cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java?rev=1075859&r1=1075858&r2=1075859&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
(original)
+++ cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
Tue Mar  1 15:55:49 2011
@@ -28,12 +28,10 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.commons.collections.IteratorUtils;
-import org.apache.commons.collections.comparators.ReverseComparator;
 import org.apache.commons.collections.iterators.ReverseListIterator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.columniterator.IColumnIterator;
 import org.apache.cassandra.db.columniterator.SSTableSliceIterator;
@@ -90,7 +88,7 @@ public class SliceQueryFilter implements
         }
 
         // iterate until we get to the "real" start column
-        Comparator<ByteBuffer> comparator = reversed ? superColumn.getComparator().getReverseComparator()
: superColumn.getComparator();
+        Comparator<ByteBuffer> comparator = reversed ? superColumn.getComparator().reverseComparator
: superColumn.getComparator();
         while (subcolumns.hasNext())
         {
             IColumn column = subcolumns.next();
@@ -107,7 +105,7 @@ public class SliceQueryFilter implements
 
     public Comparator<IColumn> getColumnComparator(AbstractType comparator)
     {
-        return reversed ? new ReverseComparator(QueryFilter.getColumnComparator(comparator))
: QueryFilter.getColumnComparator(comparator);
+        return reversed ? comparator.columnReverseComparator : comparator.columnComparator;
     }
 
     public void collectReducedColumns(IColumnContainer container, Iterator<IColumn>
reducedColumns, int gcBefore)

Modified: cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/marshal/AbstractType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/marshal/AbstractType.java?rev=1075859&r1=1075858&r2=1075859&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/marshal/AbstractType.java
(original)
+++ cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/db/marshal/AbstractType.java
Tue Mar  1 15:55:49 2011
@@ -40,42 +40,41 @@ public abstract class AbstractType imple
 {
     public final Comparator<IndexInfo> indexComparator;
     public final Comparator<IndexInfo> indexReverseComparator;
+    public final Comparator<IColumn> columnComparator;
+    public final Comparator<IColumn> columnReverseComparator;
+    public final Comparator<ByteBuffer> reverseComparator;
 
     protected AbstractType()
     {
-        final AbstractType that = this;
         indexComparator = new Comparator<IndexInfo>()
         {
             public int compare(IndexInfo o1, IndexInfo o2)
             {
-                return that.compare(o1.lastName, o2.lastName);
+                return AbstractType.this.compare(o1.lastName, o2.lastName);
             }
         };
         indexReverseComparator = new Comparator<IndexInfo>()
         {
             public int compare(IndexInfo o1, IndexInfo o2)
             {
-                return that.compare(o1.firstName, o2.firstName);
+                return AbstractType.this.compare(o1.firstName, o2.firstName);
             }
         };
-    }
-
-    /** get a string representation of the bytes suitable for log messages */
-    public abstract String getString(ByteBuffer bytes);
-
-    /** get a byte representation of the given string.
-     *  defaults to unsupportedoperation so people deploying custom Types can update at their
leisure. */
-    public ByteBuffer fromString(String source)
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    /* validate that the byte array is a valid sequence for the type we are supposed to be
comparing */
-    public abstract void validate(ByteBuffer bytes) throws MarshalException;
-
-    public Comparator<ByteBuffer> getReverseComparator()
-    {
-        return new Comparator<ByteBuffer>()
+        columnComparator = new Comparator<IColumn>()
+        {
+            public int compare(IColumn c1, IColumn c2)
+            {
+                return AbstractType.this.compare(c1.name(), c2.name());
+            }
+        };
+        columnReverseComparator = new Comparator<IColumn>()
+        {
+            public int compare(IColumn c1, IColumn c2)
+            {
+                return AbstractType.this.compare(c2.name(), c1.name());
+            }
+        };
+        reverseComparator = new Comparator<ByteBuffer>()
         {
             public int compare(ByteBuffer o1, ByteBuffer o2)
             {
@@ -93,6 +92,25 @@ public abstract class AbstractType imple
         };
     }
 
+    /** @deprecated; use reverseComparator field instead */
+    public Comparator<ByteBuffer> getReverseComparator()
+    {
+        return reverseComparator;
+    }
+
+    /** get a string representation of the bytes suitable for log messages */
+    public abstract String getString(ByteBuffer bytes);
+
+    /** get a byte representation of the given string.
+     *  defaults to unsupportedoperation so people deploying custom Types can update at their
leisure. */
+    public ByteBuffer fromString(String source)
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /* validate that the byte array is a valid sequence for the type we are supposed to be
comparing */
+    public abstract void validate(ByteBuffer bytes) throws MarshalException;
+
     /* convenience method */
     public String getString(Collection<ByteBuffer> names)
     {

Modified: cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1075859&r1=1075858&r2=1075859&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/thrift/ThriftValidation.java
(original)
+++ cassandra/branches/cassandra-0.7.3/src/java/org/apache/cassandra/thrift/ThriftValidation.java
Tue Mar  1 15:55:49 2011
@@ -207,7 +207,7 @@ public class ThriftValidation
         if (range.count < 0)
             throw new InvalidRequestException("get_slice requires non-negative count");
 
-        Comparator<ByteBuffer> orderedComparator = range.isReversed() ? comparator.getReverseComparator()
: comparator;
+        Comparator<ByteBuffer> orderedComparator = range.isReversed() ? comparator.reverseComparator
: comparator;
         if (range.start.remaining() > 0
             && range.finish.remaining() > 0
             && orderedComparator.compare(range.start, range.finish) > 0)



Mime
View raw message