You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DefaultDataBag.iterator: IndexOutOfBoundsException when the bag holds exactly the spill threshold #4409
Split off from #4407 (found with the help of an AI coding assistant).
Summary: With ARQ.spillToDiskThreshold set to 100, an INSERT ... WHERE that has exactly 100 solutions throws IndexOutOfBoundsException: Index 0 out of bounds for length 0 from DefaultDataBag.iterator. With 99 or 101 solutions it works. Only users who enabled spilling are affected, since the default policy never spills.
Cause:DefaultDataBag.add only spills when an item arrives after the threshold is reached. iterator(), however, uses policy.isThresholdExceeded() to choose between memory and the spill file, and that is already true after the 100th item. So nothing was spilled, but iterator() reads getSpillFiles().get(0) from an empty list.
Fix: use the existing spilled flag in iterator() instead of policy.isThresholdExceeded(). With this change on 6.2.0, the test below passes (99 / 100 / 101).
Sure, go ahead! The cause and a one-line fix are in the issue (use the spilled flag in DefaultDataBag.iterator()), and the test above should pass with it. The maintainers decide on review and merge, of course.
Hi!
I'm interested in contributing to Apache Jena and would like to work on this issue. I've been working with Java and am currently developing my backend engineering skills. This issue looks like a good opportunity to understand Jena's DefaultDataBag implementation, investigate the threshold-handling behaviour, and add appropriate regression tests. Is this issue still open for contributions? I'd be happy to investigate and submit a PR.
Thanks for your interest! This one is already taken: @Zhou-Kan opened #4420 with a fix. But #4408 is still open and similar in size: the cause, a one-line fix and a test are in the issue. Feel free to pick that one up; the maintainers decide on review and merge.
Activity
Zhou-Kan commentedon Nov 15, 2026
Could I still work on this issue as my first ticket here? @MatthiasVanDE
MatthiasVanDE commentedon Nov 15, 2026
Sure, go ahead! The cause and a one-line fix are in the issue (use the spilled flag in DefaultDataBag.iterator()), and the test above should pass with it. The maintainers decide on review and merge, of course.
Zhou-Kan commentedon Nov 16, 2026
Hi @MatthiasVanDE I added a PR for it #4420
MatthiasVanDE commentedon Nov 16, 2026
Thanks @Zhou-Kan ! The fix matches what I tested on 6.2.0, and the test covers the exact-threshold case. LGTM from my side.
deepikavalluru commentedon Nov 17, 2026
Hi!
I'm interested in contributing to Apache Jena and would like to work on this issue. I've been working with Java and am currently developing my backend engineering skills. This issue looks like a good opportunity to understand Jena's
DefaultDataBagimplementation, investigate the threshold-handling behaviour, and add appropriate regression tests. Is this issue still open for contributions? I'd be happy to investigate and submit a PR.Thanks!
MatthiasVanDE commentedon Nov 17, 2026
Thanks for your interest! This one is already taken: @Zhou-Kan opened #4420 with a fix. But #4408 is still open and similar in size: the cause, a one-line fix and a test are in the issue. Feel free to pick that one up; the maintainers decide on review and merge.
Zhou-Kan commentedon Nov 17, 2026
@afs I think I've fixed this issue, but I'm not sure if it's ready to be merged. PR is #4420