Skip to content

Conversation

@NHDaly
Copy link
Member

@NHDaly NHDaly commented Apr 29, 2022

In the case where the response had to poll, there was a silly mistake
where we were reading the wrong field off the response.

Previously:

julia> RAI.exec(ctx, "nhd-test-1", "nhd-s", """
           2 + 2 * 2, "hi", 'a'
           """)
ERROR: KeyError: key "id" not found
Stacktrace:
 [1] getindex(h::Dict{String, JSON3.Object{Vector{UInt8}, Vector{UInt64}}}, key::String)
   @ Base ./dict.jl:481
 [2] exec(ctx::Context, database::String, engine::String, source::String; inputs::Nothing, readonly::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ RAI ~/work/rai-sdk-julia/src/api.jl:403

This is now fixed:

julia> RAI.exec(ctx, "nhd-test-1", "nhd-s", """
           2 + 2 * 2, "hi", 'a', "hello", '2', 2.0
           """)
Dict{String, Any} with 4 entries:
  "metadata"    => JSON3.Object[{
  "problems"    => Union{}[]
  "results"     => Pair{String, Arrow.Table}["/:output/Int64/String/…
  "transaction" => {…

In the case where the response had to poll, there was a silly mistake
where we were reading the wrong field off the response.

Previously:
```julia
julia> RAI.exec(ctx, "nhd-test-1", "nhd-s", """
           2 + 2 * 2, "hi", 'a'
           """)
ERROR: KeyError: key "id" not found
Stacktrace:
 [1] getindex(h::Dict{String, JSON3.Object{Vector{UInt8}, Vector{UInt64}}}, key::String)
   @ Base ./dict.jl:481
 [2] exec(ctx::Context, database::String, engine::String, source::String; inputs::Nothing, readonly::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ RAI ~/work/rai-sdk-julia/src/api.jl:403
```

This is now fixed:
```julia
julia> RAI.exec(ctx, "nhd-test-1", "nhd-s", """
           2 + 2 * 2, "hi", 'a', "hello", '2', 2.0
           """)
Dict{String, Any} with 4 entries:
  "metadata"    => JSON3.Object[{…
  "problems"    => Union{}[]
  "results"     => Pair{String, Arrow.Table}["/:output/Int64/String/…
  "transaction" => {…
```
@NHDaly NHDaly merged commit d04fc7f into main Apr 29, 2022
@NHDaly NHDaly deleted the nhd-exec-fix-bug branch April 29, 2022 16:57
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

Successfully merging this pull request may close these issues.

1 participant