Encounter a problem,
I know the count of the action and saveAsTextFile,
Now I want to count the results into the file, how to do?
Can't data. * * *. Count. SaveAsTextFile (* *)
Thank you,
CodePudding user response:
Can't, saveAsTextFile (RDD), the method of action do the count returned is Long, want to write to the file, needs to be converted to a String, and then invokes the Java IO stream to a fileCodePudding user response:
You can use this long Numbers and build a new RDD object, then saveAsTextFile () is storedCodePudding user response:
After the count is a numeric value, directly in the Java method had written to the file,