RC.insert: Update functions to insert data into Cassandra

Description Usage Arguments Value Note Author(s) See Also


RC.insert updates or inserts new column/value pairs

RC.mutate batchwise updates or inserts a list of keys, column families and columns/values.


RC.insert(conn, c.family, key, column, value = NULL,
          comparator = NULL, validator = NULL)
RC.mutate(conn, mutation)



connection handle obtained from RC.connect


name of the column family (string)


row key name (string) or a vector of (preferably contiguous) keys to use with the column names vector


column name - any vector supported by the comparator


optinally values to add into the columns - if specified, must be the same length as column. If NULL only the column is created


comparator (column name type) to be used - see RC.get for details


validator (value type) to be used - see RC.get for details


a structure describing the desired mutation (see Cassandra documentation). In its simplest form it is a nested list: list(row.key1=list(c.family1=list(col1=val1, ...), ...), ...) so to add column "foo" with value "bar" to column family "table" and row "key" the mutation would be list(key=list(table=list(foo="bar"))). The innermost list can optionally be a character vector (if unnamed it specifies the column names, otherwise names are column names and elements are values). Only string keys and column names are supproted.




RC.insert supports multi-column insertions where column and value are vectors. For the scalar case insert message is used, for vector case batch_mutate. If key is a scalar, all column/value pairs are added to that row key. Alternatively, key can be a vector of the same length as column in which case the mutation will consist of key/column/value triplets. Note that key should be contiguous as the mutation will only group contiguous sequences (see coalesce from the fastmatch package for a fast way of obtaining contiguous sequences).

RC.insert honors both the validator and comparator (the latter is taken from the cache if not specified).

RC.mutate currently only uses "UTF8Type" validator and comparator as there is no way to specify either in the mutation object.

Cassandra requires timestamps on all objects that specify columns/values for conflict resolution. All functions above generate such timestamps from the system time as POSIX time in milliseconds.


Simon Urbanek

See Also

RC.connect, RC.use, RC.get

RCassandra documentation built on May 2, 2019, 10:10 a.m.