Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions demo/node/rntuple_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { readHeaderFooter } from 'jsroot/rntuple';


console.log(`JSROOT version ${version}`);
// let file = await openFile('https://jsroot.gsi.de/files/tmp/ntpl001_staff.root');

let file = await openFile('https://jsroot.gsi.de/files/tmp/ntpl001_staff.root');
let file = await openFile('./simple.root');
Copy link
Member

Choose a reason for hiding this comment

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

If you using local simple.root file - please add it to PR, otherwise tests will fail

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, why did they not fail in the CI? Are the rntuple tests not run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The tests in rntuple_test file are kind of like a checker for the fields and columns if they did not match for ntupl_staff001 it will answer like expected the first field as category but got doubles

Copy link
Collaborator Author

@Krmjn09 Krmjn09 Jun 26, 2025

Choose a reason for hiding this comment

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

So the tests are running in my terminal but gives failure instead of Ok

Copy link
Collaborator Author

@Krmjn09 Krmjn09 Jun 26, 2025

Choose a reason for hiding this comment

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

I think it's passing all checks even if the simple.root is not in GitHub because I haven't still added rntuple_test.js in jsroot ci.yml file yet

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will do that as soon as possible


let rntuple = await file.readObject('Staff');
let rntuple = await file.readObject('myNtuple');

await readHeaderFooter(rntuple);

Expand Down
36 changes: 34 additions & 2 deletions modules/rntuple.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,15 @@

this.pageLocations = clusterPageLocations;
}
deserializePage(blob) {
const reader = new RBufferReader(blob);
console.log('Deserializing first 10 double values from data page ')

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (18.x)

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (20.x)

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (22.x)

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-macos (22.x)

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (20.x)

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

GitHub Actions / build-windows (18.x)

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon

Check warning on line 500 in modules/rntuple.mjs

View workflow job for this annotation

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

Missing semicolon
for (let i = 0; i < 10; ++i) {
const val = reader.readF64();
console.log(val);
}
}


}

Expand Down Expand Up @@ -527,7 +536,7 @@
tuple.builder.deserializeHeader(header_blob);

tuple.builder.deserializeFooter(footer_blob);

// Deserialize the Page List Envelope
const group = tuple.builder.clusterGroups?.[0];
if (!group || !group.pageListLocator)
throw new Error('No valid cluster group or page list locator found');
Expand All @@ -545,7 +554,30 @@
throw new Error(`Unzipped page list is not a DataView, got ${Object.prototype.toString.call(unzipped_blob)}`);

tuple.builder.deserializePageList(unzipped_blob);
return true;

// Read the first page data
const firstPage = tuple.builder?.pageLocations?.[0]?.[0]?.pages?.[0];
if (!firstPage || !firstPage.locator)
throw new Error('No valid first page found in pageLocations');

const pageOffset = Number(firstPage.locator.offset),
pageSize = Number(firstPage.locator.size),
uncompressedPageSize = 8000;
console.log('Compressed size :', pageSize);

return tuple.$file.readBuffer([pageOffset, pageSize]).then(compressedPage => {
if (!(compressedPage instanceof DataView))
throw new Error('Compressed page readBuffer did not return a DataView');

return R__unzip(compressedPage, uncompressedPageSize).then(unzippedPage => {
if (!(unzippedPage instanceof DataView))
throw new Error('Unzipped page is not a DataView');

tuple.builder.deserializePage(unzippedPage);

return true;
});
});
});
});
});
Expand Down