Panic when no separator is given (using ; as separator)
Closed this issue · 1 comments
Write commented
Hi,
I tried this simple CSV, where the first line is the header.
It seems to crash every time if I'm not setting the separator explicitly.
thread 'main' panicked at src/main.rs:43:29:
found more fields than defined in 'Schema'
Consider setting 'truncate_ragged_lines=true'.
stack backtrace:
0: 0x6433939e79b2 - <unknown>
1: 0x643392a27e8b - <unknown>
2: 0x6433939b8172 - <unknown>
3: 0x6433939ed139 - <unknown>
4: 0x6433939ec95e - <unknown>
5: 0x6433939ec479 - <unknown>
6: 0x6433939ed6ac - <unknown>
7: 0x6433939ed4a2 - <unknown>
8: 0x6433939ed3f9 - <unknown>
9: 0x6433939ed3e6 - <unknown>
10: 0x6433928a7642 - <unknown>
11: 0x643392992f07 - <unknown>
12: 0x6433928a46b6 - <unknown>
13: 0x6433929a91f1 - <unknown>
14: 0x64339298dcb3 - <unknown>
15: 0x6433929aa0ab - <unknown>
16: 0x7ca06032fd90 - <unknown>
17: 0x7ca06032fe40 - __libc_start_main
18: 0x6433929883e5 - <unknown>
19: 0x0 - <unknown>
[1] 6379 IOT instruction (core dumped) truncate_ragged_lines=true RUST_BACKTRACE=full tw test.csv --ignore-errors
CSV file is using ";" as spearator.
index;type;marque;nom;all_names;other_name_1;other_name_2;other_name_3;other_name_4;other_name_5;other_name_6;other_name_7;other_name_8;version;version_full;date_sortie;poids_g;densite_ppi;resolution_px;batterie_mah;ram_gb;ram_type;storage_gb;storage_type;extensible_state;extensible_full_info;soc;gpu;antutu_version;antutu_score;url;recond_prix;recond_country;recond_provider;recond_url;recond_json
2;smartphone;realme;realme GT 6;realme GT 6,RMX3851,realme GT6;RMX3851;realme GT6;;;;;;;Global;Global | 12GB | 256GB;Juin 2024;199;450;1264x2780;5500;12;LPDDR5X;256;Stockage UFS 4.0;Non;Non;Qualcomm Snapdragon 8s Gen3;Adreno 735;10;1628715;hidden;NO_RECOND_PRICE;NO_RECOND_COUNTRY;NO_RECOND_PROVIDER;NO_RECOND_URL;NO_JSON
Specifying the separator explicitly in the command line arguments make it works.
tw test.csv --ignore-errors --separator ";"
shshemi commented
Hi,
Thank you for your bug report.
In your case, the first row has no commas, indicating that the file has only one column. However, the second row has two commas, suggesting that it has three columns. This inconsistency is causing the application to panic. Additionally, please note that the default separator is a comma ,
.