cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1158932 - in /cassandra/trunk/src/java/org/apache/cassandra: cache/ config/ cql/ db/index/ db/index/keys/ db/marshal/ service/ thrift/
Date Wed, 17 Aug 2011 22:00:07 GMT
Author: jbellis
Date: Wed Aug 17 22:00:06 2011
New Revision: 1158932

URL: http://svn.apache.org/viewvc?rev=1158932&view=rev
Log:
update enum comparison to use ==
patch by dbrosius; reviewed by jbellis for CASSANDRA-3046

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java
    cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/Relation.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java
    cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
    cassandra/trunk/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java Wed Aug 17 22:00:06
2011
@@ -208,9 +208,9 @@ public abstract class AutoSavingCache<K,
             estimatedTotalBytes = bytes;
             CompactionType type;
 
-            if (cacheType.equals(ColumnFamilyStore.CacheType.KEY_CACHE_TYPE)) 
+            if (cacheType == ColumnFamilyStore.CacheType.KEY_CACHE_TYPE) 
                 type = CompactionType.KEY_CACHE_SAVE;
-            else if (cacheType.equals(ColumnFamilyStore.CacheType.ROW_CACHE_TYPE))
+            else if (cacheType == ColumnFamilyStore.CacheType.ROW_CACHE_TYPE)
                 type = CompactionType.ROW_CACHE_SAVE;
             else
                 type = CompactionType.UNKNOWN;

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java Wed Aug 17
22:00:06 2011
@@ -59,7 +59,7 @@ public class ColumnDefinition
         ColumnDefinition that = (ColumnDefinition) o;
         if (index_name != null ? !index_name.equals(that.index_name) : that.index_name !=
null)
             return false;
-        if (index_type != null ? !index_type.equals(that.index_type) : that.index_type !=
null)
+        if (index_type != that.index_type)
             return false;
         if (!name.equals(that.name))
             return false;

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java Wed Aug 17 22:00:06
2011
@@ -345,7 +345,7 @@ public class QueryProcessor
             Set<ByteBuffer> indexed = Table.open(keyspace).getColumnFamilyStore(select.getColumnFamily()).indexManager.getIndexedColumns();
             for (Relation relation : select.getColumnRelations())
             {
-                if ((relation.operator().equals(RelationType.EQ)) && indexed.contains(relation.getEntity().getByteBuffer(comparator)))
+                if ((relation.operator() == RelationType.EQ) && indexed.contains(relation.getEntity().getByteBuffer(comparator)))
                     return;
             }
             throw new InvalidRequestException("No indexed columns present in by-columns clause
with \"equals\" operator");

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/Relation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/Relation.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/Relation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/Relation.java Wed Aug 17 22:00:06 2011
@@ -51,12 +51,12 @@ public class Relation
     
     public boolean isKey()
     {
-        return entityType.equals(EntityType.KEY);
+        return entityType == EntityType.KEY;
     }
     
     public boolean isColumn()
     {
-        return entityType.equals(EntityType.COLUMN);
+        return entityType == EntityType.COLUMN;
     }
     
     public RelationType operator()
@@ -74,6 +74,7 @@ public class Relation
         return value;
     }
     
+    @Override
     public String toString()
     {
         return String.format("Relation(%s, %s,nnn %s)", entity, relationType, value);

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java Wed Aug 17 22:00:06
2011
@@ -69,17 +69,17 @@ public class WhereClause
     {
         if ((relation != null) && relation.isKey())
         {
-            if (relation.operator().equals(RelationType.EQ))
+            if (relation.operator() == RelationType.EQ)
                 keys.add(relation.getValue());
-            else if ((relation.operator().equals(RelationType.GT) || relation.operator().equals(RelationType.GTE)))
+            else if ((relation.operator() == RelationType.GT) || (relation.operator() ==
RelationType.GTE))
             {
                 startKey = relation.getValue();
-                includeStartKey = relation.operator().equals(RelationType.GTE);
+                includeStartKey = relation.operator() == RelationType.GTE;
             }
-            else if ((relation.operator().equals(RelationType.LT) || relation.operator().equals(RelationType.LTE)))
+            else if ((relation.operator() == RelationType.LT) || (relation.operator() ==
RelationType.LTE))
             {
                 finishKey = relation.getValue();
-                includeFinishKey = relation.operator().equals(RelationType.LTE);
+                includeFinishKey = relation.operator() == RelationType.LTE;
             }
             
         }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndex.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndex.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndex.java Wed Aug 17
22:00:06 2011
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
 public abstract class SecondaryIndex
 {
     
-    private static final Logger logger = LoggerFactory.getLogger(KeysIndex.class);
+    private static final Logger logger = LoggerFactory.getLogger(SecondaryIndex.class);
     
     /**
      * Base CF that has many indexes

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java Wed Aug
17 22:00:06 2011
@@ -69,7 +69,7 @@ public class KeysSearcher extends Second
                 continue;
             
             SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name);
-            if (index == null || !expression.op.equals(IndexOperator.EQ))
+            if (index == null || (expression.op != IndexOperator.EQ))
                 continue;
             int columns = index.getUnderlyingCfs().getMeanColumns();
             if (columns < bestMeanCount)

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java Wed Aug 17 22:00:06
2011
@@ -82,17 +82,15 @@ public class FloatType extends AbstractT
       if (source.isEmpty())
           return ByteBufferUtil.EMPTY_BYTE_BUFFER;
       
-      Float f;
       try
       {
-          f = Float.parseFloat(source);
+          float f = Float.parseFloat(source);
+          return ByteBufferUtil.bytes(f);
       }
       catch (NumberFormatException e1)
       {
           throw new MarshalException(String.format("unable to coerce '%s' to a float", source),
e1);
-      }
-          
-      return ByteBufferUtil.bytes(f);
+      }  
     }
 
     public void validate(ByteBuffer bytes) throws MarshalException

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Wed Aug 17 22:00:06
2011
@@ -698,7 +698,7 @@ public class StorageProxy implements Sto
 
     static <T> ReadCallback<T> getReadCallback(IResponseResolver<T> resolver,
IReadCommand command, ConsistencyLevel consistencyLevel, List<InetAddress> endpoints)
     {
-        if (consistencyLevel.equals(ConsistencyLevel.LOCAL_QUORUM) || consistencyLevel.equals(ConsistencyLevel.EACH_QUORUM))
+        if (consistencyLevel == ConsistencyLevel.LOCAL_QUORUM || consistencyLevel == ConsistencyLevel.EACH_QUORUM)
         {
             return new DatacenterReadCallback(resolver, consistencyLevel, command, endpoints);
         }

Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1158932&r1=1158931&r2=1158932&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java Wed Aug 17
22:00:06 2011
@@ -526,7 +526,7 @@ public class ThriftValidation
                                                                 me.getMessage()));
             }
 
-            isIndexed |= expression.op.equals(IndexOperator.EQ) && indexedColumns.contains(expression.column_name);
+            isIndexed |= (expression.op == IndexOperator.EQ) && indexedColumns.contains(expression.column_name);
         }
 
         if (!isIndexed)



Mime
View raw message