http://git-wip-us.apache.org/repos/asf/cassandra/blob/2b62df24/src/java/org/apache/cassandra/db/marshal/SetType.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/marshal/SetType.java b/src/java/org/apache/cassandra/db/marshal/SetType.java index 7a72fe9..1090d09 100644 --- a/src/java/org/apache/cassandra/db/marshal/SetType.java +++ b/src/java/org/apache/cassandra/db/marshal/SetType.java @@ -27,13 +27,8 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.apache.cassandra.cql3.ColumnNameBuilder; -import org.apache.cassandra.cql3.Term; -import org.apache.cassandra.cql3.UpdateParameters; -import org.apache.cassandra.db.ColumnFamily; import org.apache.cassandra.db.IColumn; import org.apache.cassandra.config.ConfigurationException; -import org.apache.cassandra.thrift.InvalidRequestException; import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.Pair; @@ -73,12 +68,12 @@ public class SetType extends CollectionType this.elements = elements; } - protected AbstractType<?> nameComparator() + public AbstractType<?> nameComparator() { return elements; } - protected AbstractType<?> valueComparator() + public AbstractType<?> valueComparator() { return EmptyType.instance; } @@ -88,41 +83,6 @@ public class SetType extends CollectionType sb.append(getClass().getName()).append(TypeParser.stringifyTypeParameters(Collections.<AbstractType<?>>singletonList(elements))); } - public void executeFunction(ColumnFamily cf, ColumnNameBuilder fullPath, Function fct, List<Term> args, UpdateParameters params) throws InvalidRequestException - { - switch (fct) - { - case ADD: - doAdd(cf, fullPath, args, params); - break; - case DISCARD_SET: - doDiscard(cf, fullPath, args, params); - break; - default: - throw new AssertionError("Unsupported function " + fct); - } - } - - public void doAdd(ColumnFamily cf, ColumnNameBuilder builder, List<Term> values, UpdateParameters params) throws InvalidRequestException - { - for (int i = 0; i < values.size(); ++i) - { - ColumnNameBuilder b = i == values.size() - 1 ? builder : builder.copy(); - ByteBuffer name = b.add(values.get(i).getByteBuffer(elements, params.variables)).build(); - cf.addColumn(params.makeColumn(name, ByteBufferUtil.EMPTY_BYTE_BUFFER)); - } - } - - public void doDiscard(ColumnFamily cf, ColumnNameBuilder builder, List<Term> values, UpdateParameters params) throws InvalidRequestException - { - for (int i = 0; i < values.size(); ++i) - { - ColumnNameBuilder b = i == values.size() - 1 ? builder : builder.copy(); - ByteBuffer name = b.add(values.get(i).getByteBuffer(elements, params.variables)).build(); - cf.addColumn(params.makeTombstone(name)); - } - } - public ByteBuffer serializeForThrift(List<Pair<ByteBuffer, IColumn>> columns) { // We're using a list for now, since json doesn't have maps