cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <>
Subject [jira] Commented: (CASSANDRA-2262) use o.a.c.marshal.*Type for CQL
Date Thu, 03 Mar 2011 17:31:37 GMT


Sylvain Lebresne commented on CASSANDRA-2262:

I don't think that matter for the purpose of this ticket, but as a remark, IntegerType doesn't
always roundtrip correctly. For example
    public void testInteger2()
        long v = 1;
        ByteBuffer bb = ByteBuffer.allocate(8);
        String s = IntegerType.instance.getString(bb);
        ByteBuffer internal = IntegerType.instance.fromString(s);
        assert internal.getLong() == v;
fails (while it works on LongType) because of the internal use of BigInteger that pack the
bytes as tightly as possible.

This is probably fine since
     IntegerType.getString(IntegerType.fromString(s)) == s
always holds. It's
     IntegerType.fromString(IntegerType.getString(b)) == b
that doesn't always hold.

Last remark, the tests of the first patch are testing the wrong equation.

> use o.a.c.marshal.*Type for CQL 
> --------------------------------
>                 Key: CASSANDRA-2262
>                 URL:
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>    Affects Versions: 0.8
>            Reporter: Eric Evans
>            Assignee: Gary Dusbabek
>            Priority: Minor
>             Fix For: 0.8
>         Attachments: v1-0001-test-shows-no-roundtrip-in-BytesType.txt, v1-0002-BytesType.fromString-expects-a-hex-string.txt,
v1-0003-compose-method-for-AbstractTypes.txt, v1-0004-assume-utf8-in-CliTest-keys-dammit.txt
>   Original Estimate: 0h
>  Remaining Estimate: 0h
> Presently, {{o.a.c.cql.Term.getByteBuffer}} manage's the conversion from a parsed term
to a {{ByteBuffer}} of the right contents, this should be moved into the individual {{AbstractType}}
subclasses (aka {{AbstractType.fromString}}).
> Additionally, a method that does the inverse (returning the string equivalent), needs
to exists such that {{AbstractType.getString(AbstractType.fromString(s)) == s}}
> Finally, for use in results decoding a method should exist that given a {{ByteBuffer}}
will return the appropriate object for that type.  For example, {{IntegerType.compose(ByteBuffer)
-> java.math.BigInteger}}, or {{LexicalUUIDType.compose(ByteBuffer) -> java.util.UUID}}.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message