[SPARK-3418] Fixed style issues and added documentation for methods