-
Notifications
You must be signed in to change notification settings - Fork 80
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
Conversation
@@ -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); |
There was a problem hiding this comment.
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
…nd structured into modular functions
There was a problem hiding this 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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 >>>
)
Added logic to check whether the field list frame is a list or single frame during RNTuple header deserialization.