Skip to content
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

Userimg Precompilation Issue #21164

Closed
joshbode opened this issue Mar 26, 2017 · 2 comments
Closed

Userimg Precompilation Issue #21164

joshbode opened this issue Mar 26, 2017 · 2 comments
Labels
compiler:precompilation Precompilation of modules

Comments

@joshbode
Copy link
Contributor

joshbode commented Mar 26, 2017

I wasn't sure whether to raise this issue in DataFrames or here, but it appears to be a Julia issue with results differing depending on precompilation that I'm seeing across a number of packages in one form or another.

This could be related to issues #20369 and JuliaStats/DataArrays.jl#232 which appeared to have been addressed by #18869, which I assumed was included in the 0.5.1 release (but may not have been?)

The issue arises when I create a precompiled user image which includes DataFrames, where some methods (specifically view) will fail that would work when not using a userimg. I'm using OS X and Julia 0.5.1, however this issue was able to be replicated on Linux and in 0.5.0.

Also, this package had been successfully incorporated into a userimg prior to JuliaData/DataFrames.jl@19821b9, the most significant change being moving from sub to Base.view for creating SubDataFrames.

Minimal example

$ echo "import DataFrames" > ~/userimg.jl
$ CC=clang /usr/local/share/julia/build_sysimg.jl ~/sys native ~/userimg.jl --force
...

The following simple example fails (which works fine when not using the userimg):

$ julia -J ~/sys.dylib
julia> using DataFrames
julia> x = DataFrame(x=[1])
julia> view(x, [true])

ERROR: MethodError: Cannot `convert` an object of type Array{Int64,1} to an object of type Int64
This may have arisen from a call to the constructor Int64(...),
since type constructors fall back to convert methods.
 in view(::DataFrames.DataFrame, ::Array{Bool,1}) at /usr/local/share/julia/site/v0.5/DataFrames/src/subdataframe/subdataframe.jl:87

Expected:

$ julia
julia> using DataFrames
julia> x = DataFrame(x=[1])
julia> view(x, [true])  # formerly sub(x, [true])
1×1 DataFrames.SubDataFrame{Array{Int64,1}}
│ Row │ x │
│ 11
@joshbode
Copy link
Contributor Author

Apart from Julia producing different code paths depending upon whether the package has been precompiled into a userimg (which seems like a real bug), there appears to be an bug in DataFrames, specifically this function in subdataframe/subdataframe.jl:

function SubDataFrame{S <: Integer}(parent::DataFrame, rows::AbstractVector{S})
    return view(parent, Int(rows))
end

which doesn't look correct, seems to serve no purpose (all tests still pass when it is removed) and doesn't get called unless it has been baked into a userimg.

Will make a PR at DataFrames.jl which will address my immediate issue, but I'm still curious about different behaviour when precompiling.

@KristofferC
Copy link
Member

Please comment if this still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:precompilation Precompilation of modules
Projects
None yet
Development

No branches or pull requests

3 participants