cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [4/5] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
Date Fri, 20 Nov 2015 14:12:52 GMT
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/84750421
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/84750421
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/84750421

Branch: refs/heads/cassandra-3.1
Commit: 84750421a90a0aa46ff067b683152138e442a448
Parents: 8a0615b b0fd517
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Nov 20 15:12:16 2015 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Fri Nov 20 15:12:16 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt  |  1 +
 bin/cqlsh.py | 28 ++++++++++++++++++++++------
 2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/84750421/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index d6f0379,146a0ce..a9b3f36
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -9,7 -3,16 +9,8 @@@ Merged from 2.2
   * Fix SimpleDateType type compatibility (CASSANDRA-10027)
   * (Hadoop) fix splits calculation (CASSANDRA-10640)
   * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
 - * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
 - * Use most up-to-date version of schema for system tables (CASSANDRA-10652)
 - * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628)
 - * Expose phi values from failure detector via JMX and tweak debug
 -   and trace logging (CASSANDRA-9526)
 - * Fix RangeNamesQueryPager (CASSANDRA-10509)
 - * Deprecate Pig support (CASSANDRA-10542)
 - * Reduce contention getting instances of CompositeType (CASSANDRA-10433)
  Merged from 2.1:
+  * (cqlsh) Support counters in COPY commands (CASSANDRA-9043)
   * Try next replica if not possible to connect to primary replica on
     ColumnFamilyRecordReader (CASSANDRA-2388)
   * Limit window size in DTCS (CASSANDRA-10280)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/84750421/bin/cqlsh.py
----------------------------------------------------------------------
diff --cc bin/cqlsh.py
index 793afe5,41672c0..328ba30
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@@ -2328,12 -2259,19 +2328,19 @@@ class ImportProcess(mp.Process)
          table_meta = new_cluster.metadata.keyspaces[self.ks].tables[self.cf]
  
          pk_cols = [col.name for col in table_meta.primary_key]
 -        cqltypes = [table_meta.columns[name].typestring for name in self.columns]
 +        cqltypes = [table_meta.columns[name].cql_type for name in self.columns]
          pk_indexes = [self.columns.index(col.name) for col in table_meta.primary_key]
-         query = 'INSERT INTO %s.%s (%s) VALUES (%%s)' % (
-             protect_name(self.ks),
-             protect_name(self.cf),
-             ', '.join(protect_names(self.columns)))
+         is_counter_table = ("counter" in cqltypes)
+ 
+         if is_counter_table:
+             query = 'UPDATE %s.%s SET %%s WHERE %%s' % (
+                 protect_name(table_meta.keyspace_name),
+                 protect_name(table_meta.name))
+         else:
+             query = 'INSERT INTO %s.%s (%s) VALUES (%%s)' % (
+                 protect_name(table_meta.keyspace_name),
+                 protect_name(table_meta.name),
+                 ', '.join(protect_names(self.columns)))
  
          # we need to handle some types specially
          should_escape = [t in ('ascii', 'text', 'timestamp', 'date', 'time', 'inet') for
t in cqltypes]


Mime
View raw message