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
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:
Error: Execution("File path 'path/to/file' does not match the expected extension '.extension'")
Additional context
No response