Does any one know if it is possible to read either a csv or parquet file into a spark using the same code.
My use case here is that in production, I will be using large parquet files, but for unit tests, I would like to use CSVs. I'm using something like the following code:
spark.read().schema(schema).load(path);
This fails in the CSV case with the following exception:
file.csv is not a Parquet file. expected magic number at tail [80, 65, 82, 49] but found [78, 9, 78, 10]
I suspect that spark defaults to parquet, and this won't work, but I wanted to check first.