-
Notifications
You must be signed in to change notification settings - Fork 24
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
Partition()
w/ size
greater than the length of the input does not work
#528
Comments
LebedevRI
changed the title
Jun 17, 2022
Partition(flush=true)
sometimes results in BoundsError
Partition()
w/ size
greater than the length of the input does not work
LebedevRI
added a commit
to LebedevRI/Transducers.jl
that referenced
this issue
Jun 23, 2022
`complete()` only worked correctly if at least a single full partition has been produced already, otherwise the `buf` would be smaller than the `xform(rf).size`, and we get buffer overflow, etc. I've added sufficient test coverage for the issue, that now passes. I have stumbled into this while trying to write a reduction tree, not sure if this is something that might be interesting here? Fixes JuliaFolds#528
LebedevRI
added a commit
to LebedevRI/Transducers.jl
that referenced
this issue
Jun 23, 2022
`complete()` only worked correctly if at least a single full partition has been produced already, otherwise the `buf` would be smaller than the `xform(rf).size`, and we get buffer overflow, etc. I've added sufficient test coverage for the issue, that now passes. I have stumbled into this while trying to write a reduction tree, not sure if this is something that might be interesting here? Fixes JuliaFolds#528
LebedevRI
added a commit
to LebedevRI/Transducers.jl
that referenced
this issue
Nov 25, 2022
`complete()` only worked correctly if at least a single full partition has been produced already, otherwise the `buf` would be smaller than the `xform(rf).size`, and we get buffer overflow, etc. I've added sufficient test coverage for the issue, that now passes. I have stumbled into this while trying to write a reduction tree, not sure if this is something that might be interesting here? Fixes JuliaFolds#528
MasonProtter
pushed a commit
that referenced
this issue
Nov 25, 2022
`complete()` only worked correctly if at least a single full partition has been produced already, otherwise the `buf` would be smaller than the `xform(rf).size`, and we get buffer overflow, etc. I've added sufficient test coverage for the issue, that now passes. I have stumbled into this while trying to write a reduction tree, not sure if this is something that might be interesting here? Fixes #528
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Orig
If we start with ``` using Transducers1:32 |> Partition(5; flush=true) |> Map(copy) |> Partition(5; flush=true) |> Map(copy) |> collect
2-element Vector{Vector{Vector{Int64}}}:
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]
[[26, 27, 28, 29, 30], [31, 32]]
using Transducers
1:32 |> Partition(5; flush=true) |> Map(copy) |> Partition(5; flush=true) |> Map(copy) |> Partition(5; flush=true) |> Map(copy) |> collect
1-element Vector{Vector{Vector{Vector{Int64}}}}:
[[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]], [[26, 27, 28, 29, 30], [31, 32]]]
BoundsError: attempt to access 2-element Vector{Vector{Vector{Int64}}} at index [2:6]
Stacktrace:
[1] throw_boundserror(A::Vector{Vector{Vector{Int64}}}, I::Tuple{UnitRange{Int64}})
@ Base ./abstractarray.jl:703
[2] checkbounds
@ ./abstractarray.jl:668 [inlined]
[3] view
@ ./subarray.jl:177 [inlined]
[4] complete(rf::Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, result::Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, Tuple{Int64, Int64, Vector{Vector{Vector{Int64}}}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/library.jl:907
[5] complete(rf::Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}, result::Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, Tuple{Int64, Int64, Vector{Vector{Vector{Int64}}}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/core.jl:546
[6] complete(rf::Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}, result::Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}, Tuple{Int64, Int64, Vector{Vector{Int64}}}, Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, Tuple{Int64, Int64, Vector{Vector{Vector{Int64}}}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}}})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/library.jl:912
[7] complete(rf::Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}}, result::Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}, Tuple{Int64, Int64, Vector{Vector{Int64}}}, Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, Tuple{Int64, Int64, Vector{Vector{Vector{Int64}}}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}}})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/core.jl:546
[8] complete(rf::Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}}}, result::Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}}}, Tuple{Int64, Int64, Vector{Int64}}, Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}, Tuple{Int64, Int64, Vector{Vector{Int64}}}, Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, Tuple{Int64, Int64, Vector{Vector{Vector{Int64}}}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}}}})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/library.jl:912
[9] _foldl_linear_bulk(rf::Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}}}, acc::Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}}}, Tuple{Int64, Int64, Vector{Int64}}, Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}}}, Tuple{Int64, Int64, Vector{Union{}}}, Transducers.PrivateState{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}}, Tuple{Int64, Int64, Vector{Union{}}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}}}}, arr::UnitRange{Int64}, i0::Int64)
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/processes.jl:201
[10] macro expansion
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:192 [inlined]
[11] macro expansion
@ ~/.julia/packages/Transducers/HBMTc/src/basics.jl:117 [inlined]
[12] _foldl_array
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:188 [inlined]
[13] foldl
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:182 [inlined]
[14] #transduce#142
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:523 [inlined]
[15] transduce
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:512 [inlined]
[16] transduce(xform::Transducers.Composition{Partition, Transducers.Composition{Map{typeof(copy)}, Transducers.Composition{Partition, Transducers.Composition{Map{typeof(copy)}, Transducers.Composition{Partition, Transducers.Composition{Map{typeof(copy)}, Map{Type{BangBang.NoBang.SingletonVector}}}}}}}}, f::Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}, init::BangBang.SafeCollector{Empty{Vector{Union{}}}}, coll::UnitRange{Int64}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/processes.jl:506
[17] transduce
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:504 [inlined]
[18] collect(xf::Transducers.Composition{Partition, Transducers.Composition{Map{typeof(copy)}, Transducers.Composition{Partition, Transducers.Composition{Map{typeof(copy)}, Transducers.Composition{Partition, Map{typeof(copy)}}}}}}, coll::UnitRange{Int64})
@ Transducers ~/.julia/packages/Transducers/HBMTc/src/processes.jl:807
[19] collect
@ ~/.julia/packages/Transducers/HBMTc/src/processes.jl:821 [inlined]
[20] |>(x::Transducers.Eduction{Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.Reduction{Partition, Transducers.Reduction{Map{typeof(copy)}, Transducers.BottomRF{Completing{typeof(push!!)}}}}}}}}, UnitRange{Int64}}, f::typeof(collect))
@ Base ./operators.jl:911
[21] top-level scope
@ In[34]:3
[22] eval
@ ./boot.jl:368 [inlined]
[23] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1299
The text was updated successfully, but these errors were encountered: