Commit d5cf2fd
committed
SNOW-3385961: improve INFER_SCHEMA zero-row FileNotFoundError message
When INFER_SCHEMA returns zero rows, the reader used to raise:
FileNotFoundError: Given path: '{path}' could not be found or is empty.
Zero rows can also mean file-format options silently filtered every
row/header (e.g. PARSE_HEADER on a file with a leading blank line,
SKIP_HEADER exceeding row count, or ON_ERROR=CONTINUE dropping bad
rows). The old message sends users chasing a path-not-found issue
that isn't real.
Keep the exception type (FileNotFoundError) for back-compat, but
rewrite the message to surface both possibilities and append any
applied PARSE_HEADER / SKIP_HEADER / ON_ERROR values that are already
in scope (no extra round-trip).
Update the existing integ assertions in test_filepath_not_exist_or_empty
to match the new wording and to access the message via str(ex_info.value)
so the full (longer) message is compared.1 parent 0694dae commit d5cf2fd
2 files changed
Lines changed: 33 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1338 | 1338 | | |
1339 | 1339 | | |
1340 | 1340 | | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
1341 | 1359 | | |
1342 | | - | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
1343 | 1366 | | |
1344 | 1367 | | |
1345 | 1368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2119 | 2119 | | |
2120 | 2120 | | |
2121 | 2121 | | |
2122 | | - | |
2123 | | - | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
2124 | 2125 | | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
2125 | 2129 | | |
2126 | 2130 | | |
2127 | 2131 | | |
2128 | 2132 | | |
2129 | 2133 | | |
2130 | 2134 | | |
2131 | | - | |
2132 | | - | |
| 2135 | + | |
| 2136 | + | |
2133 | 2137 | | |
| 2138 | + | |
2134 | 2139 | | |
2135 | 2140 | | |
2136 | 2141 | | |
| |||
0 commit comments