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

JET.JL problem with v1.4.1 #3204

Closed
Soldalma opened this issue Oct 24, 2022 · 1 comment
Closed

JET.JL problem with v1.4.1 #3204

Soldalma opened this issue Oct 24, 2022 · 1 comment

Comments

@Soldalma
Copy link

I started using JET.jl recently. In most cases it is helpful. However, sometimes I just cannot figure out why it has a problem with my code. An example is below. The function foo is very basic and works fine. Still, JET.jl’s macro @report_call reports an error. I cannot figure out what it is. What is the best way to identify the problem using the information provided by the macro call?

using DataFrames, JET
df = DataFrame(:A => [1.0, 2.0, 3.0, 4.0])
# 4×1 DataFrame
# Row │ A       
#     │ Float64
# ─────┼─────────
#  1 │     1.0
#  2 │     2.0
#  3 │     3.0
#  4 │     4.0

function foo(df::DataFrame)::DataFrame
    v = 1:nrow(df)
    df[!, :B] = v

    return df
end
# foo (generic function with 1 method)

foo(df)
# 4×2 DataFrame
# Row │ A        B     
#     │ Float64  Int64
# ─────┼────────────────
#   1 │     1.0      1
#   2 │     2.0      2
#   3 │     3.0      3
#   4 │     4.0      4

julia> @report_call foo(df)
═════ 1 possible error found ═════
┌ @ REPL[20]:3 df[:, :B] = v
│┌ @ C:\Users\fsald\.julia\packages\DataFrames\Lrd7K\src\dataframe\dataframe.jl:721 df[DataFrames.:!, col_ind] = DataFrames.copy(v)
││┌ @ C:\Users\fsald\.julia\packages\DataFrames\Lrd7K\src\dataframe\dataframe.jl:669 DataFrames.insert_single_column!(df, v, col_ind)
│││┌ @ C:\Users\fsald\.julia\packages\DataFrames\Lrd7K\src\dataframe\dataframe.jl:653 DataFrames._drop_all_nonnote_metadata!(df)
││││┌ @ C:\Users\fsald\.julia\packages\DataFrames\Lrd7K\src\other\metadata.jl:759 DataFrames._drop_table_nonnote_metadata!(df)
│││││┌ @ C:\Users\fsald\.julia\packages\DataFrames\Lrd7K\src\other\metadata.jl:752  = iterate(metadatakeys(df), getfield(_3, 2))
││││││┌ @ tuple.jl:68 t[i]
│││││││┌ @ tuple.jl:29 Base.getfield(t, i, $(Expr(:boundscheck)))
││││││││ invalid builtin function call

This was posted in StackOverflow at https://stackoverflow.com/questions/74087675/how-do-i-identify-a-problem-flagged-by-jet-jl/74135082#74135082. An answer by @Bill observed that the problem did not occur with DataFrames v1.3.6 but found a different problem under v1.4.1.

@bkamins
Copy link
Member

bkamins commented Oct 24, 2022

This is an issue with JET.jl. x-ref aviatesk/JET.jl#404

@bkamins bkamins closed this as completed Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants