cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/6] git commit: fix bad comparison of column name against * or 1 patch by dbrosius; reviewed by jbellis for CASSANDRA-3787
Date Thu, 26 Jan 2012 07:33:40 GMT
fix bad comparison of column name against * or 1
patch by dbrosius; reviewed by jbellis for CASSANDRA-3787


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

Branch: refs/heads/trunk
Commit: f5f3065843da6d5d1ba173f433873c10f9a27f80
Parents: 2f879f2
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Jan 26 01:15:25 2012 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Jan 26 01:33:23 2012 -0600

----------------------------------------------------------------------
 .../cassandra/cql3/statements/SelectStatement.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5f30658/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 71b22bc..7fd9234 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -748,7 +748,10 @@ public class SelectStatement extends CQLStatement
             // Select clause
             if (parameters.isCount)
             {
-                if (selectClause.size() != 1 || (!selectClause.get(0).equals("*") &&
!selectClause.get(0).equals("1")))
+                if (selectClause.size() != 1)
+                    throw new InvalidRequestException("Only COUNT(*) and COUNT(1) operations
are currently supported.");
+                String columnName = selectClause.get(0).toString();
+                if (!columnName.equals("*") && !columnName.equals("1"))
                     throw new InvalidRequestException("Only COUNT(*) and COUNT(1) operations
are currently supported.");
             }
             else


Mime
View raw message