[SPARK-3418] Fixed Scala-style errors