I am trying improve the accuracy of Logistic regression algorithm implemented in Spark using Java. For this I\'m trying to replace Null or invalid values present in a column
You'll want to use the fill(String value, String[] columns) method of your dataframe, which automatically replaces Null values in a given list of columns with the value you specified.
So if you already know the value that you want to replace Null with...:
String[] colNames = {"Name"}
dataframe = dataframe.na.fill("a", colNames)
You can do the same for the rest of your columns.