RC.insert: Update functions to insert data into Cassandra

Description Usage Arguments Value Note Author(s) See Also

Description

RC.insert updates or inserts new column/value pairs

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

Usage

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

Arguments

conn

connection handle obtained from RC.connect

c.family

name of the column family (string)

key

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

column

column name - any vector supported by the comparator

value

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

comparator

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

validator

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

mutation

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.

Value

conn

Note

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.

Author(s)

Simon Urbanek

See Also

RC.connect, RC.use, RC.get


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