### _Why are the changes needed?_ - To improve Scala code with corrections, simplification, scala style, redundancy cleaning-up. No feature changes introduced. Corrections: - Class doesn't correspond to file name (SparkListenerExtensionTest) - Correct package name in ResultSetUtil and PySparkTests Improvements: - 'var' could be a 'val' - GetOrElse(null) to orNull Cleanup & Simplification: - Redundant cast inspection - Redundant collection conversion - Simplify boolean expression - Redundant new on case class - Redundant return - Unnecessary parentheses - Unnecessary partial function - Simplifiable empty check - Anonymous function convertible to a method value Scala Style: - Constructing range for seq indices - Get and getOrElse to getOrElse - Convert expression to Single Abstract Method (SAM) - Scala unnecessary semicolon inspection - Map and getOrElse(false) to exists - Map and flatten to flatMap - Null initializer can be replaced by _ - scaladoc link to method Other Improvements: - Replace map and getOrElse(true) with forall - Unit return type in the argument of map - Size to length on arrays and strings - Type check can be pattern matching - Java mutator method accessed as parameterless - Procedure syntax in method definition ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request Closes #4959 from bowenliang123/scala-Improve. Closes #4959 2d36ff351 [liangbowen] code improvement for Scala Authored-by: liangbowen <liangbowen@gf.com.cn> Signed-off-by: liangbowen <liangbowen@gf.com.cn> |
||
|---|---|---|
| .. | ||
| kyuubi-flink-it | ||
| kyuubi-hive-it | ||
| kyuubi-jdbc-it | ||
| kyuubi-kubernetes-it | ||
| kyuubi-trino-it | ||
| kyuubi-zookeeper-it | ||
| pom.xml | ||