-
Notifications
You must be signed in to change notification settings - Fork 41
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
collect_structarray does not work with empty iterator #100
Comments
This does create some headaches, esp. in IndexedTables, which uses this machinery. In particular, I need to allow the awkward The principled approach is to use |
The easiest for now would be to fix the error you see. The problem is that it tries to build a |
Maybe something like this would work? ifnotbottom(x) = eltype(x) <: Union{} ? error() : x
@inferred ifnotbottom(expr_to_be_tested) Since Julia compiler is good at union splitting now, I guess it's fine to return small union?
If you do this, you can maybe also specialize structarray = ...
isempty(structarray) && return ...
# here the compiler can prove `structarray` is not of type `StructArray{Union{}}` when the performance is important. |
I think it makes sense to at least make the error message less cryptic.
If you want to make it return something, my preference is to return an array of
Union{}
element type. Related discussion in: JuliaData/TypedTables.jl#55The text was updated successfully, but these errors were encountered: