You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/08/17 17:47:30 UTC
[1/2] git commit: Handle CQL3 SELECT duplicate IN restrictions on
clustering columns
Updated Branches:
refs/heads/cassandra-2.0.0 0ad0031fd -> 21771dfbd
Handle CQL3 SELECT duplicate IN restrictions on clustering columns
patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5856
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3529ac71
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3529ac71
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3529ac71
Branch: refs/heads/cassandra-2.0.0
Commit: 3529ac711e5588918afcc8b514aa03c67a9adac7
Parents: 4140977
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat Aug 17 18:40:09 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat Aug 17 18:40:09 2013 +0300
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../cql3/statements/SelectStatement.java | 33 +++++++-------------
2 files changed, 14 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3529ac71/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f44cdb9..60e5cdc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -17,6 +17,8 @@
(CASSANDRA-5718)
* Add KeyCacheHitRate metric to CF metrics (CASSANDRA-5868)
* cqlsh: add support for multiline comments (CASSANDRA-5798)
+ * Handle CQL3 SELECT duplicate IN restrictions on clustering columns
+ (CASSANDRA-5856)
Merged from 1.1:
* Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3529ac71/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 4f559e5..44a1e64 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -350,12 +350,6 @@ public class SelectStatement implements CQLStatement
}
else
{
- // The IN query might not have listed the values in comparator order, so we need to re-sort
- // the bounds lists to make sure the slices works correctly
- Comparator<ByteBuffer> cmp = isReversed ? cfDef.cfm.comparator.reverseComparator : cfDef.cfm.comparator;
- Collections.sort(startBounds, cmp);
- Collections.sort(endBounds, cmp);
-
List<ColumnSlice> l = new ArrayList<ColumnSlice>(startBounds.size());
for (int i = 0; i < startBounds.size(); i++)
{
@@ -368,12 +362,7 @@ public class SelectStatement implements CQLStatement
slices = l.toArray(new ColumnSlice[l.size()]);
}
- SliceQueryFilter filter = new SliceQueryFilter(slices,
- isReversed,
- getLimit(),
- toGroup,
- multiplier);
- return filter;
+ return new SliceQueryFilter(slices, isReversed, getLimit(), toGroup, multiplier);
}
else
{
@@ -581,12 +570,12 @@ public class SelectStatement implements CQLStatement
return false;
}
- private static List<ByteBuffer> buildBound(Bound bound,
- Collection<CFDefinition.Name> names,
- Restriction[] restrictions,
- boolean isReversed,
- ColumnNameBuilder builder,
- List<ByteBuffer> variables) throws InvalidRequestException
+ private List<ByteBuffer> buildBound(Bound bound,
+ Collection<CFDefinition.Name> names,
+ Restriction[] restrictions,
+ boolean isReversed,
+ ColumnNameBuilder builder,
+ List<ByteBuffer> variables) throws InvalidRequestException
{
// The end-of-component of composite doesn't depend on whether the
// component type is reversed or not (i.e. the ReversedType is applied
@@ -616,7 +605,9 @@ public class SelectStatement implements CQLStatement
{
// IN query, we only support it on the clustering column
assert name.position == names.size() - 1;
- List<ByteBuffer> l = new ArrayList<ByteBuffer>(r.eqValues.size());
+ // The IN query might not have listed the values in comparator order, so we need to re-sort
+ // the bounds lists to make sure the slices works correctly (also, to avoid duplicates).
+ TreeSet<ByteBuffer> s = new TreeSet<ByteBuffer>(isReversed ? cfDef.cfm.comparator.reverseComparator : cfDef.cfm.comparator);
for (Term t : r.eqValues)
{
ByteBuffer val = t.bindAndGet(variables);
@@ -624,9 +615,9 @@ public class SelectStatement implements CQLStatement
throw new InvalidRequestException(String.format("Invalid null clustering key part %s", name));
ColumnNameBuilder copy = builder.copy().add(val);
// See below for why this
- l.add((bound == Bound.END && copy.remainingCount() > 0) ? copy.buildAsEndOfRange() : copy.build());
+ s.add((bound == Bound.END && copy.remainingCount() > 0) ? copy.buildAsEndOfRange() : copy.build());
}
- return l;
+ return new ArrayList<ByteBuffer>(s);
}
ByteBuffer val = r.eqValues.get(0).bindAndGet(variables);
[2/2] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0.0
Posted by al...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0.0
Conflicts:
CHANGES.txt
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/21771dfb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/21771dfb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/21771dfb
Branch: refs/heads/cassandra-2.0.0
Commit: 21771dfbd441afe855887b573001d9433b7f9b5c
Parents: 0ad0031 3529ac7
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat Aug 17 18:47:14 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat Aug 17 18:47:14 2013 +0300
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../cql3/statements/SelectStatement.java | 32 ++++++++------------
2 files changed, 14 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/21771dfb/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 8aed84e,60e5cdc..5c2b924
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,27 -1,7 +1,29 @@@
-1.2.9
- * migrate 1.1 schema_columnfamilies.key_alias column to key_aliases
- (CASSANDRA-5800)
- * add --migrate option to sstableupgrade and sstablescrub (CASSANDRA-5831)
+2.0.0-rc2
+ * enable vnodes by default (CASSANDRA-5869)
+ * fix CAS contention timeout (CASSANDRA-5830)
+ * fix HsHa to respect max frame size (CASSANDRA-4573)
+ * Fix (some) 2i on composite components omissions (CASSANDRA-5851)
+ * cqlsh: add DESCRIBE FULL SCHEMA variant (CASSANDRA-5880)
+Merged from 1.2:
+ * Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
+ * Add KeyCacheHitRate metric to CF metrics (CASSANDRA-5868)
+ * cqlsh: add support for multiline comments (CASSANDRA-5798)
++ * Handle CQL3 SELECT duplicate IN restrictions on clustering columns
++ (CASSANDRA-5856)
+
+
+2.0.0-rc1
+ * improve DecimalSerializer performance (CASSANDRA-5837)
+ * fix potential spurious wakeup in AsyncOneResponse (CASSANDRA-5690)
+ * fix schema-related trigger issues (CASSANDRA-5774)
+ * Better validation when accessing CQL3 table from thrift (CASSANDRA-5138)
+ * Fix assertion error during repair (CASSANDRA-5801)
+ * Fix range tombstone bug (CASSANDRA-5805)
+ * DC-local CAS (CASSANDRA-5797)
+ * Add a native_protocol_version column to the system.local table (CASSANRDA-5819)
+ * Use index_interval from cassandra.yaml when upgraded (CASSANDRA-5822)
+ * Fix buffer underflow on socket close (CASSANDRA-5792)
+Merged from 1.2:
* fix bulk-loading compressed sstables (CASSANDRA-5820)
* (Hadoop) fix quoting in CqlPagingRecordReader and CqlRecordWriter
(CASSANDRA-5824)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/21771dfb/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 5aced28,44a1e64..2ac94df
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@@ -409,11 -362,7 +403,7 @@@ public class SelectStatement implement
slices = l.toArray(new ColumnSlice[l.size()]);
}
- SliceQueryFilter filter = new SliceQueryFilter(slices,
- isReversed,
- limit,
- toGroup);
- return filter;
- return new SliceQueryFilter(slices, isReversed, getLimit(), toGroup, multiplier);
++ return new SliceQueryFilter(slices, isReversed, limit, toGroup);
}
else
{