I have a DataFrame that loads from a huge json file and gets the schema from it. The schema is basically around 1000 columns. I want the same output of printSchema to be saved in a file instead of the console.
Any ideas?
I have a DataFrame that loads from a huge json file and gets the schema from it. The schema is basically around 1000 columns. I want the same output of printSchema to be saved in a file instead of the console.
Any ideas?
This is the body of printSchema():
So you can't do much, but I have a work around that can work in your case. Set the out stream to a file Stream so that it gets printed to your File.
Something like this
I hope I solved your query !
You can do the following if you are working in a local environment :
If you are on HDFS, you'll need to provide a URI.