You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2016/04/14 11:30:41 UTC
cassandra git commit: Fix SelectStatement public API (Follow-up
CASSANDRA-7017)
Repository: cassandra
Updated Branches:
refs/heads/trunk 5288d434b -> d8036f936
Fix SelectStatement public API (Follow-up CASSANDRA-7017)
patch by Alex Petrov; reviewed by Benjamin Lerer for CASSANDRA-7017
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d8036f93
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d8036f93
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d8036f93
Branch: refs/heads/trunk
Commit: d8036f93617e318bf930885981cc75104bf523a2
Parents: 5288d43
Author: Alex Petrov <ol...@gmail.com>
Authored: Thu Apr 14 11:27:06 2016 +0200
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Thu Apr 14 11:27:06 2016 +0200
----------------------------------------------------------------------
.../cql3/statements/SelectStatement.java | 31 +++++++++++++++-----
1 file changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d8036f93/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 9895d67..9745b05 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -204,8 +204,8 @@ public class SelectStatement implements CQLStatement
cl.validateForRead(keyspace());
int nowInSec = FBUtilities.nowInSeconds();
- int userLimit = getLimit(limit, options);
- int userPerPartitionLimit = getLimit(perPartitionLimit, options);
+ int userLimit = getLimit(options);
+ int userPerPartitionLimit = getPerPartitionLimit(options);
ReadQuery query = getQuery(options, nowInSec, userLimit, userPerPartitionLimit);
int pageSize = getPageSize(options);
@@ -232,7 +232,7 @@ public class SelectStatement implements CQLStatement
public ReadQuery getQuery(QueryOptions options, int nowInSec) throws RequestValidationException
{
- return getQuery(options, nowInSec, getLimit(limit, options), getLimit(perPartitionLimit, options));
+ return getQuery(options, nowInSec, getLimit(options), getPerPartitionLimit(options));
}
public ReadQuery getQuery(QueryOptions options, int nowInSec, int userLimit, int perPartitionLimit) throws RequestValidationException
@@ -394,8 +394,8 @@ public class SelectStatement implements CQLStatement
public ResultMessage.Rows executeInternal(QueryState state, QueryOptions options) throws RequestExecutionException, RequestValidationException
{
int nowInSec = FBUtilities.nowInSeconds();
- int userLimit = getLimit(limit, options);
- int userPerPartitionLimit = getLimit(perPartitionLimit, options);
+ int userLimit = getLimit(options);
+ int userPerPartitionLimit = getPerPartitionLimit(options);
ReadQuery query = getQuery(options, nowInSec, userLimit, userPerPartitionLimit);
int pageSize = getPageSize(options);
@@ -418,7 +418,7 @@ public class SelectStatement implements CQLStatement
public ResultSet process(PartitionIterator partitions, int nowInSec) throws InvalidRequestException
{
- return process(partitions, QueryOptions.DEFAULT, nowInSec, getLimit(limit, QueryOptions.DEFAULT));
+ return process(partitions, QueryOptions.DEFAULT, nowInSec, getLimit(QueryOptions.DEFAULT));
}
public String keyspace()
@@ -615,7 +615,24 @@ public class SelectStatement implements CQLStatement
* @return the limit specified by the user or <code>DataLimits.NO_LIMIT</code> if no value
* as been specified.
*/
- public int getLimit(Term limit, QueryOptions options)
+ public int getLimit(QueryOptions options)
+ {
+ return getLimit(limit, options);
+ }
+
+ /**
+ * Returns the per partition limit specified by the user.
+ * May be used by custom QueryHandler implementations
+ *
+ * @return the per partition limit specified by the user or <code>DataLimits.NO_LIMIT</code> if no value
+ * as been specified.
+ */
+ public int getPerPartitionLimit(QueryOptions options)
+ {
+ return getLimit(perPartitionLimit, options);
+ }
+
+ private int getLimit(Term limit, QueryOptions options)
{
int userLimit = DataLimits.NO_LIMIT;