"operator" is a reserved name in C++, so I decided to name this class
"operator_type".
Note: NEQ.reverse() returns NEQ in Origin. I'm not sure if it's a bug
or not, I replicated it as is.
It's a workaround for C++ not supporting covariant return types with
smart pointers.
When callers know that they call prepare() on column_identifier, they
expect shared_ptr<column_identifier>. But prepare() comes form
abstract base class, and is defined to return shared_ptr<selectable>,
where "selectable" is ancestor of column_identifier.
We can avoid dynamic_cast<> here by calling a non-polymorphic
prepare_column_identifier() when the type is known.
Needed from modification_statement::parsed::prepare().
The method may defer so the result is wrapped in future<>.
I think we don't need to wrap arguments in shared_ptr<> because they
may come from the request state object.
validate_cql_key() is based on validate_key() from ThriftValidation. I
didn't name it thrift_validation.hh though because it's meant to work
on CQL model, not thrift. For instance, it's using our
schema::partition_key_type, which is not thrift-compatible.
The problem is that while we are converting some code, we don't want
to convert some aspects of it. For example we don't want to implement
indexing supporting yet. To better track those places, we insert a
statement in those places which can be easily tracked down when the
time comes. This patch adds a header where those statements are
grouped.
Alternative is to use comments, but comments are free text so we
can't force common syntax on them.
This model is meant to follow CQL more closely than the model in
Origin. We have direct representations for CQL rows and cells.
We avoid using thrift concepts here. Here's how some of the Origin's
classes map to this:
Mutation -> mutation
ColumnFamily -> partition
CellName -> clustering_key/clustering_prefix and column_id
Cell -> atomic_cell (not for collection types though)
Note about CounterMutation. CounterMutation is for modifying counter
tables. A counter table can only have one column, the counter
value. In Origin CounterMutation is a subclass of IMutation which
represents mutations on counter tables. The only field it adds is
consistency level. I think we don't need to have a separate class for
this, at least in the generic code, which simplifies things. We can
check whether the table is a counter table from the schema and we can
pass the consistency level from QueryOptions during serialization.