You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Roberto Ostinelli (Created) (JIRA)" <ji...@apache.org> on 2011/12/19 22:15:30 UTC

[jira] [Created] (THRIFT-1470) Thrift generates wrong Erlang specs out of the Cassandra interface

Thrift generates wrong Erlang specs out of the Cassandra interface
------------------------------------------------------------------

                 Key: THRIFT-1470
                 URL: https://issues.apache.org/jira/browse/THRIFT-1470
             Project: Thrift
          Issue Type: Bug
    Affects Versions: 0.8
         Environment: OSX Snow Leopard, Thrift 0.8, Cassandra 1.0.5, Erlang R14B04 
            Reporter: Roberto Ostinelli


I'm building an Erlang CQL client for Cassandra (https://github.com/ostinelli/erlcassa). I've generated the Erlang Thrift code with the command:
thrift --gen erl cassandra/interface/cassandra.thrift

One of the generate files, cassandra_types.hrl, seems to have incorrect record definitions. To be more precise:

-record(cqlMetadata, {name_types = dict:new() :: dict(),
                     value_types = dict:new() :: dict(),
                     default_name_type = undefined :: string(),
                     default_value_type = undefined :: string()}).


-record(column, {name = undefined :: string(),
                value = undefined :: string(),
                timestamp = undefined :: integer(),
                ttl = undefined :: integer()}).

These two records specify string() in name and value columns, but the real returned values from Cassandra are binary(). Not sure about it, but every time there's a string() specification in this file, it really seems that it should be binary(), which is what Thrift calls return from Cassandra.

Also, the default_name_type and default_value_type of cqlMetadata can actually be undefined (when the record first gets created, these are not specified and hence are undefined).

These specs being incorrect, Dialyzer complains while performing checks on code built on top of these specs.

Here are the specs corrected in a way that make Dialyzer pass the tests:
https://github.com/ostinelli/erlcassa/blob/master/include/cassandra_types.hrl

Yet again, many of the string() specs on the cassandra_types.hrl file have been left untouched as I've not has the chance to dig if changes are needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1470) Thrift generates wrong Erlang specs out of the Cassandra interface

Posted by "Jens Geyer (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173552#comment-13173552 ] 

Jens Geyer commented on THRIFT-1470:
------------------------------------

The issue is somewhat larger, IMHO. 

The following generators neatly distinguish TYPE_STRINGs between type->is_binary() and such who aren't: AS3, C_GLIB, COCOA, C#, DELPHI, HS, JAVA, JAVAME, PY.

All other generatores do not do this and map both "string" and "binary" to the appropriate string type. And last not least, the Wiki states, that "binary" will be promoted into a native type at some time.

$0,02
JensG



                
> Thrift generates wrong Erlang specs out of the Cassandra interface
> ------------------------------------------------------------------
>
>                 Key: THRIFT-1470
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1470
>             Project: Thrift
>          Issue Type: Bug
>    Affects Versions: 0.8
>         Environment: OSX Snow Leopard, Thrift 0.8, Cassandra 1.0.5, Erlang R14B04 
>            Reporter: Roberto Ostinelli
>              Labels: cassandra, cql, erlang
>
> I'm building an Erlang CQL client for Cassandra (https://github.com/ostinelli/erlcassa). I've generated the Erlang Thrift code with the command:
> thrift --gen erl cassandra/interface/cassandra.thrift
> One of the generate files, cassandra_types.hrl, seems to have incorrect record definitions. To be more precise:
> -record(cqlMetadata, {name_types = dict:new() :: dict(),
>                      value_types = dict:new() :: dict(),
>                      default_name_type = undefined :: string(),
>                      default_value_type = undefined :: string()}).
> -record(column, {name = undefined :: string(),
>                 value = undefined :: string(),
>                 timestamp = undefined :: integer(),
>                 ttl = undefined :: integer()}).
> These two records specify string() in name and value columns, but the real returned values from Cassandra are binary(). Not sure about it, but every time there's a string() specification in this file, it really seems that it should be binary(), which is what Thrift calls return from Cassandra.
> Also, the default_name_type and default_value_type of cqlMetadata can actually be undefined (when the record first gets created, these are not specified and hence are undefined).
> These specs being incorrect, Dialyzer complains while performing checks on code built on top of these specs.
> Here are the specs corrected in a way that make Dialyzer pass the tests:
> https://github.com/ostinelli/erlcassa/blob/master/include/cassandra_types.hrl
> Yet again, many of the string() specs on the cassandra_types.hrl file have been left untouched as I've not has the chance to dig if changes are needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (THRIFT-1470) Thrift generates wrong Erlang specs out of the Cassandra interface

Posted by "Jens Geyer (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173552#comment-13173552 ] 

Jens Geyer edited comment on THRIFT-1470 at 12/20/11 10:13 PM:
---------------------------------------------------------------

The issue is somewhat larger, IMHO. 

The following generators neatly distinguish TYPE_STRINGs between type->is_binary() and such who aren't: AS3, C_GLIB, COCOA, C#, DELPHI, HS, JAVA, JAVAME, PY.

All other generators seem do not do this and map both "string" and "binary" to the appropriate string type, e.g. the CPP generator. And last not least, the Wiki states, that "binary" will be promoted into a native type at some time.

$0,02
JensG



                
      was (Author: jensg):
    The issue is somewhat larger, IMHO. 

The following generators neatly distinguish TYPE_STRINGs between type->is_binary() and such who aren't: AS3, C_GLIB, COCOA, C#, DELPHI, HS, JAVA, JAVAME, PY.

All other generatores do not do this and map both "string" and "binary" to the appropriate string type. And last not least, the Wiki states, that "binary" will be promoted into a native type at some time.

$0,02
JensG



                  
> Thrift generates wrong Erlang specs out of the Cassandra interface
> ------------------------------------------------------------------
>
>                 Key: THRIFT-1470
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1470
>             Project: Thrift
>          Issue Type: Bug
>    Affects Versions: 0.8
>         Environment: OSX Snow Leopard, Thrift 0.8, Cassandra 1.0.5, Erlang R14B04 
>            Reporter: Roberto Ostinelli
>              Labels: cassandra, cql, erlang
>
> I'm building an Erlang CQL client for Cassandra (https://github.com/ostinelli/erlcassa). I've generated the Erlang Thrift code with the command:
> thrift --gen erl cassandra/interface/cassandra.thrift
> One of the generate files, cassandra_types.hrl, seems to have incorrect record definitions. To be more precise:
> -record(cqlMetadata, {name_types = dict:new() :: dict(),
>                      value_types = dict:new() :: dict(),
>                      default_name_type = undefined :: string(),
>                      default_value_type = undefined :: string()}).
> -record(column, {name = undefined :: string(),
>                 value = undefined :: string(),
>                 timestamp = undefined :: integer(),
>                 ttl = undefined :: integer()}).
> These two records specify string() in name and value columns, but the real returned values from Cassandra are binary(). Not sure about it, but every time there's a string() specification in this file, it really seems that it should be binary(), which is what Thrift calls return from Cassandra.
> Also, the default_name_type and default_value_type of cqlMetadata can actually be undefined (when the record first gets created, these are not specified and hence are undefined).
> These specs being incorrect, Dialyzer complains while performing checks on code built on top of these specs.
> Here are the specs corrected in a way that make Dialyzer pass the tests:
> https://github.com/ostinelli/erlcassa/blob/master/include/cassandra_types.hrl
> Yet again, many of the string() specs on the cassandra_types.hrl file have been left untouched as I've not has the chance to dig if changes are needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira