Skip to content

Feature alias extra info added #338

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

Merged
merged 2 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 19 additions & 1 deletion demo/node/rntuple_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ else {
console.error(`FAILURE: Field ${i} is missing name or type`);
else
console.log(`OK: Field ${i}: ${field.fieldName} (${field.typeName})`);
if (i === 0) {
if (field.fieldName !== 'Category' || field.typeName !== 'std::int32_t')
console.error(`FAILURE: First field should be 'Category (std::int32_t)' but got '${field.fieldName} (${field.typeName})'`);

} else if (i === rntuple.builder.fieldDescriptors.length - 1){
if (field.fieldName !== 'Nation' || field.typeName !== 'std::string')
console.error(`FAILURE: Last field should be 'Nation (std::string)' but got '${field.fieldName} (${field.typeName})'`);

}
}

}

// Column Check
Expand All @@ -52,10 +62,18 @@ else {
console.log(`OK: ${rntuple.builder.columnDescriptors.length} column(s) deserialized`);
for (let i = 0; i < rntuple.builder.columnDescriptors.length; ++i) {
const column = rntuple.builder.columnDescriptors[i];
if (!column.fieldId)
if (column.fieldId === undefined || column.fieldId === null)
console.error(`FAILURE: Column ${i} is missing fieldId`);
else
console.log(`OK: Column ${i} fieldId: ${column.fieldId} `);
if (i === 0) {
if (column.fieldId !== 0)
console.error(`FAILURE: First column should be for fieldId 0 (Category)`);
} else if (i === rntuple.builder.columnDescriptors.length - 1){
if (column.fieldId !== 10)
console.error(`FAILURE: Last column should be for fieldId 10 (Nation)`);
}
}
}


47 changes: 47 additions & 0 deletions modules/rntuple.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@

// List frame: list of column record frames
this._readColumnDescriptors(reader);
// Read alias column descriptors
this._readAliasColumn(reader);
// Read Extra Type Information
this._readExtraTypeInformation(reader);
}

deserializeFooter(footer_blob) {
Expand Down Expand Up @@ -267,6 +271,49 @@
}
this.columnDescriptors = columnDescriptors;
}
_readAliasColumn(reader){
const aliasColumnListSize = reader.readS64(); // signed 64-bit
const aliasListisList = aliasColumnListSize < 0;

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (18.x)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (18.x)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (22.x)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (20.x)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (20.x)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (18.x, g++-14)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (18.x, g++-13)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (20.x, g++-12)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (22.x, g++-14)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (20.x, g++-13)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (22.x, g++-12)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (20.x, g++-14)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (18.x, g++-12)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (22.x, g++-13)

Combine this with the previous 'const' statement

Check warning on line 276 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (22.x)

Combine this with the previous 'const' statement
if (!aliasListisList)
throw new Error('Alias column list frame is not a list frame, which is required.');
const aliasColumnCount = reader.readU32(); // number of alias column entries
console.log('Alias Column List Count:', aliasColumnCount);
const aliasColumns = [];
for (let i = 0; i < aliasColumnCount; ++i){
const aliasColumnRecordSize = reader.readS64(),
physicalColumnId = reader.readU32(),
fieldId = reader.readU32();
console.log(`Alias Column Record Size: ${aliasColumnRecordSize}`);
aliasColumns.push({
physicalColumnId,
fieldId
});
}
this.aliasColumns = aliasColumns;
}
_readExtraTypeInformation(reader) {
const extraTypeInfoListSize = reader.readS64(); // signed 64-bit
const isList = extraTypeInfoListSize < 0;

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (18.x)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (18.x)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (22.x)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (20.x)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (20.x)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (18.x, g++-14)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (18.x, g++-13)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (20.x, g++-12)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (22.x, g++-14)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (20.x, g++-13)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (22.x, g++-12)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (20.x, g++-14)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (18.x, g++-12)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-ubuntu (22.x, g++-13)

Combine this with the previous 'const' statement

Check warning on line 296 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (22.x)

Combine this with the previous 'const' statement

if (!isList)
throw new Error('Extra type info frame is not a list frame, which is required.');

const entryCount = reader.readU32();
console.log('Extra Type Info Count:', entryCount);

const extraTypeInfo = [];
for (let i = 0; i < entryCount; ++i) {
const extraTypeInfoRecordSize = reader.readS64(),
contentId = reader.readU32(),
typeVersion = reader.readU32();
console.log(`Extra Type Info Record Size: ${extraTypeInfoRecordSize}`);
extraTypeInfo.push({
contentId,
typeVersion
});
}
this.extraTypeInfo = extraTypeInfo;
}

}

Expand Down