GenieFramework / GenieFramework/SearchLight.jl

NULL in database triggers UndefRefError

Open
#24 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
149
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Playing through the Genie "Bill Gates Books" tutorial. The migration to the second version of the DB (i.e. adding the `cover` column) breaks SearchLight:

```jl
┌ Error: 2020-02-10 16:28:59 UndefRefError()
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:716
┌ Error: 2020-02-10 16:28:59 cover
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:717
┌ Error: 2020-02-10 16:28:59 UndefRefError()
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:716
┌ Error: 2020-02-10 16:28:59 cover
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:717
┌ Error: 2020-02-10 16:28:59 UndefRefError()
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:716
┌ Error: 2020-02-10 16:28:59 cover
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:717
┌ Error: 2020-02-10 16:28:59 UndefRefError()
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:716
┌ Error: 2020-02-10 16:28:59 cover
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:717
┌ Error: 2020-02-10 16:28:59 UndefRefError()
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:716
┌ Error: 2020-02-10 16:28:59 cover
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:717
┌ Error: 2020-02-10 16:28:59 UndefRefError()
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:716
┌ Error: 2020-02-10 16:28:59 cover
└ @ SearchLight .../packages/SearchLight/syIVM/src/SearchLight.jl:717
```

Appears whenever `all(Book)` is ran.

This appears to be due to handling of missing values. Opening the database in SQLite.jl the `cover` column in particular is typed as `Union{Missing,String}`. So I assume the problem springs from trying to turn a `Missing` into a `String` as required by the `Book` model struct.

Changing the type of `cover` to `Union{Missing,String}` leads to the same error.

```jl
pkg> status SearchLight
Status `.../CRUDtest/Project.toml`
[295af30f] Revise v2.5.0
[0aa819cd] SQLite v0.9.0
[340e8cb6] SearchLight v0.17.0 #master

julia> versioninfo()
Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
JULIA_DEPOT_PATH = .../julia-depot
JULIA_NUM_THREADS = 8
JULIA_EDITOR = atom -a
JULIA_REVISE = auto
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Read SearchLight.jl around lines 716-717 and reproduce the failure with all(Book) after the second migration; inspect how the cover value from SQLite.jl is mapped into the Book model. Done means nullable cover values no longer produce UndefRefError and all(Book) completes in the tutorial setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.