Skip to content

feature/deserializing-header #334

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

Closed

Conversation

Krmjn09
Copy link
Collaborator

@Krmjn09 Krmjn09 commented Jun 12, 2025

Added logic to check whether the field list frame is a list or single frame during RNTuple header deserialization.

@linev linev requested a review from silverweed June 12, 2025 07:37
@@ -123,13 +125,13 @@ deserializeHeader(header_blob) {

// verify all feature flags are zero
if (this.featureFlags.some(v => v !== 0n))
console.warn('Unexpected non-zero feature flags:', this.featureFlags);
throw new Error('Unexpected non-zero feature flags: ' + this.featureFlags);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please indent this line properly

Copy link
Contributor

@silverweed silverweed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! There are still a couple of things I'd like to discuss with also Sergey before merging, but we're almost there.
In the meantime if you can properly format the code (I think you can use eslint for that), that would help.

@@ -62,3 +62,28 @@ else
else
console.error('FAILURE: test 3 - readString does not match');
}
if (!rntuple.builder?.fieldDescriptors?.length)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this rntuple variable come from? I don't see any place where it is created, so this test will always fail right now.
Let's discuss later today with @linev how to setup the reading of a ROOT file that can give you a proper RNTupleDescriptorBuilder in the test.

console.log(`OK: ${rntuple.builder.fieldDescriptors.length} field(s) deserialized`);
for (let i = 0; i < rntuple.builder.fieldDescriptors.length; ++i) {
const field = rntuple.builder.fieldDescriptors[i];
if (!field.fieldName || !field.typeName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we'll have a real known RNTuple that we'll be deserializing above, here you should also check the specific name and type of the fields, instead of just verifying they exist.

// Envelope metadata
// The 16 bits are the envelope type ID, and the 48 bits are the envelope length
this.envelopeType = Number(typeAndLength & 0xFFFFn);
this.envelopeLength = Number((typeAndLength >> 16n) & 0xFFFFFFFFFFFFn);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be Number(typeAndLength >>> 16n) since the unsigned right shift will zero the upper bits. (important to use the triple >>>)

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

Successfully merging this pull request may close these issues.

3 participants