Improve parquet-go error handling
hangxie opened this issue · 1 comments
hangxie commented
parquet-go should not panic on catchable errors, follow error was from invalid CSV schema:
$ go run . import -m cmd/testdata/jsonl.schema -s cmd/testdata/jsonl.source /tmp/jsonl.parquet
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
github.com/alecthomas/kong.catch(0x140003bfef8)
/Users/xiehang/go/pkg/mod/github.com/alecthomas/kong@v0.2.16/kong.go:383 +0xd0
panic({0x102dcc7a0, 0x14000036c18})
/opt/homebrew/Cellar/go/1.17/libexec/src/runtime/panic.go:1038 +0x21c
github.com/xitongsys/parquet-go/common.StringToTag({0x14000500000, 0x1})
/Users/xiehang/go/pkg/mod/github.com/hangxie/parquet-go@v1.6.1/common/common.go:86 +0x2980
github.com/xitongsys/parquet-go/schema.NewSchemaHandlerFromMetadata({0x140002a0600, 0x14, 0x20})
/Users/xiehang/go/pkg/mod/github.com/hangxie/parquet-go@v1.6.1/schema/csv.go:28 +0x378
github.com/xitongsys/parquet-go/writer.NewCSVWriter({0x140002a0600, 0x14, 0x20}, {0x102e6cf50, 0x1400000fdb8}, 0x8)
/Users/xiehang/go/pkg/mod/github.com/hangxie/parquet-go@v1.6.1/writer/csv.go:27 +0x50
github.com/hangxie/parquet-tools/cmd.newCSVWriter({0x14000036be8, 0x12}, {0x140002a0600, 0x14, 0x20})
/Users/xiehang/Dev/parquet-tools/cmd/common.go:174 +0x94
github.com/hangxie/parquet-tools/cmd.(*ImportCmd).importCSV(0x10349d588)
/Users/xiehang/Dev/parquet-tools/cmd/import.go:56 +0x328
github.com/hangxie/parquet-tools/cmd.(*ImportCmd).Run(0x10349d588, 0x140000818a0)
/Users/xiehang/Dev/parquet-tools/cmd/import.go:27 +0x54
reflect.Value.call({0x102d56de0, 0x10349d588, 0x213}, {0x102a76885, 0x4}, {0x1400000fda0, 0x1, 0x1})
/opt/homebrew/Cellar/go/1.17/libexec/src/reflect/value.go:543 +0x584
reflect.Value.Call({0x102d56de0, 0x10349d588, 0x213}, {0x1400000fda0, 0x1, 0x1})
/opt/homebrew/Cellar/go/1.17/libexec/src/reflect/value.go:339 +0x8c
github.com/alecthomas/kong.callMethod({0x102a763b9, 0x3}, {0x102da8860, 0x10349d588, 0x199}, {0x102d56de0, 0x10349d588, 0x213}, 0x1400047c8d0)
/Users/xiehang/go/pkg/mod/github.com/alecthomas/kong@v0.2.16/callbacks.go:71 +0x4ac
github.com/alecthomas/kong.(*Context).RunNode(0x140000ecd00, 0x14000442460, {0x140003bff38, 0x1, 0x1})
/Users/xiehang/go/pkg/mod/github.com/alecthomas/kong@v0.2.16/context.go:706 +0x3e0
github.com/alecthomas/kong.(*Context).Run(0x140000ecd00, {0x140003bff38, 0x1, 0x1})
/Users/xiehang/go/pkg/mod/github.com/alecthomas/kong@v0.2.16/context.go:723 +0x80
main.main()
/Users/xiehang/Dev/parquet-tools/main.go:33 +0x1a8
exit status 2