From 96eb58a0fb6ac6dd4ba438120b2cd2725e815e95 Mon Sep 17 00:00:00 2001 From: blerer Date: Tue, 22 Sep 2015 20:44:49 +0200 Subject: [PATCH] Add a NEWS.txt entry about LIMIT behavior change and unit tests patch by Benjamin Lerer; reviewed by Sylvain Lebresne for CASSANDRA-10380 --- NEWS.txt | 3 +++ .../cassandra/cql3/validation/operations/AggregationTest.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/NEWS.txt b/NEWS.txt index 924c35f341..67398cf714 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -44,6 +44,9 @@ New features Upgrading --------- + - The LIMIT clause applies now only to the number of rows returned to the user, + not to the number of row queried. By consequence, queries using aggregates will not + be impacted by the LIMIT clause anymore. - The native protocol versions 1 and 2 are not supported anymore. - Max mutation size is now configurable via max_mutation_size_in_kb setting in cassandra.yaml; the default is half the size commitlog_segment_size_in_mb * 1024. diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java index a1d0aab7dd..7b3f12ce35 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java @@ -91,6 +91,8 @@ public class AggregationTest extends CQLTester assertRows(execute("SELECT COUNT(*) FROM %s"), row(4L)); assertRows(execute("SELECT COUNT(1) FROM %s"), row(4L)); assertRows(execute("SELECT COUNT(b), count(c), count(e), count(f) FROM %s"), row(4L, 3L, 3L, 3L)); + // Makes sure that LIMIT does not affect the result of aggregates + assertRows(execute("SELECT COUNT(b), count(c), count(e), count(f) FROM %s LIMIT 2"), row(4L, 3L, 3L, 3L)); } @Test @@ -130,6 +132,8 @@ public class AggregationTest extends CQLTester assertRows(execute("SELECT COUNT(1) FROM %s"), row(4L)); assertRows(execute("SELECT max(b), b, COUNT(*) FROM %s"), row(5, 1, 4L)); assertRows(execute("SELECT max(b), COUNT(1), b FROM %s"), row(5, 4L, 1)); + // Makes sure that LIMIT does not affect the result of aggregates + assertRows(execute("SELECT max(b), COUNT(1), b FROM %s LIMIT 2"), row(5, 4L, 1)); } @Test