Well, there is a possibility that you're somehow putting the wrong stuff into your thrift object at some point. If you do that and try to serialize it, older versions of Thrift would silently fail after putting the first bunch of bytes onto the wire. Later versions introduced the type checking option to resolve this issue. You can turn it on via Thrift.type_checking = true.

-Bryan

On Apr 5, 2009, at 9:46 AM, William Hatch wrote:

Yes, I'm seeing a zero length list on the java side. The second array shouldn't even be visible as it's another list included in an Run object that should be in the first (currently zero length) list. As I'm pretty much a ruby newbie, here's the lines in case I'm doing something wrong; but first a little more context

Top level thrift object is BroadcastData, it has a list attribute called runs of type Run, which in turn has a list attribute called events of type Event. There's some helper objects here, *Creator's, that just wrap up creating the thrift objects from the source csv files and printing debug values, etc. The current problems, restated, are that BroadcastData's run array is considered null/zero length when deserialized using java, and, the missing Runs' events array, owned by the same non present Run object, is showing up in the BroadcastData structure even though it's parent Run object, which should be in the BroadcastData's runs array, isn't there. I hope that makes sense;-)

@broadcastArray = CSV.parse(File.read('TestData/TestDataSource/ BroadcastData-BroadcastTable.csv')) @broadcastArray.each { |row| puts row.inspect if @broadcastArray.index(row) == 1 } #just to print the values from the csv excluding the headers
aBroadcastCreator = BroadcastCreator.new(@broadcastArray[1] )
broadcastThrift = aBroadcastCreator.aBroadcastData #get our top level thrift object runsArray = CSV.parse(File.read('TestData/TestDataSource/RunData- RunTable.csv'))
runsArray.each {|row| puts row.inspect if runsArray.index(row) == 1}
aRunCreator = RunCreator.new(runsArray[1]) #for the test, we only care about the first non header row and only create one RunCreator
aRun = aRunCreator.aThriftRun # get our thrift run
puts "The aRun is: #{aRun}" #print the id so we can compare later on
eventArray = CSV.parse(File.read('TestData/TestDataSource/EventData- EventTable.csv'))
puts "The count of events in array is: #{eventArray.size}"
eventArray.each {|row| aRun.events.push(EventCreator.new (row).anEvent) if eventArray.index(row) > 0} #push all the Event rows into our Run.events array puts "After shoving all the events onto the run's event array, it's count is: #{aRun.events.size}" broadcastThrift.runs.push(aRun) #finally push our Run into BroadcastDatas' runs array BroadcastCreator::printBroadcastData(broadcastThrift) #some debug printing stuff puts "The BroadcastData has #{broadcastThrift.runs.size} run, # {broadcastThrift.runs.at(0)}" #this all checks out; size of 1; Run id matches previous debug
aSerializer = Thrift::Serializer.new
binaryBroadcastData = aSerializer.serialize(broadcastThrift)

...send to the server where it fails

Thanks.

William Hatch
[email protected]



On Apr 5, 2009, at 2:18 AM, David Reiss wrote:

William sent me the data off-list.  The output of thrift_dump is
attached.  I see one list of length zero, and one list of length 36.
Is this what you are seeing on the Java side, or are both lists zero?
If it is the former, then it looks like there is a problem with the writer,
and I'll have to defer to the Ruby folks.

--David

David Reiss wrote:
Would you mind emailing your .thrift file and the binary blob sent to
the server?  I'll pipe it to thrift_dump (under contrib) to take a
look to see if the Trips are actually there. Or you can do this yourself
if you want, assuming you can build the C++ libraries.

--David

William Hatch wrote:
Hi Bryan,

Thrift version 20080411-r761018


Now, I just updated the source and rebuilt and installed it the other day, but that output isn't looking very good if my assumption that the first part is a date string. Updating just now brought it up to rev
761976

Bill
On Apr 4, 2009, at 12:47 PM, Bryan Duxbury wrote:

What version of Thrift are you using?

-Bryan

