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 2014/03/06 10:15:26 UTC
[1/2] git commit: Fix CQLSSTableWriter.addRow(Map)
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 5d67e852e -> 872eef3dc
Fix CQLSSTableWriter.addRow(Map<String, Object>)
patch by slebresne; reviewed by thobbs for CASSANDRA-6526
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ba95ca0d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ba95ca0d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ba95ca0d
Branch: refs/heads/cassandra-2.1
Commit: ba95ca0db52567b875e5be0d10f8523b706385c5
Parents: 773fade
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Thu Mar 6 10:07:51 2014 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Thu Mar 6 10:07:51 2014 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/io/sstable/CQLSSTableWriter.java | 10 ++++++++--
.../apache/cassandra/io/sstable/CQLSSTableWriterTest.java | 9 ++++++++-
3 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ba95ca0d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d697e3f..6ef9025 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -34,6 +34,7 @@
* Fix IllegalArgumentException when updating from 1.2 with SuperColumns
(CASSANDRA-6733)
* FBUtilities.singleton() should use the CF comparator (CASSANDRA-6778)
+ * Fix CQLSStableWriter.addRow(Map<String, Object>) (CASSANDRA-6526)
Merged from 1.2:
* Add CMSClassUnloadingEnabled JVM option (CASSANDRA-6541)
* Catch memtable flush exceptions during shutdown (CASSANDRA-6735)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ba95ca0d/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
index 86348aa..a7ece70 100644
--- a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
@@ -141,6 +141,11 @@ public class CQLSSTableWriter
* keys are the names of the columns to add instead of taking a list of the
* values in the order of the insert statement used during construction of
* this write.
+ * <p>
+ * Please note that the column names in the map keys must be in lowercase unless
+ * the declared column name is a
+ * <a href="http://cassandra.apache.org/doc/cql3/CQL.html#identifiers">case-sensitive quoted identifier</a>
+ * (in which case the map key must use the exact case of the column).
*
* @param values a map of colum name to column values representing the new
* row to add. Note that if a column is not part of the map, it's value will
@@ -152,11 +157,12 @@ public class CQLSSTableWriter
public CQLSSTableWriter addRow(Map<String, Object> values)
throws InvalidRequestException, IOException
{
- int size = Math.min(values.size(), boundNames.size());
+ int size = boundNames.size();
List<ByteBuffer> rawValues = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
ColumnSpecification spec = boundNames.get(i);
- rawValues.add(((AbstractType)spec.type).decompose(values.get(spec.name.toString())));
+ Object value = values.get(spec.name.toString());
+ rawValues.add(value == null ? null : ((AbstractType)spec.type).decompose(value));
}
return rawAddRow(rawValues);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ba95ca0d/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index 0e38e16..bdc4b94 100644
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.io.sstable;
import java.io.File;
import java.util.Iterator;
+import com.google.common.collect.ImmutableMap;
import com.google.common.io.Files;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -72,6 +73,7 @@ public class CQLSSTableWriterTest
writer.addRow(0, "test1", 24);
writer.addRow(1, "test2", null);
writer.addRow(2, "test3", 42);
+ writer.addRow(ImmutableMap.<String, Object>of("k", 3, "v2", 12));
writer.close();
SSTableLoader loader = new SSTableLoader(dataDir, new SSTableLoader.Client()
@@ -92,7 +94,7 @@ public class CQLSSTableWriterTest
loader.stream().get();
UntypedResultSet rs = QueryProcessor.processInternal("SELECT * FROM cql_keyspace.table1;");
- assertEquals(3, rs.size());
+ assertEquals(4, rs.size());
Iterator<UntypedResultSet.Row> iter = rs.iterator();
UntypedResultSet.Row row;
@@ -111,5 +113,10 @@ public class CQLSSTableWriterTest
assertEquals(2, row.getInt("k"));
assertEquals("test3", row.getString("v1"));
assertEquals(42, row.getInt("v2"));
+
+ row = iter.next();
+ assertEquals(3, row.getInt("k"));
+ assertEquals(null, row.getBytes("v1")); // Using getBytes because we know it won't NPE
+ assertEquals(12, row.getInt("v2"));
}
}
[2/2] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by sl...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/872eef3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/872eef3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/872eef3d
Branch: refs/heads/cassandra-2.1
Commit: 872eef3dc6822ef20c137016d92d2fe962f62101
Parents: 5d67e85 ba95ca0
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Thu Mar 6 10:15:19 2014 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Thu Mar 6 10:15:19 2014 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/io/sstable/CQLSSTableWriter.java | 10 ++++++++--
.../apache/cassandra/io/sstable/CQLSSTableWriterTest.java | 9 ++++++++-
3 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/872eef3d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 098ecbc,6ef9025..b933bad
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -45,44 -34,24 +45,45 @@@ Merged from 2.0
* Fix IllegalArgumentException when updating from 1.2 with SuperColumns
(CASSANDRA-6733)
* FBUtilities.singleton() should use the CF comparator (CASSANDRA-6778)
+ * Fix CQLSStableWriter.addRow(Map<String, Object>) (CASSANDRA-6526)
-Merged from 1.2:
- * Add CMSClassUnloadingEnabled JVM option (CASSANDRA-6541)
- * Catch memtable flush exceptions during shutdown (CASSANDRA-6735)
- * Fix broken streams when replacing with same IP (CASSANDRA-6622)
- * Fix upgradesstables NPE for non-CF-based indexes (CASSANDRA-6645)
- * Fix partition and range deletes not triggering flush (CASSANDRA-6655)
- * Fix mean cells and mean row size per sstable calculations (CASSANDRA-6667)
- * Compact hints after partial replay to clean out tombstones (CASSANDRA-6666)
- * Log USING TTL/TIMESTAMP in a counter update warning (CASSANDRA-6649)
- * Don't exchange schema between nodes with different versions (CASSANDRA-6695)
- * Use real node messaging versions for schema exchange decisions (CASSANDRA-6700)
- * IN on the last clustering columns + ORDER BY DESC yield no results (CASSANDRA-6701)
- * Fix SecondaryIndexManager#deleteFromIndexes() (CASSANDRA-6711)
- * Fix snapshot repair not snapshotting coordinator itself (CASSANDRA-6713)
- * Support negative timestamps for CQL3 dates in query string (CASSANDRA-6718)
- * Avoid NPEs when receiving table changes for an unknown keyspace (CASSANDRA-5631)
- * Fix bootstrapping when there is no schema (CASSANDRA-6685)
+
+
+2.1.0-beta1
+ * Add flush directory distinct from compaction directories (CASSANDRA-6357)
+ * Require JNA by default (CASSANDRA-6575)
+ * add listsnapshots command to nodetool (CASSANDRA-5742)
+ * Introduce AtomicBTreeColumns (CASSANDRA-6271, 6692)
+ * Multithreaded commitlog (CASSANDRA-3578)
+ * allocate fixed index summary memory pool and resample cold index summaries
+ to use less memory (CASSANDRA-5519)
+ * Removed multithreaded compaction (CASSANDRA-6142)
+ * Parallelize fetching rows for low-cardinality indexes (CASSANDRA-1337)
+ * change logging from log4j to logback (CASSANDRA-5883)
+ * switch to LZ4 compression for internode communication (CASSANDRA-5887)
+ * Stop using Thrift-generated Index* classes internally (CASSANDRA-5971)
+ * Remove 1.2 network compatibility code (CASSANDRA-5960)
+ * Remove leveled json manifest migration code (CASSANDRA-5996)
+ * Remove CFDefinition (CASSANDRA-6253)
+ * Use AtomicIntegerFieldUpdater in RefCountedMemory (CASSANDRA-6278)
+ * User-defined types for CQL3 (CASSANDRA-5590)
+ * Use of o.a.c.metrics in nodetool (CASSANDRA-5871, 6406)
+ * Batch read from OTC's queue and cleanup (CASSANDRA-1632)
+ * Secondary index support for collections (CASSANDRA-4511, 6383)
+ * SSTable metadata(Stats.db) format change (CASSANDRA-6356)
+ * Push composites support in the storage engine
+ (CASSANDRA-5417, CASSANDRA-6520)
+ * Add snapshot space used to cfstats (CASSANDRA-6231)
+ * Add cardinality estimator for key count estimation (CASSANDRA-5906)
+ * CF id is changed to be non-deterministic. Data dir/key cache are created
+ uniquely for CF id (CASSANDRA-5202)
+ * New counters implementation (CASSANDRA-6504)
+ * Replace UnsortedColumns, EmptyColumns, TreeMapBackedSortedColumns with new
+ ArrayBackedSortedColumns (CASSANDRA-6630, CASSANDRA-6662, CASSANDRA-6690)
+ * Add option to use row cache with a given amount of rows (CASSANDRA-5357)
+ * Avoid repairing already repaired data (CASSANDRA-5351)
+ * Reject counter updates with USING TTL/TIMESTAMP (CASSANDRA-6649)
+ * Replace index_interval with min/max_index_interval (CASSANDRA-6379)
+ * Lift limitation that order by columns must be selected for IN queries (CASSANDRA-4911)
2.0.5
http://git-wip-us.apache.org/repos/asf/cassandra/blob/872eef3d/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/872eef3d/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------