Stream: helpdesk (published)

Topic: ✔ StackOverflow in `reduce` with `hcat` in Julia v1.13


view this post on Zulip Júlio Hoffimann (Sep 10 2026 at 12:54):

The following MWE worked just fine in Julia v1.12:

using GeoTables

t1 = georef((; a=rand(10,10)))
t2 = georef((; b=rand(10,10)))
t3 = georef((; c=rand(10,10)))

[t1 t2 t3]

I've updated to Julia v1.13 today and it now errors:

Warning: detected a stack overflow; program state may be corrupted, so further execution might be unreliable.
ERROR: StackOverflowError:
Stacktrace:
 ┌     [1] mapfoldl(f::Function, op::Function, itr::Tuple{GeoTable{…}}; init::Base._InitialValue)
 │       @ Base ./reduce.jl:173
 ├     [2] mapfoldl
 │       @ ./reduce.jl:173 [inlined]
 ├     [3] mapreduce
 │       @ ./reduce.jl:306 [inlined]
 ├     [4] reduce(op::Function, itr::Tuple{GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}}})
 │       @ Base ./reduce.jl:490
 ├     [5] hcat(geotables::GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}})
 │       @ GeoTables ~/.julia/packages/GeoTables/7zeT2/src/api/dataframes.jl:138
 ├     [6] reduce_first(::typeof(hcat), x::GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}})
 │       @ Base ./reduce.jl:412
 ├     [7] BottomRF
 │       @ ./reduce.jl:83 [inlined]
 ├     [8] afoldl(op::Base.BottomRF{typeof(hcat)}, a::Base._InitialValue, bs::GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}})
 │       @ Base ./operators.jl:610
 ├     [9] _foldl_impl(op::Base.BottomRF{typeof(hcat)}, init::Base._InitialValue, itr::Tuple{GeoTable{…}})
 │       @ Base ./reduce.jl:66
 ├    [10] foldl_impl(op::Base.BottomRF{typeof(hcat)}, nt::Base._InitialValue, itr::Tuple{GeoTable{…}})
 │       @ Base ./reduce.jl:46
 ├    [11] mapfoldl_impl(f::typeof(identity), op::typeof(hcat), nt::Base._InitialValue, itr::Tuple{GeoTable{…}})
 │       @ Base ./reduce.jl:42
 ╰──────── repeated 8886 times
   [97747] mapfoldl(f::Function, op::Function, itr::Tuple{GeoTable{…}}; init::Base._InitialValue)
         @ Base ./reduce.jl:173
   [97748] mapfoldl
         @ ./reduce.jl:173 [inlined]
   [97749] mapreduce
         @ ./reduce.jl:306 [inlined]
   [97750] reduce(op::Function, itr::Tuple{GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}}})
         @ Base ./reduce.jl:490
   [97751] hcat(geotables::GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}})
         @ GeoTables ~/.julia/packages/GeoTables/7zeT2/src/api/dataframes.jl:138
   [97752] reduce_first(::typeof(hcat), x::GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}})
         @ Base ./reduce.jl:412
   [97753] BottomRF
         @ ./reduce.jl:83 [inlined]
   [97754] afoldl(op::Base.BottomRF{typeof(hcat)}, a::Base._InitialValue, bs::GeoTable{Meshes.CartesianGrid{…}, @NamedTuple{…}})
         @ Base ./operators.jl:610
   [97755] _foldl_impl(op::Base.BottomRF{typeof(hcat)}, init::Base._InitialValue, itr::Tuple{GeoTable{…}})
         @ Base ./reduce.jl:66
   [97756] foldl_impl(op::Base.BottomRF{typeof(hcat)}, nt::Base._InitialValue, itr::Tuple{GeoTable{…}})
         @ Base ./reduce.jl:46
   [97757] mapfoldl_impl(f::typeof(identity), op::typeof(hcat), nt::Base._InitialValue, itr::Tuple{GeoTable{…}})
         @ Base ./reduce.jl:42
Some type information was truncated. Use `show(err)` to see complete types.

Is there any issue with our definition? https://github.com/JuliaEarth/GeoTables.jl/blob/037532e740c2c3c227ce7623bfbfb57ff8d73360/src/api/dataframes.jl#L138

Did something change regarding reduce with hcat?

view this post on Zulip Júlio Hoffimann (Sep 10 2026 at 13:09):

The problem is related to type inference I guess. Re-implemented with an explicit init:

https://github.com/JuliaEarth/GeoTables.jl/pull/179

view this post on Zulip Notification Bot (Sep 10 2026 at 13:13):

Júlio Hoffimann has marked this topic as resolved.


Last updated: Oct 10 2026 at 10:43 UTC