You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2016/01/22 15:51:57 UTC
[01/10] cassandra git commit: Avoid potential NPE for queries with
ORDER BY and IN
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.2 0b479a7f3 -> deafdbe37
refs/heads/cassandra-3.0 13314aa2e -> a60a80b83
refs/heads/cassandra-3.3 3b014d077 -> 8ab41c8d0
refs/heads/trunk 27f4b41fe -> f82646e81
Avoid potential NPE for queries with ORDER BY and IN
patch by blerer; reviewed by beobal for CASSANDRA-10955
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/deafdbe3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/deafdbe3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/deafdbe3
Branch: refs/heads/cassandra-2.2
Commit: deafdbe373df3717ec21f8e52d93f3d02bb5094a
Parents: 0b479a7
Author: Benjamin Lerer <b....@gmail.com>
Authored: Wed Jan 13 15:41:51 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:49:36 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 59 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6c01e22..1a92fd6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
* Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/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 5cfa94b..848b3a6 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1092,10 +1092,21 @@ public class SelectStatement implements CQLStatement
}
}
+ private static abstract class ColumnComparator<T> implements Comparator<T>
+ {
+ protected final int compare(Comparator<ByteBuffer> comparator, ByteBuffer aValue, ByteBuffer bValue)
+ {
+ if (aValue == null)
+ return bValue == null ? 0 : -1;
+
+ return bValue == null ? 1 : comparator.compare(aValue, bValue);
+ }
+ }
+
/**
* Used in orderResults(...) method when single 'ORDER BY' condition where given
*/
- private static class SingleColumnComparator implements Comparator<List<ByteBuffer>>
+ private static class SingleColumnComparator extends ColumnComparator<List<ByteBuffer>>
{
private final int index;
private final Comparator<ByteBuffer> comparator;
@@ -1108,14 +1119,14 @@ public class SelectStatement implements CQLStatement
public int compare(List<ByteBuffer> a, List<ByteBuffer> b)
{
- return comparator.compare(a.get(index), b.get(index));
+ return compare(comparator, a.get(index), b.get(index));
}
}
/**
* Used in orderResults(...) method when multiple 'ORDER BY' conditions where given
*/
- private static class CompositeComparator implements Comparator<List<ByteBuffer>>
+ private static class CompositeComparator extends ColumnComparator<List<ByteBuffer>>
{
private final List<Comparator<ByteBuffer>> orderTypes;
private final List<Integer> positions;
@@ -1133,10 +1144,7 @@ public class SelectStatement implements CQLStatement
Comparator<ByteBuffer> type = orderTypes.get(i);
int columnPos = positions.get(i);
- ByteBuffer aValue = a.get(columnPos);
- ByteBuffer bValue = b.get(columnPos);
-
- int comparison = type.compare(aValue, bValue);
+ int comparison = compare(type, a.get(columnPos), b.get(columnPos));
if (comparison != 0)
return comparison;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index 05ac3b9..f8ec13c 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@ -392,6 +392,49 @@ public class SelectOrderByTest extends CQLTester
row("A"));
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()
[02/10] cassandra git commit: Avoid potential NPE for queries with
ORDER BY and IN
Posted by sl...@apache.org.
Avoid potential NPE for queries with ORDER BY and IN
patch by blerer; reviewed by beobal for CASSANDRA-10955
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/deafdbe3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/deafdbe3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/deafdbe3
Branch: refs/heads/cassandra-3.0
Commit: deafdbe373df3717ec21f8e52d93f3d02bb5094a
Parents: 0b479a7
Author: Benjamin Lerer <b....@gmail.com>
Authored: Wed Jan 13 15:41:51 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:49:36 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 59 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6c01e22..1a92fd6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
* Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/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 5cfa94b..848b3a6 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1092,10 +1092,21 @@ public class SelectStatement implements CQLStatement
}
}
+ private static abstract class ColumnComparator<T> implements Comparator<T>
+ {
+ protected final int compare(Comparator<ByteBuffer> comparator, ByteBuffer aValue, ByteBuffer bValue)
+ {
+ if (aValue == null)
+ return bValue == null ? 0 : -1;
+
+ return bValue == null ? 1 : comparator.compare(aValue, bValue);
+ }
+ }
+
/**
* Used in orderResults(...) method when single 'ORDER BY' condition where given
*/
- private static class SingleColumnComparator implements Comparator<List<ByteBuffer>>
+ private static class SingleColumnComparator extends ColumnComparator<List<ByteBuffer>>
{
private final int index;
private final Comparator<ByteBuffer> comparator;
@@ -1108,14 +1119,14 @@ public class SelectStatement implements CQLStatement
public int compare(List<ByteBuffer> a, List<ByteBuffer> b)
{
- return comparator.compare(a.get(index), b.get(index));
+ return compare(comparator, a.get(index), b.get(index));
}
}
/**
* Used in orderResults(...) method when multiple 'ORDER BY' conditions where given
*/
- private static class CompositeComparator implements Comparator<List<ByteBuffer>>
+ private static class CompositeComparator extends ColumnComparator<List<ByteBuffer>>
{
private final List<Comparator<ByteBuffer>> orderTypes;
private final List<Integer> positions;
@@ -1133,10 +1144,7 @@ public class SelectStatement implements CQLStatement
Comparator<ByteBuffer> type = orderTypes.get(i);
int columnPos = positions.get(i);
- ByteBuffer aValue = a.get(columnPos);
- ByteBuffer bValue = b.get(columnPos);
-
- int comparison = type.compare(aValue, bValue);
+ int comparison = compare(type, a.get(columnPos), b.get(columnPos));
if (comparison != 0)
return comparison;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index 05ac3b9..f8ec13c 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@ -392,6 +392,49 @@ public class SelectOrderByTest extends CQLTester
row("A"));
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()
[03/10] cassandra git commit: Avoid potential NPE for queries with
ORDER BY and IN
Posted by sl...@apache.org.
Avoid potential NPE for queries with ORDER BY and IN
patch by blerer; reviewed by beobal for CASSANDRA-10955
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/deafdbe3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/deafdbe3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/deafdbe3
Branch: refs/heads/cassandra-3.3
Commit: deafdbe373df3717ec21f8e52d93f3d02bb5094a
Parents: 0b479a7
Author: Benjamin Lerer <b....@gmail.com>
Authored: Wed Jan 13 15:41:51 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:49:36 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 59 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6c01e22..1a92fd6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
* Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/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 5cfa94b..848b3a6 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1092,10 +1092,21 @@ public class SelectStatement implements CQLStatement
}
}
+ private static abstract class ColumnComparator<T> implements Comparator<T>
+ {
+ protected final int compare(Comparator<ByteBuffer> comparator, ByteBuffer aValue, ByteBuffer bValue)
+ {
+ if (aValue == null)
+ return bValue == null ? 0 : -1;
+
+ return bValue == null ? 1 : comparator.compare(aValue, bValue);
+ }
+ }
+
/**
* Used in orderResults(...) method when single 'ORDER BY' condition where given
*/
- private static class SingleColumnComparator implements Comparator<List<ByteBuffer>>
+ private static class SingleColumnComparator extends ColumnComparator<List<ByteBuffer>>
{
private final int index;
private final Comparator<ByteBuffer> comparator;
@@ -1108,14 +1119,14 @@ public class SelectStatement implements CQLStatement
public int compare(List<ByteBuffer> a, List<ByteBuffer> b)
{
- return comparator.compare(a.get(index), b.get(index));
+ return compare(comparator, a.get(index), b.get(index));
}
}
/**
* Used in orderResults(...) method when multiple 'ORDER BY' conditions where given
*/
- private static class CompositeComparator implements Comparator<List<ByteBuffer>>
+ private static class CompositeComparator extends ColumnComparator<List<ByteBuffer>>
{
private final List<Comparator<ByteBuffer>> orderTypes;
private final List<Integer> positions;
@@ -1133,10 +1144,7 @@ public class SelectStatement implements CQLStatement
Comparator<ByteBuffer> type = orderTypes.get(i);
int columnPos = positions.get(i);
- ByteBuffer aValue = a.get(columnPos);
- ByteBuffer bValue = b.get(columnPos);
-
- int comparison = type.compare(aValue, bValue);
+ int comparison = compare(type, a.get(columnPos), b.get(columnPos));
if (comparison != 0)
return comparison;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index 05ac3b9..f8ec13c 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@ -392,6 +392,49 @@ public class SelectOrderByTest extends CQLTester
row("A"));
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()
[10/10] cassandra git commit: Merge branch 'cassandra-3.3' into trunk
Posted by sl...@apache.org.
Merge branch 'cassandra-3.3' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f82646e8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f82646e8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f82646e8
Branch: refs/heads/trunk
Commit: f82646e8164e8aaff78b1c861e75de3630c2a491
Parents: 27f4b41 8ab41c8
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 22 15:51:35 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:51:35 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f82646e8/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f82646e8/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
[09/10] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.3
Posted by sl...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.3
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8ab41c8d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8ab41c8d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8ab41c8d
Branch: refs/heads/trunk
Commit: 8ab41c8d0aa12e8565d49e8a9712bb3bd5238de7
Parents: 3b014d0 a60a80b
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 22 15:51:24 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:51:24 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ab41c8d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index afaf114,f49e8d4..8a41b2e
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -15,7 -11,19 +15,9 @@@ Merged from 3.0
tombstone (CASSANDRA-10743)
* MV should use the maximum timestamp of the primary key (CASSANDRA-10910)
* Fix potential assertion error during compaction (CASSANDRA-10944)
- * Fix counting of received sstables in streaming (CASSANDRA-10949)
- * Implement hints compression (CASSANDRA-9428)
- * Fix potential assertion error when reading static columns (CASSANDRA-10903)
- * Avoid NoSuchElementException when executing empty batch (CASSANDRA-10711)
- * Avoid building PartitionUpdate in toString (CASSANDRA-10897)
- * Reduce heap spent when receiving many SSTables (CASSANDRA-10797)
- * Add back support for 3rd party auth providers to bulk loader (CASSANDRA-10873)
- * Eliminate the dependency on jgrapht for UDT resolution (CASSANDRA-10653)
- * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837)
- * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806)
Merged from 2.2:
+ 2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
* Make UUID LSB unique per process (CASSANDRA-7925)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ab41c8d/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
[04/10] cassandra git commit: Avoid potential NPE for queries with
ORDER BY and IN
Posted by sl...@apache.org.
Avoid potential NPE for queries with ORDER BY and IN
patch by blerer; reviewed by beobal for CASSANDRA-10955
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/deafdbe3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/deafdbe3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/deafdbe3
Branch: refs/heads/trunk
Commit: deafdbe373df3717ec21f8e52d93f3d02bb5094a
Parents: 0b479a7
Author: Benjamin Lerer <b....@gmail.com>
Authored: Wed Jan 13 15:41:51 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:49:36 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 59 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6c01e22..1a92fd6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
* Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/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 5cfa94b..848b3a6 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1092,10 +1092,21 @@ public class SelectStatement implements CQLStatement
}
}
+ private static abstract class ColumnComparator<T> implements Comparator<T>
+ {
+ protected final int compare(Comparator<ByteBuffer> comparator, ByteBuffer aValue, ByteBuffer bValue)
+ {
+ if (aValue == null)
+ return bValue == null ? 0 : -1;
+
+ return bValue == null ? 1 : comparator.compare(aValue, bValue);
+ }
+ }
+
/**
* Used in orderResults(...) method when single 'ORDER BY' condition where given
*/
- private static class SingleColumnComparator implements Comparator<List<ByteBuffer>>
+ private static class SingleColumnComparator extends ColumnComparator<List<ByteBuffer>>
{
private final int index;
private final Comparator<ByteBuffer> comparator;
@@ -1108,14 +1119,14 @@ public class SelectStatement implements CQLStatement
public int compare(List<ByteBuffer> a, List<ByteBuffer> b)
{
- return comparator.compare(a.get(index), b.get(index));
+ return compare(comparator, a.get(index), b.get(index));
}
}
/**
* Used in orderResults(...) method when multiple 'ORDER BY' conditions where given
*/
- private static class CompositeComparator implements Comparator<List<ByteBuffer>>
+ private static class CompositeComparator extends ColumnComparator<List<ByteBuffer>>
{
private final List<Comparator<ByteBuffer>> orderTypes;
private final List<Integer> positions;
@@ -1133,10 +1144,7 @@ public class SelectStatement implements CQLStatement
Comparator<ByteBuffer> type = orderTypes.get(i);
int columnPos = positions.get(i);
- ByteBuffer aValue = a.get(columnPos);
- ByteBuffer bValue = b.get(columnPos);
-
- int comparison = type.compare(aValue, bValue);
+ int comparison = compare(type, a.get(columnPos), b.get(columnPos));
if (comparison != 0)
return comparison;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/deafdbe3/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index 05ac3b9..f8ec13c 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@ -392,6 +392,49 @@ public class SelectOrderByTest extends CQLTester
row("A"));
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()
[08/10] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.3
Posted by sl...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.3
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8ab41c8d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8ab41c8d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8ab41c8d
Branch: refs/heads/cassandra-3.3
Commit: 8ab41c8d0aa12e8565d49e8a9712bb3bd5238de7
Parents: 3b014d0 a60a80b
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 22 15:51:24 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:51:24 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ab41c8d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index afaf114,f49e8d4..8a41b2e
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -15,7 -11,19 +15,9 @@@ Merged from 3.0
tombstone (CASSANDRA-10743)
* MV should use the maximum timestamp of the primary key (CASSANDRA-10910)
* Fix potential assertion error during compaction (CASSANDRA-10944)
- * Fix counting of received sstables in streaming (CASSANDRA-10949)
- * Implement hints compression (CASSANDRA-9428)
- * Fix potential assertion error when reading static columns (CASSANDRA-10903)
- * Avoid NoSuchElementException when executing empty batch (CASSANDRA-10711)
- * Avoid building PartitionUpdate in toString (CASSANDRA-10897)
- * Reduce heap spent when receiving many SSTables (CASSANDRA-10797)
- * Add back support for 3rd party auth providers to bulk loader (CASSANDRA-10873)
- * Eliminate the dependency on jgrapht for UDT resolution (CASSANDRA-10653)
- * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837)
- * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806)
Merged from 2.2:
+ 2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
* Make UUID LSB unique per process (CASSANDRA-7925)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ab41c8d/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
[05/10] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sl...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a60a80b8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a60a80b8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a60a80b8
Branch: refs/heads/cassandra-3.3
Commit: a60a80b83872051ae9bf10d3f91eeed94a0c9355
Parents: 13314aa deafdbe
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 22 15:51:09 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:51:09 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index e93a04a,1a92fd6..f49e8d4
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,27 -1,6 +1,29 @@@
+3.0.3
+ * Update CQL documentation (CASSANDRA-10899)
+ * Check the column name, not cell name, for dropped columns when reading
+ legacy sstables (CASSANDRA-11018)
+ * Don't attempt to index clustering values of static rows (CASSANDRA-11021)
+ * Remove checksum files after replaying hints (CASSANDRA-10947)
+ * Support passing base table metadata to custom 2i validation (CASSANDRA-10924)
+ * Ensure stale index entries are purged during reads (CASSANDRA-11013)
+ * Fix AssertionError when removing from list using UPDATE (CASSANDRA-10954)
+ * Fix UnsupportedOperationException when reading old sstable with range
+ tombstone (CASSANDRA-10743)
+ * MV should use the maximum timestamp of the primary key (CASSANDRA-10910)
+ * Fix potential assertion error during compaction (CASSANDRA-10944)
+ * Fix counting of received sstables in streaming (CASSANDRA-10949)
+ * Implement hints compression (CASSANDRA-9428)
+ * Fix potential assertion error when reading static columns (CASSANDRA-10903)
+ * Avoid NoSuchElementException when executing empty batch (CASSANDRA-10711)
+ * Avoid building PartitionUpdate in toString (CASSANDRA-10897)
+ * Reduce heap spent when receiving many SSTables (CASSANDRA-10797)
+ * Add back support for 3rd party auth providers to bulk loader (CASSANDRA-10873)
+ * Eliminate the dependency on jgrapht for UDT resolution (CASSANDRA-10653)
+ * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837)
+ * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806)
+Merged from 2.2:
+ 2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
- * Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
* Make UUID LSB unique per process (CASSANDRA-7925)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index ae6f772,f8ec13c..6e06419
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@@ -405,34 -390,51 +405,77 @@@ public class SelectOrderByTest extends
row("B"),
row("D"),
row("A"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1, c2 LIMIT 2; ", 1, 1, 2),
+ row("B"),
+ row("D"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1, c2 LIMIT 10; ", 1, 1, 2),
+ row("B"),
+ row("D"),
+ row("A"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC; ", 1, 1, 2),
+ row("A"),
+ row("D"),
+ row("B"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 2; ", 1, 1, 2),
+ row("A"),
+ row("D"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 10; ", 1, 1, 2),
+ row("A"),
+ row("D"),
+ row("B"));
+
+ assertInvalidMessage("LIMIT must be strictly positive",
+ "SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 0; ", 1, 1, 2);
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()
[07/10] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sl...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a60a80b8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a60a80b8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a60a80b8
Branch: refs/heads/trunk
Commit: a60a80b83872051ae9bf10d3f91eeed94a0c9355
Parents: 13314aa deafdbe
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 22 15:51:09 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:51:09 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index e93a04a,1a92fd6..f49e8d4
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,27 -1,6 +1,29 @@@
+3.0.3
+ * Update CQL documentation (CASSANDRA-10899)
+ * Check the column name, not cell name, for dropped columns when reading
+ legacy sstables (CASSANDRA-11018)
+ * Don't attempt to index clustering values of static rows (CASSANDRA-11021)
+ * Remove checksum files after replaying hints (CASSANDRA-10947)
+ * Support passing base table metadata to custom 2i validation (CASSANDRA-10924)
+ * Ensure stale index entries are purged during reads (CASSANDRA-11013)
+ * Fix AssertionError when removing from list using UPDATE (CASSANDRA-10954)
+ * Fix UnsupportedOperationException when reading old sstable with range
+ tombstone (CASSANDRA-10743)
+ * MV should use the maximum timestamp of the primary key (CASSANDRA-10910)
+ * Fix potential assertion error during compaction (CASSANDRA-10944)
+ * Fix counting of received sstables in streaming (CASSANDRA-10949)
+ * Implement hints compression (CASSANDRA-9428)
+ * Fix potential assertion error when reading static columns (CASSANDRA-10903)
+ * Avoid NoSuchElementException when executing empty batch (CASSANDRA-10711)
+ * Avoid building PartitionUpdate in toString (CASSANDRA-10897)
+ * Reduce heap spent when receiving many SSTables (CASSANDRA-10797)
+ * Add back support for 3rd party auth providers to bulk loader (CASSANDRA-10873)
+ * Eliminate the dependency on jgrapht for UDT resolution (CASSANDRA-10653)
+ * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837)
+ * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806)
+Merged from 2.2:
+ 2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
- * Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
* Make UUID LSB unique per process (CASSANDRA-7925)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index ae6f772,f8ec13c..6e06419
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@@ -405,34 -390,51 +405,77 @@@ public class SelectOrderByTest extends
row("B"),
row("D"),
row("A"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1, c2 LIMIT 2; ", 1, 1, 2),
+ row("B"),
+ row("D"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1, c2 LIMIT 10; ", 1, 1, 2),
+ row("B"),
+ row("D"),
+ row("A"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC; ", 1, 1, 2),
+ row("A"),
+ row("D"),
+ row("B"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 2; ", 1, 1, 2),
+ row("A"),
+ row("D"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 10; ", 1, 1, 2),
+ row("A"),
+ row("D"),
+ row("B"));
+
+ assertInvalidMessage("LIMIT must be strictly positive",
+ "SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 0; ", 1, 1, 2);
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()
[06/10] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sl...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a60a80b8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a60a80b8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a60a80b8
Branch: refs/heads/cassandra-3.0
Commit: a60a80b83872051ae9bf10d3f91eeed94a0c9355
Parents: 13314aa deafdbe
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 22 15:51:09 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 22 15:51:09 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../cql3/statements/SelectStatement.java | 22 ++++++----
.../operations/SelectOrderByTest.java | 43 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index e93a04a,1a92fd6..f49e8d4
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,27 -1,6 +1,29 @@@
+3.0.3
+ * Update CQL documentation (CASSANDRA-10899)
+ * Check the column name, not cell name, for dropped columns when reading
+ legacy sstables (CASSANDRA-11018)
+ * Don't attempt to index clustering values of static rows (CASSANDRA-11021)
+ * Remove checksum files after replaying hints (CASSANDRA-10947)
+ * Support passing base table metadata to custom 2i validation (CASSANDRA-10924)
+ * Ensure stale index entries are purged during reads (CASSANDRA-11013)
+ * Fix AssertionError when removing from list using UPDATE (CASSANDRA-10954)
+ * Fix UnsupportedOperationException when reading old sstable with range
+ tombstone (CASSANDRA-10743)
+ * MV should use the maximum timestamp of the primary key (CASSANDRA-10910)
+ * Fix potential assertion error during compaction (CASSANDRA-10944)
+ * Fix counting of received sstables in streaming (CASSANDRA-10949)
+ * Implement hints compression (CASSANDRA-9428)
+ * Fix potential assertion error when reading static columns (CASSANDRA-10903)
+ * Avoid NoSuchElementException when executing empty batch (CASSANDRA-10711)
+ * Avoid building PartitionUpdate in toString (CASSANDRA-10897)
+ * Reduce heap spent when receiving many SSTables (CASSANDRA-10797)
+ * Add back support for 3rd party auth providers to bulk loader (CASSANDRA-10873)
+ * Eliminate the dependency on jgrapht for UDT resolution (CASSANDRA-10653)
+ * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837)
+ * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806)
+Merged from 2.2:
+ 2.2.5
+ * Fix potential NPE on ORDER BY queries with IN (CASSANDRA-10955)
- * Avoid over-fetching during the page of range queries (CASSANDRA-8521)
* Start L0 STCS-compactions even if there is a L0 -> L1 compaction
going (CASSANDRA-10979)
* Make UUID LSB unique per process (CASSANDRA-7925)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a60a80b8/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
index ae6f772,f8ec13c..6e06419
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectOrderByTest.java
@@@ -405,34 -390,51 +405,77 @@@ public class SelectOrderByTest extends
row("B"),
row("D"),
row("A"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1, c2 LIMIT 2; ", 1, 1, 2),
+ row("B"),
+ row("D"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1, c2 LIMIT 10; ", 1, 1, 2),
+ row("B"),
+ row("D"),
+ row("A"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC; ", 1, 1, 2),
+ row("A"),
+ row("D"),
+ row("B"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 2; ", 1, 1, 2),
+ row("A"),
+ row("D"));
+
+ assertRows(execute("SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 10; ", 1, 1, 2),
+ row("A"),
+ row("D"),
+ row("B"));
+
+ assertInvalidMessage("LIMIT must be strictly positive",
+ "SELECT v as c2 FROM %s where pk1 = ? AND pk2 IN (?, ?) ORDER BY c1 DESC , c2 DESC LIMIT 0; ", 1, 1, 2);
}
+ @Test
+ public void testOrderByForInClauseWithNullValue() throws Throwable
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))");
+
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
+ execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");
+
+ execute("UPDATE %s SET s = 1 WHERE a = 1");
+ execute("UPDATE %s SET s = 2 WHERE a = 2");
+ execute("UPDATE %s SET s = 3 WHERE a = 3");
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC , c DESC"),
+ row(2, 2, 2, 1, 2),
+ row(2, 2, 1, 1, 2),
+ row(1, 1, 2, 1, 1),
+ row(1, 1, 1, 1, 1),
+ row(3, null, null, null, 3));
+
+ assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b ASC, c ASC"),
+ row(3, null, null, null, 3),
+ row(1, 1, 1, 1, 1),
+ row(1, 1, 2, 1, 1),
+ row(2, 2, 1, 1, 2),
+ row(2, 2, 2, 1, 2));
+ }
+
/**
* Test reversed comparators
* migrated from cql_tests.py:TestCQL.reversed_comparator_test()