Skip to content

[ntuple] Add RNTupleLocatorMulti class for kTypeMulti locator#22577

Open
JasMehta08 wants to merge 1 commit into
root-project:masterfrom
JasMehta08:ntuple-locator-multi-class
Open

[ntuple] Add RNTupleLocatorMulti class for kTypeMulti locator#22577
JasMehta08 wants to merge 1 commit into
root-project:masterfrom
JasMehta08:ntuple-locator-multi-class

Conversation

@JasMehta08

@JasMehta08 JasMehta08 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This Pull request:

(Is a part of the GSoC 2026 project S3 Backend for RNTuple.)

Changes or fixes:

Follow-up to #22434. Introduces a dedicated RNTupleLocatorMulti class for the kTypeMulti locator, replacing the previous reuse of RNTupleLocatorObject64.

The class stores the object identifier and byte offset as two uint32_t fields and exposes them via GetObjectId() / GetOffset(). The 32/32 packing into RNTupleLocator::fPosition is the only place the in-memory layout shows up, and it lives inside SetPosition(RNTupleLocatorMulti) and RNTupleLocatorHelper<RNTupleLocatorMulti>::Get.

RNTupleLocator::SetPosition and GetPosition<> are split accordingly so RNTupleLocatorObject64 is now reserved for kTypeObject64 only, and the new RNTupleLocatorMulti overload/specialization handle kTypeMulti.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR is a follow-up #22434

@JasMehta08 JasMehta08 requested a review from jblomer as a code owner June 11, 2026 09:18
@jblomer jblomer self-assigned this Jun 11, 2026
@jblomer jblomer assigned JasMehta08 and unassigned jblomer Jun 11, 2026

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! Some simplification is possible, I think, by not storing reserved bits altogether.

Comment thread tree/ntuple/inc/ROOT/RNTupleTypes.hxx Outdated
Comment thread tree/ntuple/src/RNTupleSerialize.cxx Outdated
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 19h 7m 14s ⏱️
 3 869 tests  3 865 ✅   0 💤 4 ❌
76 423 runs  76 319 ✅ 100 💤 4 ❌

For more details on these failures, see this check.

Results for commit a78d828.

♻️ This comment has been updated with latest results.

@JasMehta08 JasMehta08 force-pushed the ntuple-locator-multi-class branch from 0d8ca56 to a78d828 Compare June 18, 2026 09:17
@JasMehta08 JasMehta08 requested a review from silverweed as a code owner June 18, 2026 09:17

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Comment thread tree/ntuple/test/ntuple_serialize.cxx Outdated
EXPECT_EQ(1U, m.GetObjectId());
EXPECT_EQ(2U, m.GetOffset());

// GetPosition<Object64>() no longer accepts kTypeMulti after the split.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// GetPosition<Object64>() no longer accepts kTypeMulti after the split.

@jblomer

jblomer commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

It would be good to also update the PR details.

Comment thread tree/ntuple/inc/ROOT/RNTupleTypes.hxx Outdated
Comment thread tree/ntuple/inc/ROOT/RNTupleTypes.hxx Outdated
Comment thread tree/ntuple/src/RNTupleSerialize.cxx Outdated
RNTupleSerializer::SerializeUInt64(locator.GetNBytesOnStorage(), buffer);
}
RNTupleSerializer::SerializeUInt32(data.GetObjectId(), buffer + sizeofNBytesOnStorage);
RNTupleSerializer::SerializeUInt32(data.GetOffset(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would use the pattern found in other serialize functions of:

   auto base = reinterpret_cast<unsigned char *>(buffer);
   auto pos = base;
   void **where = (buffer == nullptr) ? &buffer : reinterpret_cast<void **>(&pos);

   pos += RNTupleSerializer::SerializeUInt32(..., *where);
   pos += ...

instead of manually calculating the write position

Comment thread tree/ntuple/src/RNTupleSerialize.cxx Outdated
}
std::uint32_t objectId;
std::uint32_t offset;
RNTupleSerializer::DeserializeUInt32(buffer + sizeofNBytesOnStorage, objectId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Like for the serialize: keep track of the buffer position with a variable and increment it with the Deserialize* return values instead of calculating the offset every time

Comment thread tree/ntuple/src/RNTupleSerialize.cxx Outdated
case 0x03:
locator.SetType(RNTupleLocator::kTypeMulti);
DeserializeLocatorPayloadObject64(bytes, payloadSize, locator);
DeserializeLocatorPayloadMulti(bytes, payloadSize, locator);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both for this and the Object64 case: we need to check the return value and forward RResult in case of failure.

@JasMehta08 JasMehta08 force-pushed the ntuple-locator-multi-class branch from a78d828 to 957239d Compare June 21, 2026 12:11
@JasMehta08 JasMehta08 force-pushed the ntuple-locator-multi-class branch from 957239d to 8ec164f Compare June 21, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants