You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an empty table, and try to group by on it, then this error will occur.
For example:
touch oops.csv # Maybe a previous step gave an empty output
csvq 'select a, max(b) from oops group by a'
[Fatal Error] runtime error: index out of range [-1]
An unexpected error has occurred. Please report this problem to: https://github.com/mithrandie/csvq/issues
Stack:
0: github.com/mithrandie/csvq/lib/query.(*Processor).execute.func1 [github.com/mithrandie/csvq/lib/query/processor.go:95]
1: runtime.gopanic [runtime/panic.go:884]
2: runtime.goPanicIndex [runtime/panic.go:113]
3: github.com/mithrandie/csvq/lib/query.(*View).group [github.com/mithrandie/csvq/lib/query/view.go:240]
4: github.com/mithrandie/csvq/lib/query.(*View).GroupBy [github.com/mithrandie/csvq/lib/query/view.go:109]
5: github.com/mithrandie/csvq/lib/query.selectEntity [github.com/mithrandie/csvq/lib/query/query.go:206]
6: github.com/mithrandie/csvq/lib/query.Select [github.com/mithrandie/csvq/lib/query/query.go:122]
7: github.com/mithrandie/csvq/lib/query.(*Processor).ExecuteStatement [github.com/mithrandie/csvq/lib/query/processor.go:197]
8: github.com/mithrandie/csvq/lib/query.(*Processor).execute [github.com/mithrandie/csvq/lib/query/processor.go:103]
9: github.com/mithrandie/csvq/lib/query.(*Processor).Execute [github.com/mithrandie/csvq/lib/query/processor.go:83]
10: github.com/mithrandie/csvq/lib/action.Run [github.com/mithrandie/csvq/lib/action/run.go:60]
11: github.com/mithrandie/csvq/lib/cli.Run.func5 [github.com/mithrandie/csvq/lib/cli/app.go:297]
12: github.com/mithrandie/csvq/lib/cli.commandAction.func1 [github.com/mithrandie/csvq/lib/cli/app.go:373]
13: github.com/urfave/cli/v2.(*App).RunContext [github.com/urfave/cli/v2@v2.10.3/app.go:350]
14: github.com/urfave/cli/v2.(*App).Run [github.com/urfave/cli/v2@v2.10.3/app.go:247]
15: github.com/mithrandie/csvq/lib/cli.Run [github.com/mithrandie/csvq/lib/cli/app.go:306]
16: main.main [github.com/mithrandie/csvq/main.go:8]
17: runtime.main [runtime/proc.go:250]
18: runtime.goexit [runtime/asm_amd64.s:1594]
I guess the desired behavior isn't exactly clear: since the file is empty csvq cannot know the column names; on the other hand maybe we could add a flag to just assume any unknown columns are treated as null?
(NB: although I used csv in above example, my real use case is JSON; then the file would become just [] and the same problem occurs)
The text was updated successfully, but these errors were encountered:
If you have an empty table, and try to group by on it, then this error will occur.
For example:
I guess the desired behavior isn't exactly clear: since the file is empty csvq cannot know the column names; on the other hand maybe we could add a flag to just assume any unknown columns are treated as null?
(NB: although I used csv in above example, my real use case is JSON; then the file would become just
[]
and the same problem occurs)The text was updated successfully, but these errors were encountered: