Noopur_Nigam
Databricks Employee
Databricks Employee

Hi @João Galdino​ There are below points which are incorrect in your spark read command:

1) The Syntax is wrong, it can be

df = spark.read\

.format("binaryFile")

.load("directory of file")

or

df = spark.read\

.format("json")

.load("directory of file")

or

df = spark.read

.json("directory of file")

You need to specify a file format and then provide file's path.

2) Spark expects a source file path, it does not understand BytesIO() object in read statement.

You can refer to below doc for more understanding on what are the supported sources with spark and how to read and write using them.You can refer to below doc:

https://docs.databricks.com/data/data-sources/index.html