mithrandie / csvq

SQL-like query language for csv
https://mithrandie.github.io/csvq
MIT License
1.49k stars 65 forks source link

panic: runtime error: index out of range [375] with length 0 #79

Closed aaronmlee closed 2 years ago

aaronmlee commented 2 years ago

steps:

  1. create a table csvq 'CREATE TABLE IF NOT EXISTS common_record (day, sleep_hrs_x, sleep_hrs_y, sleep_hrs_z);'
  2. Try to select into table from an existing CSV csvq 'REPLACE INTO common_record (day, sleep_hrs_x) USING (day) select day, total_sleep_duration from x_sleep'

note, day is a string date field.

results:

panic: runtime error: index out of range [375] with length 0

goroutine 67 [running]: github.com/mithrandie/csvq/lib/query.(View).replace.func2(0x177) github.com/mithrandie/csvq/lib/query/view.go:2231 +0x1a0 github.com/mithrandie/csvq/lib/query.(GoroutineTaskManager).run(0x140001f1880, {0x10338d618, 0x140001f1740}, 0x14000ecac00, 0x0?) github.com/mithrandie/csvq/lib/query/goroutine_manager.go:156 +0xfc created by github.com/mithrandie/csvq/lib/query.(*GoroutineTaskManager).Run github.com/mithrandie/csvq/lib/query/goroutine_manager.go:171 +0xbc panic: runtime error: index out of range [750] with length 0

goroutine 68 [running]: github.com/mithrandie/csvq/lib/query.(View).replace.func2(0x2ee) github.com/mithrandie/csvq/lib/query/view.go:2231 +0x1a0 github.com/mithrandie/csvq/lib/query.(GoroutineTaskManager).run(0x140001f1880, {0x10338d618, 0x140001f1740}, 0x14000ecac00, 0x0?) github.com/mithrandie/csvq/lib/query/goroutine_manager.go:156 +0xfc created by github.com/mithrandie/csvq/lib/query.(*GoroutineTaskManager).Run github.com/mithrandie/csvq/lib/query/goroutine_manager.go:171 +0xbc

found on Monterey 12.4 M1

ondohotola commented 2 years ago

Would be helpful if you included the command to create and fill x_sleep.csv so one can try to reproduce, even though it seems that it has been fixed.

On 30/06/2022 05:17, Aaron Lee wrote:

steps:

  1. create a table |csvq 'CREATE TABLE IF NOT EXISTS common_record (day, sleep_hrs_x, sleep_hrs_y, sleep_hrs_z);'|
  2. Try to select into table from an existing CSV |csvq 'REPLACE INTO common_record (day, sleep_hrs_x) USING (day) select day, total_sleep_duration from x_sleep'|

note, |day| is a string date field.

results:

panic: runtime error: index out of range [375] with length 0 [...]-- Dr. Eberhard W. Lisse \ / Obstetrician & Gynaecologist @.** / | Telephone: +264 81 124 6733 (cell) PO Box 8421 Bachbrecht \ / If this email is signed with GPG/PGP 10007, Namibia ;____/ Sect 20 of Act No. 4 of 2019 may apply

mithrandie commented 2 years ago

This bug has been fixed in Release v1.17.6.