0 votes
by (321k points)

Syntax to create a DataFrame based on the content of a JSON file
1. spark.textfile("examples/src/main/resources/data.json")
2. spark.read("examples/src/main/resources/data.json")
3. spark.read.json("examples/src/main/resources/data.json")
4. spark.json("examples/src/main/resources/data.json")

1 Answer

0 votes
by (321k points)

Syntax to create a DataFrame based on the content of a JSON file
1. spark.textfile("examples/src/main/resources/data.json")
2. spark.read("examples/src/main/resources/data.json")
3. spark.read.json("examples/src/main/resources/data.json")
4. spark.json("examples/src/main/resources/data.json")

Answer is spark.read.json("examples/src/main/resources/data.json")

🔗Reference : W3school.com

🔗Source: Interview Questions and Answers

🔗Reference: Javatpoint.com

...