Skip to content

Commit 0ed62b3

Browse files
improve test style
1 parent f922ff3 commit 0ed62b3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,8 @@ class ExpressionEncoderSuite extends CodegenInterpretedPlanTest with AnalysisTes
427427
testOverflowingBigNumeric(BigInt("9" * 100), "scala very large big int")
428428
testOverflowingBigNumeric(new BigInteger("9" * 100), "java very big int")
429429

430-
private def testOverflowingBigNumeric[T: TypeTag](bigDecimal: T, testName: String): Unit = {
431-
for {
432-
allowNullOnOverflow <- Seq(true, false)
433-
} {
430+
private def testOverflowingBigNumeric[T: TypeTag](bigNumeric: T, testName: String): Unit = {
431+
Seq(true, false).foreach { allowNullOnOverflow =>
434432
testAndVerifyNotLeakingReflectionObjects(
435433
s"overflowing $testName, allowNullOnOverflow=$allowNullOnOverflow") {
436434
withSQLConf(
@@ -440,11 +438,11 @@ class ExpressionEncoderSuite extends CodegenInterpretedPlanTest with AnalysisTes
440438
// so that SQLConf changes are respected.
441439
val encoder = ExpressionEncoder[T]()
442440
if (allowNullOnOverflow) {
443-
val convertedBack = encoder.resolveAndBind().fromRow(encoder.toRow(bigDecimal))
441+
val convertedBack = encoder.resolveAndBind().fromRow(encoder.toRow(bigNumeric))
444442
assert(convertedBack === null)
445443
} else {
446444
val e = intercept[RuntimeException] {
447-
encoder.toRow(bigDecimal)
445+
encoder.toRow(bigNumeric)
448446
}
449447
assert(e.getMessage.contains("Error while encoding"))
450448
assert(e.getCause.getClass === classOf[ArithmeticException])

0 commit comments

Comments
 (0)