cj-zhukov opened a new issue, #14144:
URL: https://github.com/apache/datafusion/issues/14144
### Describe the bug
When attempting to register an existing file with different format using the
register_csv, register_json, register_parquet, instead of receiving an error,
the operation silently returns an empty dataframe.
### To Reproduce
```rust
let file = "foo.parquet"; // foo.parquet does exist
let ctx = SessionContext::new();
ctx.register_csv("foo", file, CsvReadOptions::default()).await?; // trying
to register parquet file with register_csv
// ctx.register_json("foo", file, NdJsonReadOptions::default()).await?; //
or same using register_json
let res = ctx.sql("select * from foo").await?;
res.show().await?;
// Observe that no error is raised, but an empty DataFrame is returned.
// ++
// ++
```
### Expected behavior
Introduce a validation step in register_csv, register_json, register_parquet
to check the file extension or validate the file's format. If the file does not
match the expected format, return a clear error message:
```rust
Error: Execution("File path 'path/to/file' does not match the expected
extension '.extension'")
```
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]