Skip to content

Commit

Permalink
Merge c616343 into bd83967
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf authored Nov 15, 2024
2 parents bd83967 + c616343 commit ba1867e
Show file tree
Hide file tree
Showing 27 changed files with 235 additions and 242 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cvmfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: cvmfs-contrib/github-action-cvmfs@v4
- name: Read root file in C++
run: |
source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-ubuntu2204-gcc11-opt/setup.sh
source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-ubuntu2204-gcc14-opt/setup.sh
python ./test/RNTupleWriting/test1.py test1.root
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
Expand Down
84 changes: 42 additions & 42 deletions src/RNTuple/Writing/Stubs.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module Stubs
using ..UnROOT

const WRITE_TIME = 0x768A676E
const HEADER_CHECKSUM = 0xf6633b32dc5e8345
const WRITE_TIME = 0x76DB5093
const WRITE_TIME_ary = reverse(reinterpret(UInt8, [WRITE_TIME]))

const file_preamble = [
0x72, 0x6F, 0x6F, 0x74, 0x00, 0x00, 0xF7, 0x45,
0x72, 0x6F, 0x6F, 0x74, 0x00, 0x00, 0xF8, 0x0D,
]

const fileheader = UnROOT.FileHeader32(100, 0x00000638, 0x000005F9, 63, 1, 84, 0x04, 0, 0x00000465, 0x00000194, UInt8[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
const fileheader = UnROOT.FileHeader32(100, 0x00000638, 0x000005F9, 63, 1, 84, 0x04, 0, 0x00000465, 0x0000018D, UInt8[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
const dummy_padding1 = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -17,7 +18,7 @@ const dummy_padding1 = [

const tkey32_tfile = UnROOT.TKey32(144, 4, 86, WRITE_TIME, 58, 1, 100, 0, "TFile", "test_ntuple_minimal.root", "")
const tfile = UnROOT.TFile_write("test_ntuple_minimal.root", "")
const tdirectory32 = UnROOT.ROOTDirectoryHeader32(5, WRITE_TIME, WRITE_TIME, 121, 84, 100, 0, 0x000003ec)
const tdirectory32 = UnROOT.ROOTDirectoryHeader32(5, WRITE_TIME, WRITE_TIME, 0x006B, 84, 100, 0, 0x000003ec)
const dummy_padding2 = [
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -26,17 +27,17 @@ const dummy_padding2 = [

const RBlob1 = UnROOT.RBlob(; fNbytes = 0x00DC, fVersion = 0x0004, fObjLen = 0x000000BA, fDatime = WRITE_TIME, fKeyLen = 0x0022,
fCycle = 0x0001, fSeekKey = 244, fSeekPdir = 100, fClassName = "RBlob", fName = "", fTitle = "")
const rnt_header = UnROOT.RNTupleHeader(zero(UInt64), "myntuple", "", "ROOT v6.33.01", [
UnROOT.FieldRecord(zero(UInt32), zero(UInt32), zero(UInt32), zero(UInt16), zero(UInt16), 0, -1, -1, "one_uint", "std::uint32_t", "", ""),
], [UnROOT.ColumnRecord(0x14, 0x20, zero(UInt32), 0x00, 0x00, 0),], UnROOT.AliasRecord[], UnROOT.ExtraTypeInfo[])
const rnt_header = UnROOT.RNTupleHeader(zero(UInt64), "myntuple", "", "ROOT v6.35.001", [
UnROOT.FieldRecord(zero(UInt32), zero(UInt32), zero(UInt32), zero(UInt16), zero(UInt16), "one_uint", "std::uint32_t", "", "", 0, -1, -1),
], [UnROOT.ColumnRecord(0x08, 0x20, zero(UInt32), 0x00, 0x00, 0),], UnROOT.AliasRecord[], UnROOT.ExtraTypeInfo[])


const RBlob2 = UnROOT.RBlob(0x002e, 0x0004, 0x00000004, WRITE_TIME, 0x0022, 0x0001, 0x01D0, 100, "RBlob", "", "")
const RBlob2 = UnROOT.RBlob(0x002e, 0x0004, 0x00000004, WRITE_TIME, 0x0022, 0x0001, 0x01D1, 100, "RBlob", "", "")
const page1 = [
0xCE, 0xCE, 0xCE, 0xCE,
]

const RBlob3 = UnROOT.RBlob(0x009E, 0x0004, 0x0000007C, WRITE_TIME, 0x0022, 0x0001, 0x01FE, 100, "RBlob", "", "")
const RBlob3 = UnROOT.RBlob(0x009E, 0x0004, 0x0000007C, WRITE_TIME, 0x0022, 0x0001, 0x01FF, 100, "RBlob", "", "")
const cluster_summary = UnROOT.Write_RNTupleListFrame([UnROOT.ClusterSummary(0, 1)])
const nested_page_locations =
UnROOT.RNTuplePageTopList([
Expand All @@ -46,55 +47,54 @@ UnROOT.RNTuplePageTopList([
]),
]),
])
const pagelink = UnROOT.PageLink(0x3dec59c009c67e28, cluster_summary.payload, nested_page_locations)
const pagelink = UnROOT.PageLink(HEADER_CHECKSUM, cluster_summary.payload, nested_page_locations)

const RBlob4 = UnROOT.RBlob(0x00C2, 0x0004, 0x000000A0, WRITE_TIME, 0x0022, 0x0001, 0x029c, 100, "RBlob", "", "")
const rnt_footer = UnROOT.RNTupleFooter(0, 0x3dec59c009c67e28, UnROOT.RNTupleSchemaExtension([], [], [], []), [], [
UnROOT.ClusterGroupRecord(0, 1, 1, UnROOT.EnvLink(0x000000000000007c, UnROOT.Locator(124, 0x0000000000000220, ))),
const RBlob4 = UnROOT.RBlob(0x00B6, 0x0004, 0x00000094, WRITE_TIME, 0x0022, 0x0001, 0x029D, 100, "RBlob", "", "")
const rnt_footer = UnROOT.RNTupleFooter(0, HEADER_CHECKSUM, UnROOT.RNTupleSchemaExtension([], [], [], []), [
UnROOT.ClusterGroupRecord(0, 1, 1, UnROOT.EnvLink(0x000000000000007c, UnROOT.Locator(124, 0x0000000000000221, ))),
])
const tkey32_anchor = UnROOT.TKey32(134, 4, 70, WRITE_TIME, 64, 1, 866, 100, "ROOT::Experimental::RNTuple", "myntuple", "")
const tkey32_anchor = UnROOT.TKey32(128, 4, 78, WRITE_TIME, 50, 1, 851, 100, "ROOT::RNTuple", "myntuple", "")
# these 6 bytes are between tkey32_anchor and the actual anchor
const magic_6bytes = [0x40, 0x00, 0x00, 0x42, 0x00, 0x06]
const magic_6bytes = [0x40, 0x00, 0x00, 0x42, 0x00, 0x02]

const rnt_anchor = UnROOT.ROOT_3a3a_Experimental_3a3a_RNTuple(0x0000, 0x0002, 0x0000, 0x0000, 0x0000000000000116, 0x00000000000000ba, 0x00000000000000ba, 0x00000000000002be, 0x00000000000000a0, 0x00000000000000a0, 0x0000000040000000, 0xdc495fd01479af1b)
const tkey32_TDirectory = UnROOT.TKey32(121, 4, 68, WRITE_TIME, 53, 1, 0x000003ec, 100, "", "test_ntuple_minimal.root", "")
const rnt_anchor = UnROOT.ROOT_3a3a_RNTuple(0x0001, 0x0000, 0x0000, 0x0000, 0x0000000000000116, 0x00000000000000ba, 0x00000000000000ba, 0x00000000000002be, 0x00000000000000a0, 0x00000000000000a0, 0x0000000040000000, 0xdc495fd01479af1b)
const tkey32_TDirectory = UnROOT.TKey32(0x006B, 4, 0x0036, WRITE_TIME, 53, 1, 0x000003d3, 100, "", "test_ntuple_minimal.root", "")
# 1 key, and it is the RNTuple Anchor
const n_keys = [
0x00, 0x00, 0x00, 0x01,
]


const tkey32_TStreamerInfo = UnROOT.TKey32(0x00000194, 4, 0x000004f4, WRITE_TIME, 64, 1, 0x00000465, 100, "TList", "StreamerInfo", "Doubly linked list")
const tkey32_TStreamerInfo = UnROOT.TKey32(0x0000018d, 4, 0x000004e6, WRITE_TIME, 64, 1, 0x0000043e, 100, "TList", "StreamerInfo", "Doubly linked list")

const tsreamerinfo_compressed = [
0x5A, 0x4C, 0x08, 0x4B, 0x01, 0x00, 0xF4, 0x04, 0x00, 0x78, 0x01, 0xBD, 0x92, 0xC1, 0x4E, 0xC2,
0x40, 0x10, 0x86, 0x7F, 0x2A, 0x1A, 0x15, 0xE1, 0xAC, 0xE1, 0xE2, 0xD5, 0x57, 0xE8, 0xA9, 0x92,
0x60, 0x34, 0x8A, 0x20, 0x6D, 0x30, 0x7A, 0xD0, 0x2C, 0x30, 0x85, 0x22, 0xEC, 0x36, 0xDB, 0x12,
0xA9, 0x27, 0x3C, 0xFA, 0x5E, 0xBE, 0x83, 0x89, 0x4F, 0xE1, 0x1B, 0xE8, 0xB4, 0x10, 0x02, 0x89,
0x44, 0xB4, 0xC1, 0x49, 0x76, 0xDA, 0xDD, 0x9D, 0x9D, 0x6F, 0xFB, 0xFF, 0xB5, 0x90, 0xFD, 0xC0,
0x26, 0x32, 0x98, 0x8B, 0x8C, 0x85, 0xEC, 0xFB, 0x27, 0x87, 0x63, 0x87, 0x9A, 0xC4, 0x80, 0xF4,
0x99, 0x74, 0x15, 0x78, 0xF5, 0x15, 0x3B, 0x16, 0x70, 0xC4, 0xE5, 0x93, 0x03, 0x9C, 0x8B, 0xF5,
0x6A, 0xD5, 0x31, 0xCD, 0xF2, 0xC8, 0x27, 0xED, 0x0D, 0x48, 0x86, 0xA2, 0x6F, 0x9A, 0xF5, 0x4B,
0x67, 0xE8, 0xF7, 0x09, 0xCF, 0x92, 0xCB, 0x81, 0x2D, 0x3E, 0xFA, 0x92, 0x34, 0xAC, 0x36, 0x7B,
0xC7, 0x5A, 0x8B, 0x28, 0x6E, 0xF6, 0x88, 0x8D, 0x45, 0x6E, 0x2E, 0xAE, 0xB5, 0x80, 0xE1, 0x02,
0x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0x88, 0x5F, 0xE6, 0x29, 0xDF, 0x97,
0x81, 0xDF, 0x92, 0xD4, 0xDC, 0x0D, 0xDA, 0x4A, 0x87, 0x16, 0x50, 0x1F, 0x02, 0xCF, 0xFC, 0xFC,
0x99, 0x52, 0x12, 0x1D, 0xA5, 0xE3, 0xC6, 0xCB, 0xA5, 0xF8, 0xF2, 0x1F, 0x28, 0x15, 0x11, 0xFE,
0xD9, 0xB1, 0x9B, 0xB1, 0x63, 0x17, 0x30, 0x2C, 0xE0, 0x3C, 0x99, 0xCB, 0xF6, 0xE4, 0x42, 0x00,
0xC8, 0x7A, 0x0E, 0xD1, 0xED, 0x31, 0x89, 0x26, 0x25, 0x7E, 0xE5, 0x39, 0xB7, 0xC6, 0x6B, 0xAE,
0x72, 0x93, 0xA9, 0x74, 0x95, 0x6C, 0x59, 0x80, 0x18, 0x8E, 0x86, 0x72, 0x09, 0x83, 0xBF, 0x9C,
0xEF, 0x46, 0x5F, 0x2E, 0x46, 0x21, 0x05, 0x69, 0x20, 0xD7, 0x63, 0x48, 0x2D, 0x81, 0x54, 0x12,
0xC8, 0xD6, 0xF4, 0x7F, 0x6C, 0x78, 0x67, 0x24, 0xD3, 0x10, 0x16, 0x74, 0xEA, 0x48, 0xA9, 0x70,
0xE9, 0x4E, 0xA5, 0x81, 0x2C, 0xE6, 0x54, 0x1A, 0xC2, 0x02, 0x4E, 0x95, 0xC4, 0xFD, 0x29, 0x45,
0x8E, 0xFF, 0x40, 0x60, 0xFD, 0xF2, 0x4E, 0xE1, 0x13, 0xD4, 0x54, 0xBD, 0x04,
]

const tfile_end = [
0x00, 0x00, 0x00, 0x3F, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0A, WRITE_TIME_ary..., 0x00, 0x35,
0x00, 0x01, 0x00, 0x00, 0x05, 0xF9, 0x00, 0x00, 0x00, 0x64, 0x00, 0x18, 0x74, 0x65, 0x73, 0x74,
0x00, 0x01, 0x00, 0x00, 0x05, 0xCB, 0x00, 0x00, 0x00, 0x64, 0x00, 0x18, 0x74, 0x65, 0x73, 0x74,
0x5F, 0x6E, 0x74, 0x75, 0x70, 0x6C, 0x65, 0x5F, 0x6D, 0x69, 0x6E, 0x69, 0x6D, 0x61, 0x6C, 0x2E,
0x72, 0x6F, 0x6F, 0x74, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x38, 0x77, 0x35, 0x94, 0x00,
0x72, 0x6F, 0x6F, 0x74, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x0A, 0x77, 0x35, 0x94, 0x00,
]
end
25 changes: 12 additions & 13 deletions src/RNTuple/Writing/TFileWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@ function rnt_write(io::IO, x::UnROOT.FieldRecord)
rnt_write(io, x.parent_field_id)
rnt_write(io, x.struct_role)
rnt_write(io, x.flags)
if !iszero(0x0001 & x.flags)
rnt_write(io, x.field_name)
rnt_write(io, x.type_name)
rnt_write(io, x.type_alias)
rnt_write(io, x.field_desc)
if !iszero(0x01 & x.flags)
rnt_write(io, x.repetition)
end
if !iszero(0x0002 & x.flags)
if !iszero(0x02 & x.flags)
rnt_write(io, x.source_field_id)
end
if !iszero(0x0004 & x.flags)
if !iszero(0x04 & x.flags)
rnt_write(io, x.root_streamer_checksum)
end
rnt_write(io, x.field_name)
rnt_write(io, x.type_name)
rnt_write(io, x.type_alias)
rnt_write(io, x.field_desc)
end

function rnt_write(io::IO, x::UnROOT.ColumnRecord)
Expand Down Expand Up @@ -394,7 +394,6 @@ function rnt_write(io::IO, x::UnROOT.RNTupleFooter; envelope=true)
rnt_write(temp_io, x.feature_flag)
rnt_write(temp_io, x.header_checksum)
rnt_write(temp_io, x.extension_header_links)
rnt_write(temp_io, Write_RNTupleListFrame(x.column_group_records))
rnt_write(temp_io, Write_RNTupleListFrame(x.cluster_group_records))

# add id_length size and checksum size
Expand All @@ -415,7 +414,7 @@ function rnt_write(io::IO, x::UnROOT.RNTupleFooter; envelope=true)
end
end

function rnt_write(io::IO, x::UnROOT.ROOT_3a3a_Experimental_3a3a_RNTuple)
function rnt_write(io::IO, x::UnROOT.ROOT_3a3a_RNTuple)
temp_io = IOBuffer()
rnt_write(temp_io, x.fVersionEpoch; legacy=true)
rnt_write(temp_io, x.fVersionMajor; legacy=true)
Expand Down Expand Up @@ -475,7 +474,7 @@ end

# primary case
function add_field_column_record!(field_records, column_records, input_T::Type{<:Real}, NAME; parent_field_id, col_field_id = parent_field_id)
fr = UnROOT.FieldRecord(zero(UInt32), zero(UInt32), parent_field_id, zero(UInt16), zero(UInt16), 0, -1, -1, string(NAME), RNTUPLE_WRITE_TYPE_CPPNAME_DICT[input_T], "", "")
fr = UnROOT.FieldRecord(zero(UInt32), zero(UInt32), parent_field_id, zero(UInt16), zero(UInt16), string(NAME), RNTUPLE_WRITE_TYPE_CPPNAME_DICT[input_T], "", "", 0, -1, -1)
cr = UnROOT.ColumnRecord(RNTUPLE_WRITE_TYPE_IDX_DICT[input_T]..., col_field_id, 0x00, 0x00, 0)
push!(field_records, fr)
push!(column_records, cr)
Expand Down Expand Up @@ -568,7 +567,7 @@ function write_rntuple(file::IO, table; file_name="test_ntuple_minimal.root", rn
RBlob1_obs = rnt_write_observe(file, RBlob1)
field_records, col_records = schema_to_field_column_records(table)
rnt_header = UnROOT.RNTupleHeader(
zero(UInt64), rntuple_name, "", "ROOT v6.33.01",
zero(UInt64), rntuple_name, "", "ROOT v6.35.001",
field_records, col_records,
UnROOT.AliasRecord[], UnROOT.ExtraTypeInfo[]
)
Expand Down Expand Up @@ -597,15 +596,15 @@ function write_rntuple(file::IO, table; file_name="test_ntuple_minimal.root", rn

RBlob4_obs = rnt_write_observe(file, Stubs.RBlob4)
rntAnchor_update[:fSeekFooter] = UInt32(position(file))
rnt_footer = UnROOT.RNTupleFooter(0, _checksum(rnt_header_obs.object), UnROOT.RNTupleSchemaExtension([], [], [], []), [], [
rnt_footer = UnROOT.RNTupleFooter(0, _checksum(rnt_header_obs.object), UnROOT.RNTupleSchemaExtension([], [], [], []), [
UnROOT.ClusterGroupRecord(0, input_length, 1, UnROOT.EnvLink(pagelink_obs.len, UnROOT.Locator(pagelink_obs.len, pagelink_obs.position, ))),
])
rnt_footer_obs = rnt_write_observe(file, rnt_footer)
rntAnchor_update[:fNBytesFooter] = rnt_footer_obs.len
rntAnchor_update[:fLenFooter] = rnt_footer_obs.len

tkey32_anchor_position = position(file)
tkey32_anchor = UnROOT.TKey32(0x0000008E, 4, typemin(Int32), Stubs.WRITE_TIME, 64, 1, tkey32_anchor_position, 100, "ROOT::Experimental::RNTuple", rntuple_name, "")
tkey32_anchor = UnROOT.TKey32(0x00000080, 4, typemin(Int32), Stubs.WRITE_TIME, 50, 1, tkey32_anchor_position, 100, "ROOT::RNTuple", rntuple_name, "")
tkey32_anchor_obs1 = rnt_write_observe(file, tkey32_anchor)
tkey32_anchor_update = Dict{Symbol, Any}()
magic_6bytes_obs = rnt_write_observe(file, Stubs.magic_6bytes)
Expand Down
32 changes: 0 additions & 32 deletions src/RNTuple/Writing/constants.jl

This file was deleted.

12 changes: 9 additions & 3 deletions src/RNTuple/bootstrap.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://github.com/root-project/root/blob/a4deb370c9b9870f0391036890981f648559ef68/tree/ntuple/v7/inc/ROOT/RNTupleAnchor.hxx#L69
Base.@kwdef struct ROOT_3a3a_Experimental_3a3a_RNTuple <: ROOTStreamedObject
Base.@kwdef struct ROOT_3a3a_RNTuple <: ROOTStreamedObject
fVersionEpoch::UInt16
fVersionMajor::UInt16
fVersionMinor::UInt16
Expand All @@ -14,13 +14,13 @@ Base.@kwdef struct ROOT_3a3a_Experimental_3a3a_RNTuple <: ROOTStreamedObject
fChecksum::UInt64
end

function ROOT_3a3a_Experimental_3a3a_RNTuple(io, tkey::TKey, refs)
function ROOT_3a3a_RNTuple(io, tkey::TKey, refs)
local_io = datastream(io, tkey)
skip(local_io, 6)
_before_anchor = position(local_io)
anchor_checksum = xxh3_64(read(local_io, 2*4 + 7*8))
seek(local_io, _before_anchor)
anchor = ROOT_3a3a_Experimental_3a3a_RNTuple(;
anchor = ROOT_3a3a_RNTuple(;
fVersionEpoch = readtype(local_io, UInt16),
fVersionMajor = readtype(local_io, UInt16),
fVersionMinor = readtype(local_io, UInt16),
Expand All @@ -36,6 +36,12 @@ function ROOT_3a3a_Experimental_3a3a_RNTuple(io, tkey::TKey, refs)
)

@assert anchor.fChecksum == anchor_checksum "RNtuple anchor checksum doesn't match"
# only support version 1.0.x.x for the moment.
if anchor.fVersionEpoch == 0 && anchor.fVersionMajor == 3
elseif anchor.fVersionEpoch == 1 && anchor.fVersionMajor == 0
else
error("RNTuple with specification version $(anchor.fVersionEpoch).$(anchor.fVersionMajor).x.x is not yet supported.")
end


header_bytes = decompress_bytes(read_seek_nb(io, anchor.fSeekHeader, anchor.fNBytesHeader), anchor.fLenHeader)
Expand Down
Loading

0 comments on commit ba1867e

Please sign in to comment.