ganeshkumar269 commented on code in PR #340: URL: https://github.com/apache/datafusion-comet/pull/340#discussion_r1588000457
########## spark/src/test/scala/org/apache/comet/CometCastSuite.scala: ########## @@ -807,11 +833,22 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper { } else { // Spark 3.2 and 3.3 have a different error message format so we can't do a direct // comparison between Spark and Comet. + // In the case of CAST_INVALID_INPUT // Spark message is in format `invalid input syntax for type TYPE: VALUE` // Comet message is in format `The value 'VALUE' of the type FROM_TYPE cannot be cast to TO_TYPE` // We just check that the comet message contains the same invalid value as the Spark message - val sparkInvalidValue = sparkMessage.substring(sparkMessage.indexOf(':') + 2) - assert(cometMessage.contains(sparkInvalidValue)) + // In the case of CAST_OVERFLOW + // Spark message is in format `Casting VALUE to TO_TYPE causes overflow` + // Comet message is in format `The value 'VALUE' of the type FROM_TYPE cannot be cast to TO_TYPE + // due to an overflow` + // We check if the comet message contains 'overflow'. + val sparkInvalidValue = if (sparkMessage.indexOf(':') == -1) { + EMPTY_STRING + } else { + sparkMessage.substring(sparkMessage.indexOf(':') + 2) + } + assert( + cometMessage.contains(sparkInvalidValue) || cometMessage.contains("overflow")) Review Comment: you are right, my bad 😅 . so incase sparkMessage doesnt have ':' should I assert on just commetMessage.contains("overflow") something like this, ``` if sparkMessage.indexOf(':') == -1 then assert(commetMessage.contains("overflow")) else assert(commetMessage.contains(sparkInvalidValue)) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org