Skip to content

Commit

Permalink
Fixed fetching a single composite column
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Mueller committed Feb 23, 2012
1 parent c675857 commit a7e1004
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion conf/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
}
}
2 changes: 1 addition & 1 deletion conf/1.0/schema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
9 changes: 8 additions & 1 deletion lib/cassandra/composite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

3 changes: 2 additions & 1 deletion test/cassandra_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" })
Expand Down

0 comments on commit a7e1004

Please sign in to comment.