br1ghtyang / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

RecordBuilder and ARecordSerDe need to work properly together #611

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
RecordBuilder allows one to build a record by adding fields in any order while 
still conforming to a particular record type. However, if the fields are added 
in an order that does not match the order of the fields defined in the type, 
then the ARecordSerializerDeserializer will not be able to deserialize the 
record.

Example:
Suppose my record type is as follows:
{
id: int,
name: string
}

Then suppose I build the following record using the RecordBuilder:
{
"name": "zach",
"id": 1
}

The name field will be serialized first, followed by the id field. But, when 
the serde goes to deserialize this record, it will try to deserialize the name 
field (the first field in the serialized format) with an int deserializer (the 
first deserializer in the list defined by the record type).

Original issue reported on code.google.com by zheilb...@gmail.com on 13 Aug 2013 at 11:25

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 15 Aug 2013 at 11:09

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 16 Aug 2013 at 12:02

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 4 Oct 2013 at 4:25

GoogleCodeExporter commented 8 years ago
This should be solved in the RecordBuilder by having it maintain the order 
properly.

Original comment by zheilb...@gmail.com on 4 Oct 2013 at 10:35

GoogleCodeExporter commented 8 years ago
Looking at the code, ARecordSerDe is clearly broken when it comes to handling 
open types. The serialization logic would only work for closed types, while 
deserialization logic has been written to handle open types as well. 
There is a clear asymmetry in this class. Would investigate if we need to keep 
this class and if not, how to resolve the dependent code. 

Original comment by RamanGro...@gmail.com on 16 Nov 2013 at 2:44