Repository: cassandra Updated Branches: refs/heads/trunk 2fbddbd99 -> e1e692a75
Add documentation for 7017 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e1e692a7 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e1e692a7 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e1e692a7 Branch: refs/heads/trunk Commit: e1e692a75451c239b8ef489db7d2c233d3d63e4e Parents: 2fbddbd Author: Sylvain Lebresne <[email protected]> Authored: Thu Apr 7 12:00:00 2016 +0200 Committer: Sylvain Lebresne <[email protected]> Committed: Thu Apr 7 12:00:00 2016 +0200 ---------------------------------------------------------------------- doc/cql3/CQL.textile | 6 ++++-- src/java/org/apache/cassandra/cql3/QueryProcessor.java | 2 +- .../org/apache/cassandra/cql3/statements/SelectStatement.java | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1e692a7/doc/cql3/CQL.textile ---------------------------------------------------------------------- diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile index 1ee2537..83899d2 100644 --- a/doc/cql3/CQL.textile +++ b/doc/cql3/CQL.textile @@ -1029,6 +1029,7 @@ bc(syntax).. FROM <tablename> ( WHERE <where-clause> )? ( ORDER BY <order-by> )? + ( PER PARTITION LIMIT <integer> )? ( LIMIT <integer> )? ( ALLOW FILTERING )? @@ -1147,9 +1148,9 @@ The @ORDER BY@ option allows to select the order of the returned results. It tak * if the table has been defined without any specific @CLUSTERING ORDER@, then then allowed orderings are the order induced by the clustering columns and the reverse of that one. * otherwise, the orderings allowed are the order of the @CLUSTERING ORDER@ option and the reversed one. -h4(#selectLimit). @LIMIT@ +h4(#selectLimit). @LIMIT@ and @PER PARTITION LIMIT@ -The @LIMIT@ option to a @SELECT@ statement limits the number of rows returned by a query. +The @LIMIT@ option to a @SELECT@ statement limits the number of rows returned by a query, while the @PER PARTITION LIMIT@ option limits the number of rows returned for a given partition by the query. Note that both type of limit can used in the same statement. h4(#selectAllowFiltering). @ALLOW FILTERING@ @@ -2315,6 +2316,7 @@ h3. 3.4.2 * "@INSERT/UPDATE options@":#updateOptions for tables having a default_time_to_live specifying a TTL of 0 will remove the TTL from the inserted or updated values * "@ALTER TABLE@":#alterTableStmt @ADD@ and @DROP@ now allow mutiple columns to be added/removed +* New "@PER PARTITION LIMIT@":#selectLimit option (see "CASSANDRA-7017":https://issues.apache.org/jira/browse/CASSANDRA-7017). h3. 3.4.1 http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1e692a7/src/java/org/apache/cassandra/cql3/QueryProcessor.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/QueryProcessor.java b/src/java/org/apache/cassandra/cql3/QueryProcessor.java index 1fd8564..5f4b0f6 100644 --- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java +++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java @@ -59,7 +59,7 @@ import org.github.jamm.MemoryMeter; public class QueryProcessor implements QueryHandler { - public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.4.0"); + public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.4.2"); public static final QueryProcessor instance = new QueryProcessor(); http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1e692a7/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 9b68d7a..b164e61 100644 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@ -857,7 +857,7 @@ public class SelectStatement implements CQLStatement isReversed, orderingComparator, prepareLimit(boundNames, limit, keyspace(), limitReceiver()), - prepareLimit(boundNames, perPartitionLimit, keyspace(), limitReceiver())); + prepareLimit(boundNames, perPartitionLimit, keyspace(), perPartitionLimitReceiver())); return new ParsedStatement.Prepared(stmt, boundNames, boundNames.getPartitionKeyBindIndexes(cfm)); } @@ -1055,6 +1055,11 @@ public class SelectStatement implements CQLStatement return new ColumnSpecification(keyspace(), columnFamily(), new ColumnIdentifier("[limit]", true), Int32Type.instance); } + private ColumnSpecification perPartitionLimitReceiver() + { + return new ColumnSpecification(keyspace(), columnFamily(), new ColumnIdentifier("[per_partition_limit]", true), Int32Type.instance); + } + @Override public String toString() {
