fury
fury copied to clipboard
[Question] Constructing a BinaryRow from serialized bytes
Question
I was looking for a way to re-create a BinaryRow object from a previously serialized bytes, but couldn't find it. The row format guide has an example of converting an object into a BinaryRow, which is not quite what I need.
What I am looking for is the following workflow:
- Serialize my object into a byte array
- Store the byte array... somewhere
- Retrieve the byte array later on
- Construct a
BinaryRowfrom the byte array - Access parts of the original objects via the
BinaryRowas shown in the guide without necessarily reconstructing the entire object
Any chance someone can tell me how to do that? An update to the guide would be awesome, too.
Hi @MC-2016 , to construct a BinaryRow, you can take following code as an example:
byte[] serializedBytes = xxx;
Schema schema = xxx;
BinaryRow newRow = new BinaryRow(schema);
MemoryBuffer buffer = MemoryBuffer.fromByteArray(serializedBytes);
newRow.pointTo(buffer, 0, buffer.size());