diff --git a/conf/1.0/schema.json b/conf/1.0/schema.json index f98f69e..f597858 100755 --- a/conf/1.0/schema.json +++ b/conf/1.0/schema.json @@ -61,6 +61,9 @@ "SuperUUID":{ "subcomparator_type":"org.apache.cassandra.db.marshal.TimeUUIDType", "comparator_type":"org.apache.cassandra.db.marshal.TimeUUIDType", - "column_type":"Super"} + "column_type":"Super"}, + "CompositeColumnConversion":{ + "comparator_type":"org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.IntegerType,org.apache.cassandra.db.marshal.UTF8Type)", + "column_type":"Standard"} } } diff --git a/conf/1.0/schema.txt b/conf/1.0/schema.txt index 52edcc9..8f706d0 100755 --- a/conf/1.0/schema.txt +++ b/conf/1.0/schema.txt @@ -48,4 +48,4 @@ create keyspace TypeConversions with use TypeConversions; create column family UUIDColumnConversion with comparator = TimeUUIDType; create column family SuperUUID with comparator = TimeUUIDType and column_type = Super; - +create column family CompositeColumnConversion with comparator = 'CompositeType(IntegerType, UTF8Type)'; diff --git a/lib/cassandra/composite.rb b/lib/cassandra/composite.rb index a933702..fabcd05 100644 --- a/lib/cassandra/composite.rb +++ b/lib/cassandra/composite.rb @@ -106,6 +106,13 @@ def valid_packed_composite?(packed_string) end return true end + + def hash + return to_s.hash + end + + def eql?(other) + return to_s == other.to_s + end end end - diff --git a/test/cassandra_test.rb b/test/cassandra_test.rb index 3e72409..95bc8f9 100755 --- a/test/cassandra_test.rb +++ b/test/cassandra_test.rb @@ -877,9 +877,10 @@ def test_composite_column_type_conversion ).keys assert_equal(columns_in_order[0..-2], column_slice) + assert_equal('value-2', @type_conversions.get(:CompositeColumnConversion, key, columns_in_order.first)) end end - + def test_column_timestamps base_time = Time.now @twitter.insert(:Statuses, "time-key", { "body" => "value" })