Using TypedTables limited column number #140
Copy link
Copy link
Open
Labels
trimmingRelated to --trim mode and verifier errorsRelated to --trim mode and verifier errorsupstreamRequires fix in Julia base or external packageRequires fix in Julia base or external package
Description
Using TypedTables I construct a table. If the table has more than 31 columns, then trying to access an element of rows(t) seems to cause compile errors.
The following code runs in the julia repl, bug compiling with juliac results in error messages.
using TypedTables
const COLUMN_NAMES = (
:c1,:c2,:c3,:c4,:c5,:c6,:c7,:c8,:c9,:c10,:c11,:c12,:c13,:c14,:c15,:c16,
:c17,:c18,:c19,:c20,:c21,:c22,:c23,:c24,:c25,:c26,:c27,:c28,:c29,:c30,
:c31,:c32
)
const TUPLE_TYPE = Tuple{
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String},
Vector{String},Vector{String},Vector{String},Vector{String}
}
const VALUES = (
["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"]
)
function (@main)(args::Vector{String})::Cint
nt = NamedTuple{COLUMN_NAMES, TUPLE_TYPE}(VALUES)
t = Table(nt)
r1 = rows(t)[1]
return 0
end
Compiling results in 4 error messages.
Verifier error #1: unresolved call from statement Core._apply_iterate(Base.iterate, Core.tuple, %new()::Vector{String})::Tuple{Vararg{String}}
Stacktrace:
[1] _totuple(T::Type{NTuple{32, String}}, itr::Base.Generator{@NamedTuple{a::Vector{String}, b::Vector{String}, ...
Verifier error #2: unresolved call from statement (NT::Type{@NamedTuple{a::String, b::String, ....
The 3rd and 4th error messages are similar.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
trimmingRelated to --trim mode and verifier errorsRelated to --trim mode and verifier errorsupstreamRequires fix in Julia base or external packageRequires fix in Julia base or external package
Activity
gbaraldi commentedon May 13, 2026
You are hitting an annoying thing where Tuples are type stable up to 32. Then they become type unstable
Thomas008 commentedon Jun 22, 2026
Is there work to increase the type-stability of tuples?
Is there even a constant in the julia compiler to set the maximal number of elements in a tuple such that it is type-stable?
Thomas008 commentedon Jun 22, 2026
There are further limitations when using TypedTables:
It causes the compile errors
ameligrana commentedon Aug 1, 2026
I investigated a similar issue where I had problems with
Core._apply_iteratewith >31 types. In practice though in my case it is fixable:Vararg(since it is not statically expanded with >31 elements) and instead use a singleTupleBasefunctions (e.g.map) giving up at >31 elements by default. So I think the problem is more inTypedTablesthan inJuliaC.Concretely I used
which doesn't cause problems with
JuliaCsince it uses a single tuple and it assumes foldability. Maybe similar bugs apply toTypedTables. I think these are indeed workarounds.Thomas008 commentedon Aug 4, 2026
Here is a solution to the example of filtering rows of a Table. It is of Claude.
The general solution pattern is: using a column-wise instead of row-wise processing. More specific, filter() runs on the generic rows-/ tuple-based Table mechanisms that cannot be resolved statically anymore.
So one can apply a mask that is calculated only on the used columns and is applied on them.