Skip to content

Commit fb25fd9

Browse files
committed
fix the assert to be very specific msg
1 parent 535223d commit fb25fd9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

spark/src/test/scala/org/apache/comet/CometCastSuite.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,14 +1213,11 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
12131213
val cometMessage =
12141214
if (cometException.getCause != null) cometException.getCause.getMessage
12151215
else cometException.getMessage
1216-
// for comet decimal conversion throws ArrowError(string) from arrow - across spark versions the message dont match.
1216+
// this if branch should only check decimal to decimal cast and errors when output precision, scale causes overflow.
12171217
if (df.schema("a").dataType.typeName.contains("decimal") && toType.typeName
1218-
.contains("decimal")) {
1219-
assert(
1220-
cometMessage.contains("too large to store") ==
1221-
sparkMessage.contains("cannot be represented as"))
1218+
.contains("decimal") && sparkMessage.contains("cannot be represented as")) {
1219+
assert(cometMessage.contains("too large to store"))
12221220
} else {
1223-
12241221
if (CometSparkSessionExtensions.isSpark40Plus) {
12251222
// for Spark 4 we expect to sparkException carries the message
12261223
assert(

0 commit comments

Comments
 (0)