Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions modules/rntuple.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ class RBufferReader {

class RNTupleDescriptorBuilder {

// Envelope Types
static kEnvelopeTypeHeader = 0x01;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would define these outside the class as const, to avoid them being mutable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok i will do that

static kEnvelopeTypeFooter = 0x02;
static kEnvelopeTypePageList = 0x03;
// Field Flags
static kFlagRepetitiveField = 0x01;
static kFlagProjectedField = 0x02;
static kFlagHasTypeChecksum = 0x04;
// Column Flags
static kFlagDeferredColumn = 0x01;
static kFlagHasValueRange = 0x02;

deserializeHeader(header_blob) {
if (!header_blob) return;

Expand Down Expand Up @@ -246,9 +258,15 @@ class RNTupleDescriptorBuilder {
sourceFieldId = null,
checksum = null;

if (flags & 0x1) arraySize = reader.readU64();
if (flags & 0x2) sourceFieldId = reader.readU32();
if (flags & 0x4) checksum = reader.readU32();
if (flags & RNTupleDescriptorBuilder.kFlagRepetitiveField)
arraySize = reader.readU64();

if (flags & RNTupleDescriptorBuilder.kFlagProjectedField)
sourceFieldId = reader.readU32();

if (flags & RNTupleDescriptorBuilder.kFlagHasTypeChecksum)
checksum = reader.readU32();


fieldDescriptors.push({
fieldVersion,
Expand Down Expand Up @@ -289,8 +307,11 @@ class RNTupleDescriptorBuilder {
let firstElementIndex = null,
minValue = null,
maxValue = null;
if (flags & 0x1) firstElementIndex = reader.readU64();
if (flags & 0x2) {

if (flags & RNTupleDescriptorBuilder.kFlagDeferredColumn)
firstElementIndex = reader.readU64();

if (flags & RNTupleDescriptorBuilder.kFlagHasValueRange) {
minValue = reader.readF64();
maxValue = reader.readF64();
}
Expand All @@ -307,7 +328,7 @@ class RNTupleDescriptorBuilder {
maxValue
};
column.isDeferred = function() {
return (this.flags & 0x01) !== 0;
return (this.flags & RNTupleDescriptorBuilder.kFlagDeferredColumn) !== 0;
};
column.isSuppressed = function() {
return this.firstElementIndex !== null && this.firstElementIndex < 0;
Expand Down