Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1470

Thrift generates wrong Erlang specs out of the Cassandra interface



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 0.8
    • Fix Version/s: 0.9
    • Component/s: Erlang - Compiler
    • Labels:
    • Environment:

      OSX Snow Leopard, Thrift 0.8, Cassandra 1.0.5, Erlang R14B04


      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:


      {name_types = dict:new() :: dict(), value_types = dict:new() :: dict(), default_name_type = undefined :: string(), default_value_type = undefined :: string()}



      {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:

      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.


          Issue Links



              • Assignee:
                jking3 James E. King III
                ostinelli Roberto Ostinelli
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: