Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Constructing a BinaryRow from serialized bytes #1971

Open
MC-2016 opened this issue Dec 9, 2024 · 1 comment
Open

[Question] Constructing a BinaryRow from serialized bytes #1971

MC-2016 opened this issue Dec 9, 2024 · 1 comment
Labels
question Further information is requested

Comments

@MC-2016
Copy link

MC-2016 commented Dec 9, 2024

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 BinaryRow from the byte array
  • Access parts of the original objects via the BinaryRow as 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.

@MC-2016 MC-2016 added the question Further information is requested label Dec 9, 2024
@chaokunyang
Copy link
Collaborator

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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants