cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Holmberg (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-11274) cqlsh: interpret CQL type for formatting blob types
Date Tue, 01 Mar 2016 21:03:18 GMT


Adam Holmberg commented on CASSANDRA-11274:

Looks good. One minor change I noted: inet is now being formatted green instead of yellow.
It actually looks like it wasn't hitting 
{{@formatter_for('inet')}} in previously, and now it is. I guess this is probably correct,
but I'm just pointing out the difference.

bq. cassandra.cqltypes.DateType.deserialize. This has nothing to do with formatting and so
I did not change it. Will this cause us problems when running the driver with cython extensions?
Yes. It's not to do with formatting, but it does handle what happens when the stored value
overflows the date range that Python can handle in datetime. Right now we have a problem with
or without Cython when querying large timestamps (insert '10000-01-02' for example).
Without Cython, the formatter assumptions fail:
Failed to format value 253402408800000 : 'int' object has no attribute 'utctimetuple'
It actually still ends up printing the numerical value just like the overridden deserializer
would, just with that error printed. Maybe this is ok.

With Cython, the deserializer has the same overflow that the patch is working around:
try timestamp (DateType) overflow
    OverflowError: date value out of range
(cross-reference CASSANDRA-10625)
We would need to remove the Cython deserializer and fall back to the patched version, or replace
it with a new Cython counterpart that does the same thing.

> cqlsh: interpret CQL type for formatting blob types
> ---------------------------------------------------
>                 Key: CASSANDRA-11274
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Tools
>            Reporter: Stefania
>            Assignee: Stefania
>             Fix For: 3.x
> During the development of CASSANDRA-11053 we have added changes to the cqlsh formatting
code so that we can format {{blob}} types correctly even if they are represented as {{str}}
rather than {{bytearray}}.
> At the moment we ensure {{blob}} are of type {{bytearray}} via the following shortcut:
> {code}
> cassandra.cqltypes.BytesType.deserialize = staticmethod(lambda byts, protocol_version:
> {code}
> After CASSANDRA-11053 is committed there will be a similar shortcut to override the fast
serializers implemented in cython. 
> Decoding the CQL type is safer in that it decouples cqlsh formatting from the types returned
by the driver deserializers but it is also unnecessary for CASSANDRA-11053 performance goals
and risky for older releases. 
> Therefore this ticket delivers this functionality but only on trunk.

This message was sent by Atlassian JIRA

View raw message