Skip to content

Commit a4d298f

Browse files
committed
check decimal type in assert
1 parent 114fb27 commit a4d298f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,10 +1214,13 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
12141214
if (cometException.getCause != null) cometException.getCause.getMessage
12151215
else cometException.getMessage
12161216
// for comet decimal conversion throws ArrowError(string) from arrow - across spark versions the message dont match.
1217-
if (sparkMessage.contains("cannot be represented as")) {
1218-
cometMessage.contains("cannot be represented as") || cometMessage.contains(
1219-
"too large to store")
1217+
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"))
12201222
} else {
1223+
12211224
if (CometSparkSessionExtensions.isSpark40Plus) {
12221225
// for Spark 4 we expect to sparkException carries the message
12231226
assert(
@@ -1236,7 +1239,7 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
12361239
.replace("[NUMERIC_VALUE_OUT_OF_RANGE] ", "")
12371240

12381241
if (sparkMessage.contains("cannot be represented as")) {
1239-
assert(cometMessage.contains("too large to store"))
1242+
assert(cometMessage.contains("cannot be represented as"))
12401243
} else {
12411244
assert(cometMessageModified == sparkMessage)
12421245
}

0 commit comments

Comments
 (0)