Code Monkey home page Code Monkey logo

Comments (7)

Moelf avatar Moelf commented on June 12, 2024

@tamasgal

from unroot.jl.

Moelf avatar Moelf commented on June 12, 2024

when we fix this we should add a test

from unroot.jl.

tamasgal avatar tamasgal commented on June 12, 2024

Thanks for hunting this down 😉

from unroot.jl.

tamasgal avatar tamasgal commented on June 12, 2024

My best guess currently is

v0.10.5...v0.10.6#diff-96fd19227b50278b8b930998f46f92b76e3d9524a81988f16c6d47fbe7b99d6fR60

I'm having a look...

from unroot.jl.

tamasgal avatar tamasgal commented on June 12, 2024

And this line:

v0.10.5...v0.10.6#diff-96fd19227b50278b8b930998f46f92b76e3d9524a81988f16c6d47fbe7b99d6fR193

So in principle, we have a type inference problem because .fBasketEntry and .fBaskets.elements are not type-safe.

from unroot.jl.

tamasgal avatar tamasgal commented on June 12, 2024

Actually I think we are rather dancing at the edge of type interference nesting and a single line where we check if findfirst returns nothing totally breaks the inference.

Look at this rewritten _localindex_newbasket!() function which now dispatches on two different _get_buffer_range() functions. The one which dispatches on Nothing is commented out. Everything works. If I comment it back, it's unstable again:

function _localindex_newbasket!(ba::LazyBranch{T,J,B}, idx::Integer, tid::Int) where {T,J,B}
    seek_idx = findfirst(x -> x > (idx - 1), ba.fEntry) #support 1.0 syntax
    br = _get_buffer_range(ba, tid, seek_idx)
    ba.buffer_range[tid] = br
    return idx - br.start + 1
end

function _get_buffer_range(ba::LazyBranch{T, J, B}, tid::Integer, seek_idx::Integer) where {T,J,B}
    seek_idx -= 1
    ba.buffer[tid] = basketarray(ba.f, ba.b, seek_idx)
    (ba.fEntry[seek_idx] + 1):(ba.fEntry[seek_idx + 1])
end

# function _get_buffer_range(ba::LazyBranch{T, J, B}, tid::Integer, ::Nothing) where {T,J,B}
#     ba.buffer[tid] = basketarray(ba.f, ba.b, -1)  # -1 indicating recovered basket mechanics
#     # FIXME: this range is probably wrong for jagged data with non-empty offsets
#     ba.b.fBasketEntry[end] + 1:ba.b.fEntries
# end

The .fBasketEntry cannot be the culprit, it's an Array{Float64}.

from unroot.jl.

tamasgal avatar tamasgal commented on June 12, 2024

OK, forcing the return type of the _get_buffer_range to be a UnitRange{Int64} does the trick. Unfortunately .fEntries can also be a Float64 in older TTree versions...

from unroot.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.