On Apr 4, 2009, at 9:31 AM, William Hatch wrote:

Using the same thrift templates to create Ruby and Java class
files. I have a Vehicle object that has an array of Trip objects as
an attribute. If I create the ruby Vehicle object, push some Trip
objects into it's trips array, serialize it, send it across the
wire (as simple binary data in a post request, not using thrift for
that) the java deserialized object will give me a zero count for
the Vehicles' trips list, the previously added Trip is not there.
I've confirmed on the ruby side prior to serialization that it is
there. Any pointers? I should point out that I'm able to make this happen from cocoa to java no problem, using the same templates for
generation. Thanks.


William Hatch



{
 01:  (string) = "2009-04-04T10:10:20-0400",
 02:  (bool) = true,
 03:  (bool) = true,
 04:  (double) = 111.222,
 05:  (double) = 122.0564,
 06:  (double) = 255.3968,
 07:  (double) = -200,
 08:  (double) = -100,
 09:  (list) = list<struct>[1] {
   [0] =  {
     01:  (string) = "258693",
     02:  (string) = "1",
     03:  (i64) = 300,
     04:  (string) = "2009-04-03T11:50:32-0400",
     05:  (i16) = 180,
     06:  (bool) = true,
     07:  (bool) = true,
     08:  (bool) = true,
     09:  (bool) = true,
     10:  (bool) = true,
     11:  (i16) = 1,
     12:  (i16) = 1,
     13:  (i16) = 1,
     14:  (list) = list<struct>[0] {
     },
     15:  (list) = list<struct>[36] {
       [0] =  {
         01:  (string) = "1",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [1] =  {
         01:  (string) = "2",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [2] =  {
         01:  (string) = "3",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [3] =  {
         01:  (string) = "4",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [4] =  {
         01:  (string) = "5",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [5] =  {
         01:  (string) = "6",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [6] =  {
         01:  (string) = "7",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [7] =  {
         01:  (string) = "8",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [8] =  {
         01:  (string) = "9",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [9] =  {
         01:  (string) = "10",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [10] =  {
         01:  (string) = "11",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [11] =  {
         01:  (string) = "12",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [12] =  {
         01:  (string) = "13",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [13] =  {
         01:  (string) = "14",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [14] =  {
         01:  (string) = "15",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [15] =  {
         01:  (string) = "16",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [16] =  {
         01:  (string) = "17",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [17] =  {
         01:  (string) = "18",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [18] =  {
         01:  (string) = "19",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [19] =  {
         01:  (string) = "20",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [20] =  {
         01:  (string) = "21",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [21] =  {
         01:  (string) = "22",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [22] =  {
         01:  (string) = "23",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [23] =  {
         01:  (string) = "24",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [24] =  {
         01:  (string) = "25",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [25] =  {
         01:  (string) = "26",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [26] =  {
         01:  (string) = "27",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [27] =  {
         01:  (string) = "28",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [28] =  {
         01:  (string) = "29",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [29] =  {
         01:  (string) = "30",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [30] =  {
         01:  (string) = "31",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [31] =  {
         01:  (string) = "32",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [32] =  {
         01:  (string) = "33",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 0,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [33] =  {
         01:  (string) = "34",
         02:  (string) = "UIApplicationDidFinishLaunching",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 1,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [34] =  {
         01:  (string) = "35",
         02:  (string) = "MyCustomEvent",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 2,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
       [35] =  {
         01:  (string) = "36",
         02:  (string) = "UIApplicationWillTerminateNotification",
         03:  (string) = "2009-04-03T14:23:24-0400",
         04:  (i32) = 3,
         05:  (i16) = 1,
         06:  (i16) = 1,
         07:  (i16) = 1,
         08:  (double) = 122,
         09:  (double) = 133,
         10:  (double) = 10,
         11:  (i16) = 0,
         12:  (i16) = 0,
         14:  (double) = 1,
         15:  (double) = 1,
       },
     },
     16:  (string) = "",
   },
 },
} {



Reply via email to