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

Nil reference exception importing what seems to be a valid CSV #370

Closed
oscarbatori opened this issue Feb 5, 2020 · 1 comment · Fixed by #372
Closed

Nil reference exception importing what seems to be a valid CSV #370

oscarbatori opened this issue Feb 5, 2020 · 1 comment · Fixed by #372
Labels
bad error message bug Something isn't working
Projects

Comments

@oscarbatori
Copy link
Contributor

I tried to import some data as follows:

(liquidata-etl) [oscarbatori:coin_metrics(oscarbatori/coin-metrics)] >> dolt table import -c --pk date,ticker eod_data ../../initial_data.csv 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x19e1a42]

goroutine 1 [running]:
github.com/liquidata-inc/dolt/go/libraries/doltcore/table/untyped/csv.getColHeaders(0xc0002fc180, 0xc000320080, 0x40000, 0xc0005aa000, 0xc000316010, 0x0, 0x0)
        /Users/oscarbatori/Documents/dolt/go/libraries/doltcore/table/untyped/csv/reader.go:95 +0x192
github.com/liquidata-inc/dolt/go/libraries/doltcore/table/untyped/csv.NewCSVReader(0x3094858, 0x257ec40, 0xc000316010, 0xc000320080, 0xc000316010, 0x0, 0x0)
        /Users/oscarbatori/Documents/dolt/go/libraries/doltcore/table/untyped/csv/reader.go:63 +0xba
github.com/liquidata-inc/dolt/go/libraries/doltcore/table/untyped/csv.OpenCSVReader(0x3094858, 0x7ffeefbff63f, 0x16, 0x36214c0, 0x30e38c0, 0xc000320080, 0x0, 0x0, 0x0)
        /Users/oscarbatori/Documents/dolt/go/libraries/doltcore/table/untyped/csv/reader.go:57 +0xa7
github.com/liquidata-inc/dolt/go/libraries/doltcore/mvdata.FileDataLocation.NewReader(0x7ffeefbff63f, 0x16, 0x224fcbf, 0x4, 0x25970c0, 0xc000302180, 0xc000318060, 0x36214c0, 0x30e38c0, 0x0, ...)
        /Users/oscarbatori/Documents/dolt/go/libraries/doltcore/mvdata/file_data_loc.go:95 +0x1de
github.com/liquidata-inc/dolt/go/libraries/doltcore/mvdata.NewDataMover(0x25970c0, 0xc000302180, 0xc000318060, 0x25b1d00, 0x30e38c0, 0xc0003941b0, 0x22b85e8, 0x0, 0x0)
        /Users/oscarbatori/Documents/dolt/go/libraries/doltcore/mvdata/data_mover.go:103 +0x141
github.com/liquidata-inc/dolt/go/cmd/dolt/commands/tblcmds.executeMove(0x25970c0, 0xc000302180, 0xc000306000, 0xc0000f0000, 0xc0003941b0, 0x5)
        /Users/oscarbatori/Documents/dolt/go/cmd/dolt/commands/tblcmds/import.go:359 +0x151
github.com/liquidata-inc/dolt/go/cmd/dolt/commands/tblcmds.ImportCmd.Exec(0x25970c0, 0xc000302180, 0xc0002f0120, 0x11, 0xc0000f0030, 0x5, 0x5, 0xc000306000, 0x11)
        /Users/oscarbatori/Documents/dolt/go/cmd/dolt/commands/tblcmds/import.go:268 +0xcf
github.com/liquidata-inc/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec(0x22519bf, 0x5, 0x229b196, 0x3f, 0xc0003d0000, 0x5, 0x5, 0x25970c0, 0xc000302180, 0xc0004747b0, ...)
        /Users/oscarbatori/Documents/dolt/go/cmd/dolt/cli/command.go:149 +0x4e1
github.com/liquidata-inc/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec(0x22502a7, 0x4, 0x2262b13, 0x11, 0xc0002aa000, 0x1c, 0x1c, 0x2597040, 0xc0000c8000, 0x22502a7, ...)
        /Users/oscarbatori/Documents/dolt/go/cmd/dolt/cli/command.go:149 +0x4e1
main.runMain(0x0)
        /Users/oscarbatori/Documents/dolt/go/cmd/dolt/dolt.go:181 +0xa44
main.main()
        /Users/oscarbatori/Documents/dolt/go/cmd/dolt/dolt.go:89 +0x22

Hit me up for the file, as it's too large to attach this issue (36.4 MB, it's not huge).

@oscarbatori oscarbatori added bug Something isn't working bad error message and removed bug Something isn't working labels Feb 5, 2020
@oscarbatori
Copy link
Contributor Author

oscarbatori commented Feb 5, 2020

This is in fact caused by the following:

$ cat sample.csv
,c1,c2
1,a,b
2,c,d

Which in turn causes the following:

dolt table import -c --pk c1 test sample.csv
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x19e1a42]
.
.
.

So we just need a better error message, which probably involves catching this before a Nil pointer exception.

@oscarbatori oscarbatori added the bug Something isn't working label Feb 5, 2020
@andy-wm-arthur andy-wm-arthur linked a pull request Feb 5, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bad error message bug Something isn't working
Projects
No open projects
Dolt
  
Awaiting triage
Development

Successfully merging a pull request may close this issue.

1 participant